diff options
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/protocol/bus0/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/protocol/pair0/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/protocol/pipeline0/CMakeLists.txt | 24 | ||||
| -rw-r--r-- | src/protocol/pubsub0/CMakeLists.txt | 25 | ||||
| -rw-r--r-- | src/protocol/reqrep0/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/protocol/survey0/CMakeLists.txt | 28 | ||||
| -rw-r--r-- | src/supplemental/tcp/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/supplemental/util/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | src/supplemental/websocket/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/transport/inproc/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/transport/ipc/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/transport/tcp/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/transport/tls/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 92 | ||||
| -rw-r--r-- | tests/multistress.c | 8 | ||||
| -rw-r--r-- | tests/reqstress.c | 6 | ||||
| -rw-r--r-- | tests/stubs.h | 42 | ||||
| -rw-r--r-- | tests/trantest.h | 36 |
20 files changed, 92 insertions, 265 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index abe6586b..5fb2b53f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -421,7 +421,7 @@ endif () function(nng_sources) foreach (f ${ARGN}) - target_sources(${PROJECT_NAME}_testlib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${f}) + target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${f}) endforeach () nng_sources_testlib(${ARGN}) endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8d171c9..f5e2eca0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,9 +36,6 @@ if (NNG_TESTS) ${PROJECT_SOURCE_DIR}/include/nng/nng.h) endif() - -#nng.c -#${PROJECT_SOURCE_DIR}/include/nng/nng.h set (NNG_SRCS core/defs.h @@ -221,7 +218,7 @@ if (NNG_TESTS) target_sources(${PROJECT_NAME}_testlib PRIVATE ${NNG_SRCS}) target_link_libraries (${PROJECT_NAME}_testlib PUBLIC ${NNG_LIBS}) target_compile_definitions(${PROJECT_NAME}_testlib PUBLIC NNG_STATIC_LIB NNG_TEST_LIB) - target_include_directories (${PROJECT_NAME}_testlib PRIVATE ${PROJECT_SOURCE_DIR}/include) + target_include_directories (${PROJECT_NAME}_testlib PUBLIC ${PROJECT_SOURCE_DIR}/include) endif() # When building shared libraries we prefer to suppress default symbol diff --git a/src/protocol/bus0/CMakeLists.txt b/src/protocol/bus0/CMakeLists.txt index 1f144438..1115e2ec 100644 --- a/src/protocol/bus0/CMakeLists.txt +++ b/src/protocol/bus0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -12,10 +12,6 @@ option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON) mark_as_advanced(NNG_PROTO_BUS0) -if (NNG_PROTO_BUS0) - set(_DEFS -DNNG_HAVE_BUS0) - set(_SRCS protocol/bus0/bus.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/bus0/bus.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_PROTO_BUS0 bus.c) +nng_headers_if(NNG_PROTO_BUS0 nng/protocol/bus0/bus.h) +nng_defines_if(NNG_PROTO_BUS0 NNG_HAVE_BUS0)
\ No newline at end of file diff --git a/src/protocol/pair0/CMakeLists.txt b/src/protocol/pair0/CMakeLists.txt index 72d04888..c3da1b07 100644 --- a/src/protocol/pair0/CMakeLists.txt +++ b/src/protocol/pair0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -12,10 +12,6 @@ option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON) mark_as_advanced(NNG_PROTO_PAIR0) -if (NNG_PROTO_PAIR0) - set(_DEFS -DNNG_HAVE_PAIR0) - set(_SRCS protocol/pair0/pair.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pair0/pair.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_PROTO_PAIR0 pair.c) +nng_headers_if(NNG_PROTO_PAIR0 nng/protocol/pair0/pair.h) +nng_defines_if(NNG_PROTO_PAIR0 NNG_HAVE_PAIR0)
\ No newline at end of file diff --git a/src/protocol/pipeline0/CMakeLists.txt b/src/protocol/pipeline0/CMakeLists.txt index f4de4475..0e211cf5 100644 --- a/src/protocol/pipeline0/CMakeLists.txt +++ b/src/protocol/pipeline0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -15,20 +15,10 @@ mark_as_advanced(NNG_PROTO_PUSH0) option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON) mark_as_advanced(NNG_PROTO_PULL0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_PUSH0 push.c) +nng_headers_if(NNG_PROTO_PUSH0 nng/protocol/pipeline0/push.h) +nng_defines_if(NNG_PROTO_PUSH0 NNG_HAVE_PUSH0) -if (NNG_PROTO_PUSH0) - list(APPEND _SRCS protocol/pipeline0/push.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pipeline0/push.h) - - list(APPEND _DEFS -DNNG_HAVE_PUSH0) -endif() - -if (NNG_PROTO_PULL0) - list(APPEND _SRCS protocol/pipeline0/pull.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pipeline0/pull.h) - - list(APPEND _DEFS -DNNG_HAVE_PULL0) -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_PULL0 pull.c) +nng_headers_if(NNG_PROTO_PULL0 nng/protocol/pipeline0/pull.h) +nng_defines_if(NNG_PROTO_PULL0 NNG_HAVE_PULL0)
\ No newline at end of file diff --git a/src/protocol/pubsub0/CMakeLists.txt b/src/protocol/pubsub0/CMakeLists.txt index 12872063..23874662 100644 --- a/src/protocol/pubsub0/CMakeLists.txt +++ b/src/protocol/pubsub0/CMakeLists.txt @@ -15,23 +15,10 @@ mark_as_advanced(NNG_PROTO_PUB0) option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON) mark_as_advanced(NNG_PROTO_SUB0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_PUB0 pub.c) +nng_headers_if(NNG_PROTO_PUB0 nng/protocol/pubsub0/pub.h) +nng_defines_if(NNG_PROTO_PUB0 NNG_HAVE_PUB0) -if (NNG_PROTO_PUB0) - list(APPEND _DEFS -DNNG_HAVE_PUB0) - list(APPEND _SRCS protocol/pubsub0/pub.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pubsub0/pub.h) - -endif() - -if (NNG_PROTO_SUB0) - list(APPEND _DEFS -DNNG_HAVE_SUB0) - list(APPEND _SRCS - protocol/pubsub0/sub.c - protocol/pubsub0/xsub.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/pubsub0/sub.h) - -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_SUB0 sub.c xsub.c) +nng_headers_if(NNG_PROTO_SUB0 nng/protocol/pubsub0/sub.h) +nng_defines_if(NNG_PROTO_SUB0 NNG_HAVE_SUB0)
\ No newline at end of file diff --git a/src/protocol/reqrep0/CMakeLists.txt b/src/protocol/reqrep0/CMakeLists.txt index 4778f4ea..84c25c0e 100644 --- a/src/protocol/reqrep0/CMakeLists.txt +++ b/src/protocol/reqrep0/CMakeLists.txt @@ -23,4 +23,4 @@ nng_sources_if(NNG_PROTO_REP0 rep.c xrep.c) nng_headers_if(NNG_PROTO_REP0 nng/protocol/reqrep0/rep.h) nng_defines_if(NNG_PROTO_REP0 NNG_HAVE_REP0) -nng_test(reqrep_test) +nng_test(reqrep_test)
\ No newline at end of file diff --git a/src/protocol/survey0/CMakeLists.txt b/src/protocol/survey0/CMakeLists.txt index 260c3e58..271afabf 100644 --- a/src/protocol/survey0/CMakeLists.txt +++ b/src/protocol/survey0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -15,24 +15,10 @@ mark_as_advanced(NNG_PROTO_RESPONDENT0) option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON) mark_as_advanced(NNG_PROTO_SURVEYOR0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_SURVEYOR0 survey.c xsurvey.c) +nng_headers_if(NNG_PROTO_SURVEYOR0 nng/protocol/survey0/survey.h) +nng_defines_if(NNG_PROTO_SURVEYOR0 NNG_HAVE_SURVEYOR0) -if (NNG_PROTO_SURVEYOR0) - list(APPEND _DEFS -DNNG_HAVE_SURVEYOR0) - list(APPEND _SRCS - protocol/survey0/survey.c protocol/survey0/xsurvey.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/survey0/survey.h) - -endif() - -if (NNG_PROTO_RESPONDENT0) - list(APPEND _DEFS -DNNG_HAVE_RESPONDENT0) - list(APPEND _SRCS - protocol/survey0/respond.c protocol/survey0/xrespond.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/survey0/respond.h) - -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_RESPONDENT0 respond.c xrespond.c) +nng_headers_if(NNG_PROTO_RESPONDENT0 nng/protocol/survey0/respond.h) +nng_defines_if(NNG_PROTO_RESPONDENT0 NNG_HAVE_RESPONDENT0)
\ No newline at end of file diff --git a/src/supplemental/tcp/CMakeLists.txt b/src/supplemental/tcp/CMakeLists.txt index 09f917f8..d6b3b531 100644 --- a/src/supplemental/tcp/CMakeLists.txt +++ b/src/supplemental/tcp/CMakeLists.txt @@ -1,5 +1,4 @@ # -# Copyright 2018 Capitar IT Group BV <info@capitar.com> # Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> # # This software is supplied under the terms of the MIT License, a @@ -8,6 +7,4 @@ # found online at https://opensource.org/licenses/MIT. # -set(_SRCS supplemental/tcp/tcp.c) - -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources(tcp.c)
\ No newline at end of file diff --git a/src/supplemental/util/CMakeLists.txt b/src/supplemental/util/CMakeLists.txt index 64374d69..5a144da9 100644 --- a/src/supplemental/util/CMakeLists.txt +++ b/src/supplemental/util/CMakeLists.txt @@ -1,6 +1,5 @@ # -# Copyright 2018 Capitar IT Group BV <info@capitar.com> -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -8,9 +7,5 @@ # found online at https://opensource.org/licenses/MIT. # -set(_SRCS supplemental/util/options.c - ${PROJECT_SOURCE_DIR}/include/nng/supplemental/util/options.h - supplemental/util/platform.c - ${PROJECT_SOURCE_DIR}/include/nng/supplemental/util/platform.h) - -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources(options.c platform.c) +nng_headers(nng/supplemental/util/options.h nng/supplemental/util/platform.h) diff --git a/src/supplemental/websocket/CMakeLists.txt b/src/supplemental/websocket/CMakeLists.txt index 913544dd..74438cd5 100644 --- a/src/supplemental/websocket/CMakeLists.txt +++ b/src/supplemental/websocket/CMakeLists.txt @@ -1,6 +1,6 @@ # +# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> # Copyright 2017 Capitar IT Group BV <info@capitar.com> -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -9,10 +9,7 @@ # if (NNG_SUPP_WEBSOCKET) - set(_SRCS - supplemental/websocket/websocket.c - supplemental/websocket/websocket.h) + nng_sources(websocket.c websocket.h) else() - set(_SRCS supplemental/websocket/stub.c) + nng_sources(stub.c) endif() -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) diff --git a/src/transport/inproc/CMakeLists.txt b/src/transport/inproc/CMakeLists.txt index 3249649e..e440fe31 100644 --- a/src/transport/inproc/CMakeLists.txt +++ b/src/transport/inproc/CMakeLists.txt @@ -14,4 +14,4 @@ mark_as_advanced(NNG_TRANSPORT_INPROC) nng_sources_if(NNG_TRANSPORT_INPROC inproc.c) nng_headers_if(NNG_TRANSPORT_INPROC nng/transport/inproc/inproc.h) -nng_defines_if(NNG_TRANSPORT_INPROC NNG_TRANSPORT_INPROC) +nng_defines_if(NNG_TRANSPORT_INPROC NNG_TRANSPORT_INPROC)
\ No newline at end of file diff --git a/src/transport/ipc/CMakeLists.txt b/src/transport/ipc/CMakeLists.txt index 0fd31984..7405e765 100644 --- a/src/transport/ipc/CMakeLists.txt +++ b/src/transport/ipc/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -12,10 +12,6 @@ option (NNG_TRANSPORT_IPC "Enable IPC transport." ON) mark_as_advanced(NNG_TRANSPORT_IPC) -if (NNG_TRANSPORT_IPC) - set(_DEFS -DNNG_TRANSPORT_IPC) - set(_SRCS transport/ipc/ipc.c ${PROJECT_SOURCE_DIR}/include/nng/transport/ipc/ipc.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_IPC ipc.c) +nng_headers_if(NNG_TRANSPORT_IPC nng/transport/ipc/ipc.h) +nng_defines_if(NNG_TRANSPORT_IPC NNG_TRANSPORT_IPC)
\ No newline at end of file diff --git a/src/transport/tcp/CMakeLists.txt b/src/transport/tcp/CMakeLists.txt index c36584b5..f3daa0a4 100644 --- a/src/transport/tcp/CMakeLists.txt +++ b/src/transport/tcp/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -12,10 +12,6 @@ option (NNG_TRANSPORT_TCP "Enable TCP transport." ON) mark_as_advanced(NNG_TRANSPORT_TCP) -if (NNG_TRANSPORT_TCP) - set(_DEFS -DNNG_TRANSPORT_TCP) - set(_SRCS transport/tcp/tcp.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tcp/tcp.h) - - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_TCP tcp.c) +nng_headers_if(NNG_TRANSPORT_TCP nng/transport/tcp/tcp.h) +nng_defines_if(NNG_TRANSPORT_TCP NNG_TRANSPORT_TCP)
\ No newline at end of file diff --git a/src/transport/tls/CMakeLists.txt b/src/transport/tls/CMakeLists.txt index 8668ee4a..1603908a 100644 --- a/src/transport/tls/CMakeLists.txt +++ b/src/transport/tls/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2019 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 @@ -13,10 +13,6 @@ CMAKE_DEPENDENT_OPTION(NNG_TRANSPORT_TLS "Enable TLS transport" ON "NNG_ENABLE_TLS" OFF) mark_as_advanced(NNG_TRANSPORT_TLS) -if (NNG_TRANSPORT_TLS) - set(_DEFS -DNNG_TRANSPORT_TLS) - set(_SRCS transport/tls/tls.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tls/tls.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_TLS tls.c) +nng_headers_if(NNG_TRANSPORT_TLS nng/transport/tls/tls.h) +nng_defines_if(NNG_TRANSPORT_TLS NNG_TRANSPORT_TLS)
\ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 984859bd..e32107ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,7 +53,7 @@ if (NNG_TESTS) set(NNG_TEST_PORT 13000) macro(add_nng_test NAME TIMEOUT) add_executable(${NAME} ${NAME}.c convey.c) - target_link_libraries(${NAME} ${PROJECT_NAME} ${THRLIB}) + target_link_libraries(${NAME} ${PROJECT_NAME}_testlib ${THRLIB}) add_test(NAME ${NAME} COMMAND ${NAME} -v -p TEST_PORT=${NNG_TEST_PORT}) math(EXPR TIMEOUT ${TIMEOUT}*${TIMEOUT_FACTOR}) set_tests_properties(${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) @@ -63,36 +63,22 @@ if (NNG_TESTS) # Compatibility tests are only added if all of the legacy protocols # are present. It's not worth trying to figure out which of these # should work and which shouldn't. - if (NNG_PROTO_BUS0 AND - NNG_PROTO_PAIR0 AND - NNG_PROTO_REQ0 AND - NNG_PROTO_REP0 AND - NNG_PROTO_PUB0 AND - NNG_PROTO_SUB0 AND - NNG_PROTO_PUSH0 AND - NNG_PROTO_PULL0) - - macro(add_nng_compat_test NAME TIMEOUT) - add_executable(${NAME} ${NAME}.c compat_testutil.c) - target_link_libraries(${NAME} ${PROJECT_NAME}) - target_include_directories(${NAME} PUBLIC - ${PROJECT_SOURCE_DIR}/src/compat) - - add_test(NAME ${NAME} COMMAND ${NAME} ${NNG_TEST_PORT}) - set_tests_properties(${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) - math(EXPR NNG_TEST_PORT "${NNG_TEST_PORT}+20") - endmacro(add_nng_compat_test) - else () - macro(add_nng_compat_test NAME TIMEOUT) - endmacro(add_nng_compat_test) - message(STATUS "Compatibility tests disabled (unconfigured protocols)") - endif () + macro(add_nng_compat_test NAME TIMEOUT) + add_executable(${NAME} ${NAME}.c compat_testutil.c) + target_link_libraries(${NAME} ${PROJECT_NAME}_testlib) + target_include_directories(${NAME} PRIVATE + ${PROJECT_SOURCE_DIR}/src/compat + ${PROJECT_SOURCE_DIR}/include) + add_test(NAME ${NAME} COMMAND ${NAME} ${NNG_TEST_PORT}) + set_tests_properties(${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) + math(EXPR NNG_TEST_PORT "${NNG_TEST_PORT}+20") + endmacro(add_nng_compat_test) macro(add_nng_cpp_test NAME TIMEOUT) if (NOT NNG_ENABLE_COVERAGE) enable_language(CXX) add_executable(${NAME} ${NAME}.cc) - target_link_libraries(${NAME} ${PROJECT_NAME}) + target_link_libraries(${NAME} ${PROJECT_NAME}_testlib) add_test(NAME ${NAME} COMMAND ${NAME} ${TEST_PORT}) set_tests_properties(${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) math(EXPR TEST_PORT "${NNG_TEST_PORT}+20") @@ -145,16 +131,16 @@ nng_test(sock) add_nng_test(device 5) add_nng_test(errors 2) -add_nng_test1(files 5 NNG_STATIC_LIB) +add_nng_test(files 5) add_nng_test1(httpclient 60 NNG_SUPP_HTTP) -add_nng_test2(httpserver 30 NNG_STATIC_LIB NNG_SUPP_HTTP) -add_nng_test1(idhash 30 NNG_STATIC_LIB) -add_nng_test1(inproc 5 NNG_TRANSPORT_INPROC) -add_nng_test1(ipc 5 NNG_TRANSPORT_IPC) -add_nng_test1(ipcperms 5 NNG_TRANSPORT_IPC) -add_nng_test1(ipcsupp 10 NNG_TRANSPORT_IPC) -add_nng_test1(ipcwinsec 5 NNG_TRANSPORT_IPC) -add_nng_test1(list 5 NNG_STATIC_LIB) +add_nng_test1(httpserver 30 NNG_SUPP_HTTP) +add_nng_test(idhash 30) +add_nng_test(inproc 5) +add_nng_test(ipc 5) +add_nng_test(ipcperms 5) +add_nng_test(ipcsupp 10) +add_nng_test(ipcwinsec 5) +add_nng_test(list 5) add_nng_test(message 5) add_nng_test(multistress 60) add_nng_test(nonblock 60) @@ -167,30 +153,30 @@ add_nng_test1(resolv 10 NNG_STATIC_LIB) add_nng_test(scalability 20 ON) add_nng_test(set_recvmaxsize 2) add_nng_test1(stats 5 NNG_ENABLE_STATS) -add_nng_test1(synch 5 NNG_STATIC_LIB) -add_nng_test2(tls 60 NNG_STATIC_LIB NNG_TRANSPORT_TLS) +add_nng_test(synch 5) +add_nng_test1(tls 60 NNG_TRANSPORT_TLS) add_nng_test(tcpsupp 10) -add_nng_test1(tcp 180 NNG_TRANSPORT_TCP) -add_nng_test2(tcp6 60 NNG_STATIC_LIB NNG_TRANSPORT_TCP) -add_nng_test1(transport 5 NNG_STATIC_LIB) -add_nng_test1(udp 5 NNG_STATIC_LIB) +add_nng_test(tcp 180) +add_nng_test(tcp6 60) +add_nng_test(transport 5) +add_nng_test(udp 5) add_nng_test(url 5) add_nng_test1(ws 30 NNG_TRANSPORT_WS) add_nng_test1(wss 30 NNG_TRANSPORT_WSS) -add_nng_test2(wssfile 30 NNG_STATIC_LIB NNG_TRANSPORT_WSS) +add_nng_test1(wssfile 30 NNG_TRANSPORT_WSS) add_nng_test1(wsstream 10 NNG_TRANSPORT_WS) add_nng_test1(zt 60 NNG_TRANSPORT_ZEROTIER) -add_nng_test1(bus 5 NNG_PROTO_BUS0) -add_nng_test2(pipeline 5 NNG_PROTO_PULL0 NNG_PROTO_PUSH0) -add_nng_test2(pubsub 5 NNG_PROTO_PUB0 NNG_PROTO_SUB0) -add_nng_test2(reqctx 5 NNG_PROTO_REQ0 NNG_PROTO_REP0) -add_nng_test2(reqpoll 5 NNG_PROTO_REQ0 NNG_PROTO_REP0) -add_nng_test2(reqstress 60 NNG_PROTO_REQ0 NNG_PROTO_REP0) -add_nng_test2(respondpoll 5 NNG_PROTO_SURVEYOR0 NNG_PROTO_RESPONDENT0) -add_nng_test2(survey 5 NNG_PROTO_SURVEYOR0 NNG_PROTO_RESPONDENT0) -add_nng_test2(surveyctx 5 NNG_PROTO_SURVEYOR0 NNG_PROTO_RESPONDENT0) -add_nng_test2(surveypoll 5 NNG_PROTO_SURVEYOR0 NNG_PROTO_RESPONDENT0) +add_nng_test(bus 5) +add_nng_test(pipeline 5) +add_nng_test(pubsub 5) +add_nng_test(reqctx 5) +add_nng_test(reqpoll 5) +add_nng_test(reqstress 60) +add_nng_test(respondpoll 5) +add_nng_test(survey 5) +add_nng_test(surveyctx 5) +add_nng_test(surveypoll 5) # compatibility tests # We only support these if ALL the legacy protocols are supported. This @@ -217,7 +203,7 @@ add_nng_compat_test(compat_ws 60) # These are special tests for compat mode, not inherited from the # legacy libnanomsg suite. -add_nng_test1(compat_options 5 NNG_PROTO_REP0) +add_nng_test(compat_options 5) # c++ tests add_nng_cpp_test(cplusplus_pair 5) diff --git a/tests/multistress.c b/tests/multistress.c index a3b32c3b..9264e6bc 100644 --- a/tests/multistress.c +++ b/tests/multistress.c @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2019 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 @@ -47,20 +47,14 @@ const char *ipc_template = "ipc:///tmp/nng_multistress_%d"; nng_time end_time; const char *templates[] = { -#ifdef NNG_TRANSPORT_TCP "tcp://127.0.0.1:%d", -#endif // It would be nice to test TCPv6, but CI doesn't support it. // Outside of CI, it does seem to work though. #ifdef NNG_TEST_TCPV6 "tcp://[::1]:%d", #endif -#ifdef NNG_TRANSPORT_INPROC "inproc://nng_multistress_%d", -#endif -#ifdef NNG_TRANSPORT_IPC "ipc:///tmp/nng_multistress_%d", -#endif }; #define NTEMPLATES (sizeof(templates) / sizeof(templates[0])) diff --git a/tests/reqstress.c b/tests/reqstress.c index f6dfb975..481e4e92 100644 --- a/tests/reqstress.c +++ b/tests/reqstress.c @@ -39,20 +39,14 @@ char ipc_template[] = "ipc:///tmp/nng_reqstress_%d"; char ws_template[] = "ws://127.0.0.1:%d/nng_reqstress"; char *templates[] = { -#ifdef NNG_TRANSPORT_TCP tcp4_template, -#endif // It would be nice to test TCPv6, but CI doesn't support it. // Outside of CI, it does seem to work though. #ifdef NNG_TEST_TCPV6 tcp6_template, #endif -#ifdef NNG_TRANSPORT_INPROC inproc_template, -#endif -#ifdef NNG_TRANSPORT_IPC ipc_template, -#endif #ifdef NNG_TRANSPORT_WS ws_template, #endif diff --git a/tests/stubs.h b/tests/stubs.h index f178a9bc..56193cb3 100644 --- a/tests/stubs.h +++ b/tests/stubs.h @@ -81,16 +81,6 @@ fdready(int fd) } } -int -nosocket(nng_socket *s) -{ - (void) s; // not used -#ifdef CONVEY_H - ConveySkip("Protocol unconfigured"); -#endif - return (NNG_ENOTSUP); -} - uint16_t test_htons(uint16_t in) { @@ -100,36 +90,4 @@ test_htons(uint16_t in) return (in); } -#ifndef NNG_HAVE_PUB0 -#define nng_pub0_open nosocket -#endif - -#ifndef NNG_HAVE_SUB0 -#define nng_sub0_open nosocket -#endif - -#ifndef NNG_HAVE_PAIR0 -#define nng_pair0_open nosocket -#endif - -#ifndef NNG_HAVE_PUSH0 -#define nng_push0_open nosocket -#endif - -#ifndef NNG_HAVE_PULL0 -#define nng_pull0_open nosocket -#endif - -#ifndef NNG_HAVE_SURVEYOR0 -#define nng_surveyor0_open nosocket -#endif - -#ifndef NNG_HAVE_RESPONDENT0 -#define nng_respondent0_open nosocket -#endif - -#ifndef NNG_HAVE_BUS0 -#define nng_bus0_open nosocket -#endif - #endif // STUBS_H diff --git a/tests/trantest.h b/tests/trantest.h index 97fd3159..09b40049 100644 --- a/tests/trantest.h +++ b/tests/trantest.h @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2019 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 @@ -58,18 +58,6 @@ extern void trantest_test_all(const char *addr); #ifndef NNG_TRANSPORT_ZEROTIER #define nng_zt_register notransport #endif -#ifndef NNG_TRANSPORT_INPROC -#define nng_inproc_register notransport -#endif -#ifndef NNG_TRANSPORT_IPC -#define nng_ipc_register notransport -#endif -#ifndef NNG_TRANSPORT_TCP -#define nng_tcp_register notransport -#endif -#ifndef NNG_TRANSPORT_TLS -#define nng_tls_register notransport -#endif #ifndef NNG_TRANSPORT_WS #define nng_ws_register notransport #endif @@ -91,18 +79,6 @@ notransport(void) void trantest_checktran(const char *url) { -#ifndef NNG_TRANSPORT_INPROC - CHKTRAN(url, "inproc:"); -#endif -#ifndef NNG_TRANSPORT_IPC - CHKTRAN(url, "ipc:"); -#endif -#ifndef NNG_TRANSPORT_TCP - CHKTRAN(url, "tcp:"); -#endif -#ifndef NNG_TRANSPORT_TLS - CHKTRAN(url, "tls+tcp:"); -#endif #ifndef NNG_TRANSPORT_WS CHKTRAN(url, "ws:"); #endif @@ -148,20 +124,14 @@ trantest_init(trantest *tt, const char *addr) { trantest_next_address(tt->addr, addr); -#if defined(NNG_HAVE_REQ0) && defined(NNG_HAVE_REP0) So(nng_req_open(&tt->reqsock) == 0); So(nng_rep_open(&tt->repsock) == 0); nng_url *url; So(nng_url_parse(&url, tt->addr) == 0); -#if defined(NNG_STATIC_LIB) tt->tran = nni_tran_find(url); So(tt->tran != NULL); -#endif nng_url_free(url); -#else - ConveySkip("Missing REQ or REP protocols"); -#endif } void @@ -222,15 +192,11 @@ trantest_listen(trantest *tt, nng_listener *lp) void trantest_scheme(trantest *tt) { -#if NNG_STATIC_LIB Convey("Scheme is correct", { size_t l = strlen(tt->tran->tran_scheme); So(strncmp(tt->addr, tt->tran->tran_scheme, l) == 0); So(strncmp(tt->addr + l, "://", 3) == 0); }) -#else - (void) tt; -#endif } void |
