aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-12-28 16:02:53 -0800
committerGarrett D'Amore <garrett@damore.org>2017-12-28 16:02:53 -0800
commitaa3bb50aeca3b7350a41f0538817c49d9656d207 (patch)
tree4abafbdc7553e52776394e067fa1ff9a08a14a57 /tests
parent838d92deabffbaae1b1a9e447d2088f966078726 (diff)
downloadnng-aa3bb50aeca3b7350a41f0538817c49d9656d207.tar.gz
nng-aa3bb50aeca3b7350a41f0538817c49d9656d207.tar.bz2
nng-aa3bb50aeca3b7350a41f0538817c49d9656d207.zip
Fix compilation warnings, bugs, and crashes found on Windows.
This addresses a number of problems that were found on Windows, including one bug that actually turned up in testing on POSIX.
Diffstat (limited to 'tests')
-rw-r--r--tests/httpclient.c12
-rw-r--r--tests/ws.c1
-rw-r--r--tests/zt.c8
3 files changed, 8 insertions, 13 deletions
diff --git a/tests/httpclient.c b/tests/httpclient.c
index ab4f46a2..6ea6fa6e 100644
--- a/tests/httpclient.c
+++ b/tests/httpclient.c
@@ -30,13 +30,11 @@ TestMain("HTTP Client", {
atexit(nng_fini);
Convey("Given a TCP connection to httpbin.org", {
- nni_plat_tcp_ep * ep;
- nni_plat_tcp_pipe *p;
- nng_aio * aio;
- nni_aio * iaio;
- nng_sockaddr rsa;
- nni_http_client * cli;
- nni_http * http;
+ nng_aio * aio;
+ nni_aio * iaio;
+ nng_sockaddr rsa;
+ nni_http_client *cli;
+ nni_http * http;
So(nng_aio_alloc(&aio, NULL, NULL) == 0);
iaio = (nni_aio *) aio;
diff --git a/tests/ws.c b/tests/ws.c
index 71836390..aa2ba56e 100644
--- a/tests/ws.c
+++ b/tests/ws.c
@@ -104,6 +104,7 @@ TestMain("WebSocket Transport", {
});
trantest_next_address(addr, "ws://*:%u/test");
So(nng_listen(s1, addr, NULL, 0) == 0);
+ nng_msleep(100);
// reset port back one
trantest_prev_address(addr, "ws://127.0.0.1:%u/test");
So(nng_dial(s2, addr, NULL, 0) == 0);
diff --git a/tests/zt.c b/tests/zt.c
index bf423df0..52f535c9 100644
--- a/tests/zt.c
+++ b/tests/zt.c
@@ -32,6 +32,7 @@ int
mkdir(const char *path, int mode)
{
CreateDirectory(path, NULL);
+ return (0);
}
#else
#include <sys/stat.h>
@@ -146,8 +147,7 @@ check_props(nng_msg *msg, nng_listener l, nng_dialer d)
So(nng_dialer_getopt_ms(d, NNG_OPT_ZT_PING_TIME, &t) == 0);
So(t > 1000 && t < 3600000); // 1 sec - 1 hour
- int rv = nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20);
-
+ So(nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20) == 0);
So(nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20) == 0);
So(nng_dialer_setopt_ms(d, NNG_OPT_ZT_PING_TIME, 2000) == 0);
So(nng_listener_setopt_int(l, NNG_OPT_ZT_PING_COUNT, 0) == 0);
@@ -203,7 +203,6 @@ TestMain("ZeroTier Transport", {
nng_listener l;
nng_socket s;
char addr[NNG_MAXADDRLEN];
- int rv;
So(nng_zt_register() == 0);
@@ -246,7 +245,6 @@ TestMain("ZeroTier Transport", {
nng_dialer d;
nng_socket s;
char addr[NNG_MAXADDRLEN];
- int rv;
// uint64_t node = 0xb000072fa6ull; // my personal host
uint64_t node = 0x2d2f619cccull; // my personal host
@@ -266,7 +264,6 @@ TestMain("ZeroTier Transport", {
nng_listener l;
nng_socket s;
char addr[NNG_MAXADDRLEN];
- int rv;
uint64_t node1 = 0;
uint64_t node2 = 0;
@@ -315,7 +312,6 @@ TestMain("ZeroTier Transport", {
nng_socket s2;
char addr1[NNG_MAXADDRLEN];
char addr2[NNG_MAXADDRLEN];
- int rv;
uint64_t node;
port = 9944;