Problem: tests use hard-coded fixed IPC file path

Solution: use wildcards or random directories to avoid races when
multiple users are running the same test on the same machine
This commit is contained in:
Luca Boccassi
2019-01-13 14:50:07 +00:00
parent 4147957a5e
commit f64b697095
4 changed files with 42 additions and 16 deletions

View File

@@ -44,11 +44,16 @@ void tearDown ()
void test_roundtrip ()
{
char my_endpoint[256];
size_t len = sizeof (my_endpoint);
void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc:///tmp/test_pair_ipc"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "ipc:///tmp/test_pair_ipc"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
bounce (sb, sc);