diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-05-05 11:03:33 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-06 15:21:33 -0700 |
| commit | 916ba1ab23aa50b855fd795f095eaedb328e84d9 (patch) | |
| tree | b764e37145e7caf8f2fe7d1a3999ab6798c3a095 /tests | |
| parent | 7ecb0e4a74bbb3d49ebe37a14b2534a242cb930a (diff) | |
| download | nng-916ba1ab23aa50b855fd795f095eaedb328e84d9.tar.gz nng-916ba1ab23aa50b855fd795f095eaedb328e84d9.tar.bz2 nng-916ba1ab23aa50b855fd795f095eaedb328e84d9.zip | |
fixes #396 illumos doesn't build (missing NNG_PLATFORM_POSIX ON)
fixes #397 Need to cast zoneid
fixes #395 sun is predefined on illumos/Solaris
fixes #394 alloca needs to #include <alloca.h>
fixes #399 Cannot use SVR4.2 specific msghdr
fixes #402 getpeerucred needs a NULL initialized ucred
fixes #403 syntax error in posix_tcp - attempt to return void
fixes #407 illumos getegid wrong
fixes #406 nni_idhash_count is dead code
fixes #404 idhash typedef redeclared
fixes #405 warning: newline not last character in file
This is basically a slew of related bug fixes required to make this
work on illumos. Note that the fixes are not "complete", because
more work is required to support port events given that epoll is busted
on illumos.
We also fixed a bunch of things that aren't actually "bugs" per se, but
really just warnings. Silencing them makes things better for everyone.
Apparently not all compilers are equally happy with redundant (but
otherwise identical) typedefs; we use structs in some places instead of
shorter type names to silence these complaints.
Note that IPC permissions (the mode bits on the socket vnode) are not
validated on SunOS systems. This change includes documentation to reflect
that.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/base64.c | 4 | ||||
| -rw-r--r-- | tests/files.c | 2 | ||||
| -rw-r--r-- | tests/httpclient.c | 3 | ||||
| -rw-r--r-- | tests/idhash.c | 9 | ||||
| -rw-r--r-- | tests/ipc.c | 6 | ||||
| -rw-r--r-- | tests/ipcperms.c | 11 | ||||
| -rw-r--r-- | tests/ipcwinsec.c | 2 | ||||
| -rw-r--r-- | tests/message.c | 2 | ||||
| -rw-r--r-- | tests/multistress.c | 2 | ||||
| -rw-r--r-- | tests/options.c | 3 | ||||
| -rw-r--r-- | tests/pipe.c | 2 | ||||
| -rw-r--r-- | tests/pipeline.c | 2 | ||||
| -rw-r--r-- | tests/reconnect.c | 2 | ||||
| -rw-r--r-- | tests/reqctx.c | 9 | ||||
| -rw-r--r-- | tests/reqpoll.c | 2 | ||||
| -rw-r--r-- | tests/reqstress.c | 2 | ||||
| -rw-r--r-- | tests/respondpoll.c | 2 | ||||
| -rw-r--r-- | tests/scalability.c | 6 | ||||
| -rw-r--r-- | tests/sha1.c | 2 | ||||
| -rw-r--r-- | tests/survey.c | 2 | ||||
| -rw-r--r-- | tests/surveyctx.c | 10 | ||||
| -rw-r--r-- | tests/surveypoll.c | 2 | ||||
| -rw-r--r-- | tests/udp.c | 3 |
23 files changed, 44 insertions, 46 deletions
diff --git a/tests/base64.c b/tests/base64.c index eac84df2..6641928a 100644 --- a/tests/base64.c +++ b/tests/base64.c @@ -82,7 +82,5 @@ TestMain("Base64 Verification", { enc, strlen(enc), buf, strlen(dec) - 1) == -1); So(nni_base64_encode(enc, strlen(enc), buf, 0) == -1); } - }) - -}); +}) diff --git a/tests/files.c b/tests/files.c index 9983d7d3..3690ef63 100644 --- a/tests/files.c +++ b/tests/files.c @@ -256,4 +256,4 @@ TestMain("Platform File Support", { }); test_permissions(); -}); +}) diff --git a/tests/httpclient.c b/tests/httpclient.c index 5180d13f..e167587e 100644 --- a/tests/httpclient.c +++ b/tests/httpclient.c @@ -71,7 +71,6 @@ TestMain("HTTP Client", { nng_http_conn_read_res(http, res, aio); nng_aio_wait(aio); So(nng_aio_result(aio) == 0); - printf("RESULT IS %d\n", nng_http_res_get_status(res)); So(nng_http_res_get_status(res) == 200); Convey("The message contents are correct", { @@ -107,4 +106,4 @@ TestMain("HTTP Client", { }); }); }); -}); +}) diff --git a/tests/idhash.c b/tests/idhash.c index 32751334..eb62fd76 100644 --- a/tests/idhash.c +++ b/tests/idhash.c @@ -24,7 +24,6 @@ Main({ So(nni_idhash_init(&h) == 0); So(h != NULL); - So(nni_idhash_count(h) == 0); Reset({ nni_idhash_fini(h); }); @@ -32,7 +31,6 @@ Main({ char *five = "five"; char *four = "four"; rv = nni_idhash_insert(h, 5, five); - So(nni_idhash_count(h) == 1); So(rv == 0); Convey("And we can find it", { @@ -51,7 +49,6 @@ Main({ Convey("We can change the value", { void *ptr; So(nni_idhash_insert(h, 5, four) == 0); - So(nni_idhash_count(h) == 1); So(nni_idhash_find(h, 5, &ptr) == 0); So(ptr == four); }); @@ -59,7 +56,6 @@ Main({ void *ptr; So(nni_idhash_insert(h, 13, four) == 0); - So(nni_idhash_count(h) == 2); So(nni_idhash_find(h, 5, &ptr) == 0); So(ptr == five); So(nni_idhash_find(h, 13, &ptr) == 0); @@ -120,7 +116,6 @@ Main({ nni_idhash *h; So(nni_idhash_init(&h) == 0); - So(nni_idhash_count(h) == 0); Reset({ nni_idhash_fini(h); }); @@ -128,13 +123,11 @@ Main({ for (i = 0; i < 1024; i++) { nni_idhash_insert(h, i, &expect[i]); } - So(nni_idhash_count(h) == 1024); Convey("We can remove them", { for (i = 0; i < 1024; i++) { nni_idhash_remove(h, i); } - So(nni_idhash_count(h) == 0); }); }); }); @@ -175,4 +168,4 @@ Main({ }); }); }); -}); +}) diff --git a/tests/ipc.c b/tests/ipc.c index 4c8f5e41..5956b5d3 100644 --- a/tests/ipc.c +++ b/tests/ipc.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 Capitar IT Group BV <info@capitar.com> +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -69,7 +69,7 @@ check_props(nng_msg *msg) #ifdef NNG_HAVE_GETPEERUCRED So(nng_pipe_getopt_uint64(p, NNG_OPT_IPC_PEER_ZONEID, &id) == 0); - So(id == getzoneid()); + So(id == (uint64_t) getzoneid()); #else So(nng_pipe_getopt_uint64(p, NNG_OPT_IPC_PEER_ZONEID, &id) == NNG_ENOTSUP); diff --git a/tests/ipcperms.c b/tests/ipcperms.c index 84801efd..6d083d00 100644 --- a/tests/ipcperms.c +++ b/tests/ipcperms.c @@ -30,6 +30,12 @@ #define ADDR "/tmp/ipc_perms_test" +#if defined(__sun) +#define honor_chmod() false +#else +#define honor_chmod() true +#endif + // Inproc tests. #ifdef _WIN32 @@ -78,6 +84,9 @@ TestMain("IPC Permissions", { if (geteuid() == 0) { Skip("Running as root"); } + if (!honor_chmod()) { + Skip("System does not honor chmod"); + } strcpy(sa.sun_path, ADDR); sa.sun_family = AF_UNIX; So((cfd = socket(AF_UNIX, SOCK_STREAM, 0)) >= @@ -111,4 +120,4 @@ TestMain("IPC Permissions", { NNG_ENOTSUP); }); }) -#endif
\ No newline at end of file +#endif diff --git a/tests/ipcwinsec.c b/tests/ipcwinsec.c index 80ec163c..e6d2a205 100644 --- a/tests/ipcwinsec.c +++ b/tests/ipcwinsec.c @@ -197,4 +197,4 @@ TestMain("IPC Security Descriptor", { sdesc) == NNG_ENOTSUP); }); }) -#endif
\ No newline at end of file +#endif diff --git a/tests/message.c b/tests/message.c index 7f40cd38..d680c100 100644 --- a/tests/message.c +++ b/tests/message.c @@ -253,4 +253,4 @@ TestMain("Message Tests", { }); }); -}); +}) diff --git a/tests/multistress.c b/tests/multistress.c index 1ae6f323..d88d0af5 100644 --- a/tests/multistress.c +++ b/tests/multistress.c @@ -650,4 +650,4 @@ Main({ } }); }); -}); +}) diff --git a/tests/options.c b/tests/options.c index 166af37c..db04eea6 100644 --- a/tests/options.c +++ b/tests/options.c @@ -248,5 +248,4 @@ TestMain("Option Parsing", { So(nng_opts_parse(ac, av, case1, &v, &a, &opti) == -1); So(opti == 6); }); - -}); +}) diff --git a/tests/pipe.c b/tests/pipe.c index b81f72b8..3457db9b 100644 --- a/tests/pipe.c +++ b/tests/pipe.c @@ -146,4 +146,4 @@ TestMain("Pipe notify works", { }); }); }); -}); +}) diff --git a/tests/pipeline.c b/tests/pipeline.c index 2b61d99a..f7d89367 100644 --- a/tests/pipeline.c +++ b/tests/pipeline.c @@ -166,4 +166,4 @@ TestMain("PIPELINE (PUSH/PULL) pattern", { So(nng_recvmsg(pull1, &abc, 0) == NNG_ETIMEDOUT); So(nng_recvmsg(pull2, &abc, 0) == NNG_ETIMEDOUT); }); -}); +}) diff --git a/tests/reconnect.c b/tests/reconnect.c index 6b4e8586..d13e6ad9 100644 --- a/tests/reconnect.c +++ b/tests/reconnect.c @@ -101,4 +101,4 @@ TestMain("Reconnect works", { }); }); }); -}); +}) diff --git a/tests/reqctx.c b/tests/reqctx.c index 4aae2e24..de9f1ef2 100644 --- a/tests/reqctx.c +++ b/tests/reqctx.c @@ -26,9 +26,10 @@ static struct { } rep_state; void -rep_cb(void) +rep_cb(void *notused) { int rv; + (void) notused; if (rep_state.state == START) { rep_state.state = RECV; @@ -94,7 +95,7 @@ TestMain("REQ concurrent contexts", { Convey("We can use REQ contexts concurrently", { nng_socket req; - So(nng_aio_alloc(&rep_state.aio, (void *) rep_cb, NULL) == 0); + So(nng_aio_alloc(&rep_state.aio, rep_cb, NULL) == 0); So(nng_rep_open(&rep_state.s) == 0); So(nng_req_open(&req) == 0); @@ -137,7 +138,7 @@ TestMain("REQ concurrent contexts", { nng_msleep(100); // let things establish. // Start the rep state machine going. - rep_cb(); + rep_cb(NULL); for (i = 0; i < NCTX; i++) { if ((rv = nng_ctx_open(&ctxs[i], req)) != 0) { @@ -255,4 +256,4 @@ TestMain("REQ concurrent contexts", { nng_close(req); }); }); -}); +}) diff --git a/tests/reqpoll.c b/tests/reqpoll.c index aeee7d0b..e1a996dd 100644 --- a/tests/reqpoll.c +++ b/tests/reqpoll.c @@ -145,4 +145,4 @@ TestMain("REQ pollable", { }); }); }); -}); +}) diff --git a/tests/reqstress.c b/tests/reqstress.c index 3f1e7396..81249946 100644 --- a/tests/reqstress.c +++ b/tests/reqstress.c @@ -274,4 +274,4 @@ Main({ } }); }); -}); +}) diff --git a/tests/respondpoll.c b/tests/respondpoll.c index 2e24b5b2..5dd34c7f 100644 --- a/tests/respondpoll.c +++ b/tests/respondpoll.c @@ -106,4 +106,4 @@ TestMain("Respondent pollable", { }); }); }); -}); +}) diff --git a/tests/scalability.c b/tests/scalability.c index 84395f9d..38137e90 100644 --- a/tests/scalability.c +++ b/tests/scalability.c @@ -13,8 +13,8 @@ #include "protocol/reqrep0/rep.h" #include "protocol/reqrep0/req.h" -#include "supplemental/util/platform.h" #include "stubs.h" +#include "supplemental/util/platform.h" #include <string.h> @@ -22,7 +22,7 @@ static int nclients = 200; static char *addr = "inproc:///atscale"; nng_socket rep; -nng_thread *server; +nng_thread * server; void serve(void *arg) @@ -124,4 +124,4 @@ Main({ free(clients); free(results); -}); +}) diff --git a/tests/sha1.c b/tests/sha1.c index 9f1901e0..1aa137d7 100644 --- a/tests/sha1.c +++ b/tests/sha1.c @@ -60,4 +60,4 @@ TestMain("SHA1 Verification", { So(strcmp(strout, resultarray[i]) == 0); } }); -}); +}) diff --git a/tests/survey.c b/tests/survey.c index ed73b3dd..d6d35c1b 100644 --- a/tests/survey.c +++ b/tests/survey.c @@ -332,4 +332,4 @@ TestMain("SURVEY pattern", { So(nng_recvmsg(surv, &msg, 0) == NNG_ETIMEDOUT); }); -}); +}) diff --git a/tests/surveyctx.c b/tests/surveyctx.c index aa36eca1..b3843e9d 100644 --- a/tests/surveyctx.c +++ b/tests/surveyctx.c @@ -26,9 +26,10 @@ static struct { } resp_state; void -resp_cb(void) +resp_cb(void *notused) { int rv; + (void) notused; if (resp_state.state == START) { resp_state.state = RECV; @@ -94,8 +95,7 @@ TestMain("Surveyor concurrent contexts", { Convey("We can use Surveyor contexts concurrently", { nng_socket surv = NNG_SOCKET_INITIALIZER; - So(nng_aio_alloc(&resp_state.aio, (void *) resp_cb, NULL) == - 0); + So(nng_aio_alloc(&resp_state.aio, resp_cb, NULL) == 0); So(nng_respondent0_open(&resp_state.s) == 0); So(nng_surveyor0_open(&surv) == 0); @@ -139,7 +139,7 @@ TestMain("Surveyor concurrent contexts", { nng_msleep(100); // let things establish. // Start the rep state machine going. - resp_cb(); + resp_cb(NULL); for (i = 0; i < NCTX; i++) { if ((rv = nng_ctx_open(&ctxs[i], surv)) != 0) { @@ -303,4 +303,4 @@ TestMain("Surveyor concurrent contexts", { So(nng_ctx_open(&ctx, surv) == NNG_ENOTSUP); nng_close(surv); }); -}); +}) diff --git a/tests/surveypoll.c b/tests/surveypoll.c index f97e1c22..a2264d3e 100644 --- a/tests/surveypoll.c +++ b/tests/surveypoll.c @@ -123,4 +123,4 @@ TestMain("Survey pollable", { }); }); }); -}); +}) diff --git a/tests/udp.c b/tests/udp.c index b0def72a..15520791 100644 --- a/tests/udp.c +++ b/tests/udp.c @@ -292,5 +292,4 @@ TestMain("UDP support", { So(nni_plat_udp_open(&u2, &sa) == NNG_EADDRINUSE); nni_plat_udp_close(u1); }); - -}); +}) |
