Commit 0e0bead3 authored by Simon Giesecke's avatar Simon Giesecke

Problem: code from bind_loopback_ipc is duplicated

Solution: call bind_loopback_ipc where applicable
parent 7f64b925
...@@ -35,12 +35,8 @@ SETUP_TEARDOWN_TESTCONTEXT ...@@ -35,12 +35,8 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_ipc_wildcard () void test_ipc_wildcard ()
{ {
void *sb = test_context_socket (ZMQ_PAIR); void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
char endpoint[200]; char endpoint[200];
size_t size = sizeof (endpoint); bind_loopback_ipc (sb, endpoint, sizeof endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size));
void *sc = test_context_socket (ZMQ_PAIR); void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint));
......
...@@ -35,12 +35,9 @@ SETUP_TEARDOWN_TESTCONTEXT ...@@ -35,12 +35,9 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_roundtrip () void test_roundtrip ()
{ {
char my_endpoint[256]; char my_endpoint[256];
size_t len = sizeof (my_endpoint);
void *sb = test_context_socket (ZMQ_PAIR); void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*")); bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_PAIR); void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
......
...@@ -39,10 +39,7 @@ void test_leak () ...@@ -39,10 +39,7 @@ void test_leak ()
char my_endpoint[256]; char my_endpoint[256];
void *sb = test_context_socket (ZMQ_REP); void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*")); bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
size_t len = sizeof (my_endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_REQ); void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
...@@ -67,10 +64,7 @@ void test_simple (void) ...@@ -67,10 +64,7 @@ void test_simple (void)
char my_endpoint[256]; char my_endpoint[256];
void *sb = test_context_socket (ZMQ_REP); void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*")); bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
size_t len = sizeof (my_endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
void *sc = test_context_socket (ZMQ_REQ); void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint)); TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
......
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