From 440ddf86b3b3b6be47943c5b6408d63b091f2c28 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 25 Dec 2019 09:45:12 -0800 Subject: fixes #1040 Convert rest of the protocols to new CMake infra --- tests/CMakeLists.txt | 92 ++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 53 deletions(-) (limited to 'tests/CMakeLists.txt') 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) -- cgit v1.2.3-70-g09d2