diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-30 12:20:57 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-30 12:20:57 -0800 |
| commit | 252f15e0d5889a461490ec3c5e11e57dbdf0c50b (patch) | |
| tree | 56a2af58775b30882b7d120385b352c1e5d099b6 | |
| parent | 9c6b2929d8019dcc11935550bc3520ae39c2964e (diff) | |
| download | nng-252f15e0d5889a461490ec3c5e11e57dbdf0c50b.tar.gz nng-252f15e0d5889a461490ec3c5e11e57dbdf0c50b.tar.bz2 nng-252f15e0d5889a461490ec3c5e11e57dbdf0c50b.zip | |
socket activation: test fixes (improve coverage, etc.)
| -rw-r--r-- | src/platform/ipc_stream_test.c | 21 | ||||
| -rw-r--r-- | src/platform/tcp_stream_test.c | 13 |
2 files changed, 32 insertions, 2 deletions
diff --git a/src/platform/ipc_stream_test.c b/src/platform/ipc_stream_test.c index 77c307bc..bad8ffd6 100644 --- a/src/platform/ipc_stream_test.c +++ b/src/platform/ipc_stream_test.c @@ -194,7 +194,7 @@ test_ipc_listen_activation_busy(void) char *addr; NUTS_ADDR(addr, "ipc"); - NUTS_PASS(nng_stream_listener_alloc(&l1, "tcp://")); + NUTS_PASS(nng_stream_listener_alloc(&l1, addr)); NUTS_PASS(nng_stream_listener_listen(l1)); NUTS_PASS(nng_stream_listener_get_int(l1, NNG_OPT_LISTEN_FD, &fd)); NUTS_FAIL( @@ -267,14 +267,31 @@ test_ipc_listen_activation_bogus_fd(void) #endif } +void +test_ipc_listen_activation_bad_arg(void) +{ +#if defined(NNG_PLATFORM_POSIX) + nng_stream_listener *l1; + + NUTS_PASS(nng_stream_listener_alloc(&l1, "ipc:///")); + NUTS_FAIL(nng_stream_listener_set_bool(l1, NNG_OPT_LISTEN_FD, false), + NNG_EBADTYPE); + nng_stream_listener_free(l1); +#else + NUTS_SKIP("Not POSIX"); +#endif +} + NUTS_TESTS = { { "ipc stream", test_ipc_stream }, { "ipc socket activation", test_ipc_listen_activation }, { "ipc socket activation busy", test_ipc_listen_activation_busy }, - { "pc socket activation closed", test_ipc_listen_activation_closed }, + { "ipc socket activation closed", test_ipc_listen_activation_closed }, { "ipc socket activation wrong family", test_ipc_listen_activation_wrong_family }, { "ipc socket activation bogus fd", test_ipc_listen_activation_bogus_fd }, + { "ipc socket activation bad arg", + test_ipc_listen_activation_bad_arg }, { NULL, NULL }, }; diff --git a/src/platform/tcp_stream_test.c b/src/platform/tcp_stream_test.c index a60cf1bd..f8b8d14a 100644 --- a/src/platform/tcp_stream_test.c +++ b/src/platform/tcp_stream_test.c @@ -415,6 +415,17 @@ test_tcp_listen_activation_bogus_fd(void) nng_stream_listener_free(l1); } +void +test_tcp_listen_activation_bad_arg(void) +{ + nng_stream_listener *l1; + + NUTS_PASS(nng_stream_listener_alloc(&l1, "tcp://")); + NUTS_FAIL(nng_stream_listener_set_bool(l1, NNG_OPT_LISTEN_FD, false), + NNG_EBADTYPE); + nng_stream_listener_free(l1); +} + NUTS_TESTS = { { "tcp stream", test_tcp_stream }, { "tcp listen accept cancel", test_tcp_listen_accept_cancel }, @@ -428,5 +439,7 @@ NUTS_TESTS = { test_tcp_listen_activation_wrong_family }, { "tcp socket activation bogus fd", test_tcp_listen_activation_bogus_fd }, + { "tcp socket activation bad arg", + test_tcp_listen_activation_bad_arg }, { NULL, NULL }, }; |
