Commit b29d46b6 authored by Luca Boccassi's avatar Luca Boccassi

Problem: tests use same IPC endpoint

Solution: use either a wildcard IPC, or where the codepath needs to
be tested a file named after the test, so that it is unique and there
is no clash on the filesystem, allowing parallel test runs.
parent 5934919f
......@@ -37,12 +37,12 @@ int main (void)
void *sb = zmq_socket (ctx, ZMQ_PAIR);
assert (sb);
int rc = zmq_bind (sb, "ipc:///tmp/tester");
int rc = zmq_bind (sb, "ipc:///tmp/test_pair_ipc");
assert (rc == 0);
void *sc = zmq_socket (ctx, ZMQ_PAIR);
assert (sc);
rc = zmq_connect (sc, "ipc:///tmp/tester");
rc = zmq_connect (sc, "ipc:///tmp/test_pair_ipc");
assert (rc == 0);
bounce (sb, sc);
......
/*
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
Copyright (c) 2007-2017 Contributors as noted in the AUTHORS file
This file is part of libzmq, the ZeroMQ core engine in C++.
......@@ -32,17 +32,21 @@
int main (void)
{
setup_test_environment();
char my_endpoint[256];
void *ctx = zmq_ctx_new ();
assert (ctx);
void *sb = zmq_socket (ctx, ZMQ_REP);
assert (sb);
int rc = zmq_bind (sb, "ipc:///tmp/tester");
int rc = zmq_bind (sb, "ipc://*");
assert (rc == 0);
size_t len = sizeof(my_endpoint);
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len);
assert (rc == 0);
void *sc = zmq_socket (ctx, ZMQ_REQ);
assert (sc);
rc = zmq_connect (sc, "ipc:///tmp/tester");
rc = zmq_connect (sc, my_endpoint);
assert (rc == 0);
bounce (sb, sc);
......
......@@ -64,14 +64,14 @@ void test_req_rep ()
void *sb = zmq_socket (ctx, ZMQ_REP);
assert (sb);
pre_allocate_sock(sb, "/tmp/tester");
pre_allocate_sock(sb, "/tmp/test_use_fd_ipc");
int rc = zmq_bind (sb, "ipc:///tmp/tester");
int rc = zmq_bind (sb, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
void *sc = zmq_socket (ctx, ZMQ_REQ);
assert (sc);
rc = zmq_connect (sc, "ipc:///tmp/tester");
rc = zmq_connect (sc, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
bounce (sb, sc);
......@@ -85,7 +85,7 @@ void test_req_rep ()
rc = zmq_ctx_term (ctx);
assert (rc == 0);
rc = unlink ("/tmp/tester");
rc = unlink ("/tmp/test_use_fd_ipc");
assert (rc == 0);
}
......@@ -97,14 +97,14 @@ void test_pair ()
void *sb = zmq_socket (ctx, ZMQ_PAIR);
assert (sb);
pre_allocate_sock(sb, "/tmp/tester");
pre_allocate_sock(sb, "/tmp/test_use_fd_ipc");
int rc = zmq_bind (sb, "ipc:///tmp/tester");
int rc = zmq_bind (sb, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
void *sc = zmq_socket (ctx, ZMQ_PAIR);
assert (sc);
rc = zmq_connect (sc, "ipc:///tmp/tester");
rc = zmq_connect (sc, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
bounce (sb, sc);
......@@ -118,7 +118,7 @@ void test_pair ()
rc = zmq_ctx_term (ctx);
assert (rc == 0);
rc = unlink ("/tmp/tester");
rc = unlink ("/tmp/test_use_fd_ipc");
assert (rc == 0);
}
......@@ -131,14 +131,14 @@ void test_client_server ()
void *sb = zmq_socket (ctx, ZMQ_SERVER);
assert (sb);
pre_allocate_sock(sb, "/tmp/tester");
pre_allocate_sock(sb, "/tmp/test_use_fd_ipc");
int rc = zmq_bind (sb, "ipc:///tmp/tester");
int rc = zmq_bind (sb, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
void *sc = zmq_socket (ctx, ZMQ_CLIENT);
assert (sc);
rc = zmq_connect (sc, "ipc:///tmp/tester");
rc = zmq_connect (sc, "ipc:///tmp/test_use_fd_ipc");
assert (rc == 0);
zmq_msg_t msg;
......@@ -199,7 +199,7 @@ void test_client_server ()
rc = zmq_ctx_term (ctx);
assert (rc == 0);
rc = unlink ("/tmp/tester");
rc = unlink ("/tmp/test_use_fd_ipc");
assert (rc == 0);
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment