aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-24 16:27:53 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-24 16:27:53 -0700
commit2e5f47aed81992a8dba4b27823894507794fc0ad (patch)
tree2383f0139d6931efbbc20ac63be6dfbc1f6e1279 /tests
parentc9a68bfe6bea2acc708bf49045f6cb65017a3306 (diff)
downloadnng-2e5f47aed81992a8dba4b27823894507794fc0ad.tar.gz
nng-2e5f47aed81992a8dba4b27823894507794fc0ad.tar.bz2
nng-2e5f47aed81992a8dba4b27823894507794fc0ad.zip
Fix a few warnings and subtle test races.
Diffstat (limited to 'tests')
-rw-r--r--tests/pair1.c1
-rw-r--r--tests/pipeline.c2
-rw-r--r--tests/pubsub.c5
3 files changed, 5 insertions, 3 deletions
diff --git a/tests/pair1.c b/tests/pair1.c
index 6e7a22cb..7b26702b 100644
--- a/tests/pair1.c
+++ b/tests/pair1.c
@@ -172,7 +172,6 @@ TestMain("PAIRv1 protocol", {
});
Convey("Cannot set polyamorous mode after connect", {
- int poly;
So(nng_listen(s1, addr, NULL, 0) == 0);
So(nng_dial(c1, addr, NULL, 0) == 0);
nng_usleep(100000);
diff --git a/tests/pipeline.c b/tests/pipeline.c
index 78002fc6..618b7227 100644
--- a/tests/pipeline.c
+++ b/tests/pipeline.c
@@ -79,6 +79,8 @@ TestMain("PIPELINE (PUSH/PULL) pattern", {
So(nng_dial(what, addr, NULL, 0) == 0);
So(nng_shutdown(what) == 0);
+ nng_usleep(20000);
+
Convey("Push can send messages, and pull can recv", {
nng_msg *msg;
diff --git a/tests/pubsub.c b/tests/pubsub.c
index de2fcfc5..3bdd8f8c 100644
--- a/tests/pubsub.c
+++ b/tests/pubsub.c
@@ -77,11 +77,12 @@ TestMain("PUB/SUB pattern", {
// and the sub dial. However, this creates a problem
// for our tests, since we can wind up trying to push
// data before the pipe is fully registered (the accept
- // runs asynchronously.) Doing the reverse here
- // ensures that we won't lose data.
+ // runs asynchronously.)
So(nng_listen(sub, addr, NULL, 0) == 0);
So(nng_dial(pub, addr, NULL, 0) == 0);
+ nng_usleep(20000); // give time for connecting threads
+
Convey("Sub can subscribe", {
So(nng_setopt(
sub, nng_optid_sub_subscribe, "ABC", 3) == 0);