diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-12-21 10:20:55 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-12-24 00:34:29 -0800 |
| commit | 3f7561417bec08226bcfeb107d94be0dbf71b09e (patch) | |
| tree | 409901d7929df5eeb7295ab971b34c2e1040f507 /tests/CMakeLists.txt | |
| parent | 9e7a4aff25139703bbc375b6dda263d6d42341a8 (diff) | |
| download | nng-3f7561417bec08226bcfeb107d94be0dbf71b09e.tar.gz nng-3f7561417bec08226bcfeb107d94be0dbf71b09e.tar.bz2 nng-3f7561417bec08226bcfeb107d94be0dbf71b09e.zip | |
fixes #1032 Figure out Darwin bustedness
fixes #1035 Convey is awkward -- consider acutest.h
This represents a rather large effort towards cleaning up our
testing and optional configuration infrastructure.
A separate test library is built by default, which is static, and
includes some useful utilities design to make it easier to write
shorter and more robust (not timing dependent) tests. This also means
that we can cover pretty nearly all the tests (protocols etc.) in
every case, even if the shipped image will be minimized.
Subsystems which are optional can now use a few new macros to configure
what they need see nng_sources_if, nng_headers_if, and nng_defines_if.
This goes a long way to making the distributed CMakefiles a lot simpler.
Additionally, tests for different parts of the tree can now be located
outside of the tests/ tree, so that they can be placed next to the code
that they are testing.
Beyond the enabling work, the work has only begun, but these changes
have resolved the most often failing tests for Darwin in the cloud.
Diffstat (limited to 'tests/CMakeLists.txt')
| -rw-r--r-- | tests/CMakeLists.txt | 143 |
1 files changed, 70 insertions, 73 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 60bfed2e..984859bd 100644 --- a/tests/CMakeLists.txt +++ b/tests/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> # Copyright (c) 2012 Martin Sustrik All rights reserved. # Copyright (c) 2013 GoPivotal, Inc. All rights reserved. @@ -40,107 +40,109 @@ include_directories(AFTER SYSTEM ${PROJECT_SOURCE_DIR}/src) if (NOT WIN32) find_package(Threads) set(THRLIB Threads::Threads) -endif() +endif () if (NNG_TESTS) nng_check_sym(nl_langinfo langinfo.h NNG_HAVE_LANGINFO) if (NOT NNG_SANITIZER STREQUAL "none") set(TIMEOUT_FACTOR 2) - else() - set (TIMEOUT_FACTOR 1) - endif() - 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}) - 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}) - math (EXPR NNG_TEST_PORT "${NNG_TEST_PORT}+20") - endmacro (add_nng_test) + else () + set(TIMEOUT_FACTOR 1) + endif () + 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}) + 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}) + math(EXPR NNG_TEST_PORT "${NNG_TEST_PORT}+20") + endmacro(add_nng_test) # 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}) + 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) + ${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) + 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)") + macro(add_nng_compat_test NAME TIMEOUT) + endmacro(add_nng_compat_test) + message(STATUS "Compatibility tests disabled (unconfigured protocols)") endif () - macro (add_nng_cpp_test NAME TIMEOUT) + 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}) - add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT}) - set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) - math (EXPR TEST_PORT "${NNG_TEST_PORT}+20") - endif() - endmacro (add_nng_cpp_test) - - macro (add_nng_test1 NAME TIMEOUT COND1) + enable_language(CXX) + add_executable(${NAME} ${NAME}.cc) + target_link_libraries(${NAME} ${PROJECT_NAME}) + add_test(NAME ${NAME} COMMAND ${NAME} ${TEST_PORT}) + set_tests_properties(${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) + math(EXPR TEST_PORT "${NNG_TEST_PORT}+20") + endif () + endmacro(add_nng_cpp_test) + + macro(add_nng_test1 NAME TIMEOUT COND1) if (${COND1}) add_nng_test(${NAME} ${TIMEOUT}) - else() - message (STATUS "Test ${NAME} disabled (unconfigured)") - endif() + else () + message(STATUS "Test ${NAME} disabled (unconfigured)") + endif () endmacro() - macro (add_nng_test2 NAME TIMEOUT COND1 COND2) + macro(add_nng_test2 NAME TIMEOUT COND1 COND2) if (${COND1} AND ${COND2}) add_nng_test(${NAME} ${TIMEOUT}) - else() - message (STATUS "Test ${NAME} disabled (unconfigured)") - endif() + else () + message(STATUS "Test ${NAME} disabled (unconfigured)") + endif () endmacro() - macro (add_nng_test3 NAME TIMEOUT COND1 COND2 COND3) + macro(add_nng_test3 NAME TIMEOUT COND1 COND2 COND3) if (${COND1} AND ${COND2} AND ${COND3}) add_nng_test(${NAME} ${TIMEOUT} ON) - else() - message (STATUS "Test ${NAME} disabled (unconfigured)") - endif() + else () + message(STATUS "Test ${NAME} disabled (unconfigured)") + endif () endmacro() else () - macro (add_nng_test NAME TIMEOUT) - endmacro (add_nng_test) - macro (add_nng_compat_test NAME TIMEOUT) - endmacro (add_nng_compat_test) - macro (add_nng_cpp_test NAME TIMEOUT) - endmacro (add_nng_cpp_test) - macro (add_nng_test1 NAME TIMEOUT COND1) + macro(add_nng_test NAME TIMEOUT) + endmacro(add_nng_test) + macro(add_nng_compat_test NAME TIMEOUT) + endmacro(add_nng_compat_test) + macro(add_nng_cpp_test NAME TIMEOUT) + endmacro(add_nng_cpp_test) + macro(add_nng_test1 NAME TIMEOUT COND1) endmacro(add_nng_test1) - macro (add_nng_test2 NAME TIMEOUT COND1 COND2) + macro(add_nng_test2 NAME TIMEOUT COND1 COND2) endmacro(add_nng_test2) - macro (add_nng_test3 NAME TIMEOUT COND1 COND2 COND3) + macro(add_nng_test3 NAME TIMEOUT COND1 COND2 COND3) endmacro(add_nng_test3) endif () -add_nng_test(aio 5) -add_nng_test2(base64 5 NNG_STATIC_LIB NNG_SUPP_BASE64) -add_nng_test1(bufsz 5 NNG_PROTO_PAIR0) +nng_test(aio) +nng_test(bufsz) +nng_test(platform) +nng_test(sock) + add_nng_test(device 5) add_nng_test(errors 2) add_nng_test1(files 5 NNG_STATIC_LIB) @@ -158,15 +160,12 @@ add_nng_test(multistress 60) add_nng_test(nonblock 60) add_nng_test(options 5) add_nng_test(pipe 5) -add_nng_test(platform 5) add_nng_test(pollfd 5) add_nng_test(pubsubpollfd 5) add_nng_test(reconnect 5) add_nng_test1(resolv 10 NNG_STATIC_LIB) add_nng_test(scalability 20 ON) add_nng_test(set_recvmaxsize 2) -add_nng_test2(sha1 5 NNG_STATIC_LIB NNG_SUPP_SHA1) -add_nng_test(sock 5) 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) @@ -184,18 +183,16 @@ 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_test1(pair1 5 NNG_PROTO_PAIR1) 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(reqrep 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) -# compatbility tests +# compatibility tests # We only support these if ALL the legacy protocols are supported. This # is because we don't want to make modifications to partially enable some # of these tests. Folks minimizing the library probably don't care too |
