summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-20 16:03:45 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-20 16:03:45 -0800
commit5e031e639df65d7f12a0d2f776f188fde1b98fd9 (patch)
tree159f9a76efa89ce40bc0cbe32502d6524b28b985 /src/protocol
parent8abf75857e8993a25e50d07bdd6d9628f028d7cc (diff)
downloadnng-5e031e639df65d7f12a0d2f776f188fde1b98fd9.tar.gz
nng-5e031e639df65d7f12a0d2f776f188fde1b98fd9.tar.bz2
nng-5e031e639df65d7f12a0d2f776f188fde1b98fd9.zip
fixes #1163 compat tests are very brittle
This only addresses the newly rewitten compat_tcp test, but it sets the groundwork for the other tests, so that when they are updated to the new acutest.h they can use the new marry code to establish connections cleanly and safely.
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/reqrep0/xreq_test.c8
-rw-r--r--src/protocol/survey0/xsurvey_test.c16
2 files changed, 12 insertions, 12 deletions
diff --git a/src/protocol/reqrep0/xreq_test.c b/src/protocol/reqrep0/xreq_test.c
index e474a0ac..57ad7f0a 100644
--- a/src/protocol/reqrep0/xreq_test.c
+++ b/src/protocol/reqrep0/xreq_test.c
@@ -234,7 +234,7 @@ test_xreq_recv_header(void)
TEST_NNG_PASS(nng_setopt_ms(rep, NNG_OPT_SENDTIMEO, 1000));
TEST_NNG_PASS(nng_setopt_ms(rep, NNG_OPT_SENDTIMEO, 1000));
- TEST_NNG_PASS(testutil_marry_ex(req, rep, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(req, rep, NULL, &p1, &p2));
// Simulate a few hops.
TEST_NNG_PASS(nng_msg_alloc(&m, 0));
@@ -276,7 +276,7 @@ test_xreq_close_during_recv(void)
TEST_NNG_PASS(nng_setopt_int(req, NNG_OPT_RECVBUF, 5));
TEST_NNG_PASS(nng_setopt_int(rep, NNG_OPT_SENDBUF, 20));
- TEST_NNG_PASS(testutil_marry_ex(req, rep, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(req, rep, NULL, &p1, &p2));
TEST_CHECK(nng_pipe_id(p1) > 0);
TEST_CHECK(nng_pipe_id(p2) > 0);
@@ -307,7 +307,7 @@ test_xreq_close_pipe_during_send(void)
TEST_NNG_PASS(nng_setopt_int(rep, NNG_OPT_RECVBUF, 5));
TEST_NNG_PASS(nng_setopt_int(req, NNG_OPT_SENDBUF, 20));
- TEST_NNG_PASS(testutil_marry_ex(req, rep, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(req, rep, NULL, &p1, &p2));
TEST_CHECK(nng_pipe_id(p1) > 0);
TEST_CHECK(nng_pipe_id(p2) > 0);
@@ -329,7 +329,7 @@ test_xreq_ttl_option(void)
nng_socket rep;
int v;
bool b;
- size_t sz = sizeof(v);
+ size_t sz;
const char *opt = NNG_OPT_MAXTTL;
TEST_NNG_PASS(nng_req0_open_raw(&rep));
diff --git a/src/protocol/survey0/xsurvey_test.c b/src/protocol/survey0/xsurvey_test.c
index b0123145..ff096de4 100644
--- a/src/protocol/survey0/xsurvey_test.c
+++ b/src/protocol/survey0/xsurvey_test.c
@@ -227,7 +227,7 @@ test_xsurvey_recv_header(void)
nng_socket resp;
nng_socket surv;
nng_msg * m;
- nng_pipe p1, p2;
+ nng_pipe p;
uint32_t id;
TEST_NNG_PASS(nng_respondent0_open_raw(&resp));
@@ -237,11 +237,11 @@ test_xsurvey_recv_header(void)
TEST_NNG_PASS(nng_setopt_ms(resp, NNG_OPT_SENDTIMEO, 1000));
TEST_NNG_PASS(nng_setopt_ms(resp, NNG_OPT_SENDTIMEO, 1000));
- TEST_NNG_PASS(testutil_marry_ex(surv, resp, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(surv, resp, NULL, NULL, &p));
// Simulate a few hops.
TEST_NNG_PASS(nng_msg_alloc(&m, 0));
- TEST_NNG_PASS(nng_msg_header_append_u32(m, nng_pipe_id(p2)));
+ TEST_NNG_PASS(nng_msg_header_append_u32(m, nng_pipe_id(p)));
TEST_NNG_PASS(nng_msg_header_append_u32(m, 0x2));
TEST_NNG_PASS(nng_msg_header_append_u32(m, 0x1));
TEST_NNG_PASS(nng_msg_header_append_u32(m, 0x80000123u));
@@ -279,7 +279,7 @@ test_xsurvey_close_during_recv(void)
TEST_NNG_PASS(nng_setopt_int(surv, NNG_OPT_RECVBUF, 1));
TEST_NNG_PASS(nng_setopt_int(resp, NNG_OPT_SENDBUF, 20));
- TEST_NNG_PASS(testutil_marry_ex(surv, resp, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(surv, resp, NULL, &p1, &p2));
TEST_CHECK(nng_pipe_id(p1) > 0);
TEST_CHECK(nng_pipe_id(p2) > 0);
@@ -310,7 +310,7 @@ test_xsurvey_close_pipe_during_send(void)
TEST_NNG_PASS(nng_setopt_int(resp, NNG_OPT_RECVBUF, 5));
TEST_NNG_PASS(nng_setopt_int(surv, NNG_OPT_SENDBUF, 20));
- TEST_NNG_PASS(testutil_marry_ex(surv, resp, &p1, &p2));
+ TEST_NNG_PASS(testutil_marry_ex(surv, resp, NULL, &p1, &p2));
TEST_CHECK(nng_pipe_id(p1) > 0);
TEST_CHECK(nng_pipe_id(p2) > 0);
@@ -332,7 +332,7 @@ test_xsurvey_ttl_option(void)
nng_socket s;
int v;
bool b;
- size_t sz = sizeof(v);
+ size_t sz;
const char *opt = NNG_OPT_MAXTTL;
TEST_NNG_PASS(nng_surveyor0_open_raw(&s));
@@ -403,7 +403,7 @@ TEST_LIST = {
{ "xsurvey close during recv", test_xsurvey_close_during_recv },
{ "xsurvey close pipe during send",
test_xsurvey_close_pipe_during_send },
- { "xsurvey ttl option", test_xsurvey_ttl_option },
- { "xsurvey broadcast", test_xsurvey_broadcast },
+ { "xsurvey ttl option", test_xsurvey_ttl_option },
+ { "xsurvey broadcast", test_xsurvey_broadcast },
{ NULL, NULL },
};