mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 01:37:56 +08:00
Problem: no test for (invalid) too long ipc endpoint name
Solution: add test
This commit is contained in:
parent
90d5cf29d8
commit
2741e93361
@ -30,6 +30,8 @@
|
||||
#include "testutil.hpp"
|
||||
#include "testutil_unity.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
SETUP_TEARDOWN_TESTCONTEXT
|
||||
|
||||
void test_roundtrip ()
|
||||
@ -48,11 +50,32 @@ void test_roundtrip ()
|
||||
test_context_socket_close (sb);
|
||||
}
|
||||
|
||||
static const char prefix[] = "ipc://";
|
||||
|
||||
void test_endpoint_too_long ()
|
||||
{
|
||||
std::string endpoint_too_long;
|
||||
endpoint_too_long.append (prefix);
|
||||
for (size_t i = 0; i < 108; ++i) {
|
||||
endpoint_too_long.append ("a");
|
||||
}
|
||||
|
||||
void *sb = test_context_socket (ZMQ_PAIR);
|
||||
// TODO ENAMETOOLONG is not listed in the errors returned by zmq_bind,
|
||||
// should this be EINVAL?
|
||||
TEST_ASSERT_FAILURE_ERRNO (ENAMETOOLONG,
|
||||
zmq_bind (sb, endpoint_too_long.data ()));
|
||||
|
||||
test_context_socket_close (sb);
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
setup_test_environment ();
|
||||
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_roundtrip);
|
||||
RUN_TEST (test_endpoint_too_long);
|
||||
return UNITY_END ();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user