mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
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.
This commit is contained in:
parent
5934919f3e
commit
b29d46b6a5
@ -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);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user