From 6a50035b242b972c1d9b659ba63e037a0a8afe71 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 29 Dec 2017 14:21:20 -0800 Subject: fixes #166 Websocket TLS mapping This introduces the wss:// scheme, which is available and works like the ws:// scheme if TLS is enabled in the library. The library modularization is refactored somewhat, to make it easier to use. There is now a single NNG_ENABLE_TLS that enables TLS support under the hood. This also adds a new option for the TLS transport, NNG_OPT_TLS_CONFIG (and a similar one for WSS, NNG_OPT_TLS_WSS_CONFIG) that offer access to the underlying TLS configuration object, which now has a public API to go with it as well. Note that it is also possible to use pure HTTPS using the *private* API, which will be exposed in a public form soon. --- tests/CMakeLists.txt | 114 +++++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 54 deletions(-) (limited to 'tests/CMakeLists.txt') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7f37c589..5f1a834f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,19 +46,21 @@ if (NNG_TESTS) list (APPEND all_tests convey_test) set (TEST_PORT 12100) - macro (add_nng_test NAME TIMEOUT) - list (APPEND all_tests ${NAME}) - add_executable (${NAME} ${NAME}.c convey.c) - target_link_libraries (${NAME} ${PROJECT_NAME}_static) - target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES}) - target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB) - if (CMAKE_THREAD_LIBS_INIT) - target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}") - endif() + macro (add_nng_test NAME TIMEOUT COND) + if (${COND}) + list (APPEND all_tests ${NAME}) + add_executable (${NAME} ${NAME}.c convey.c) + target_link_libraries (${NAME} ${PROJECT_NAME}_static) + target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES}) + target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB) + if (CMAKE_THREAD_LIBS_INIT) + target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}") + endif() - add_test (NAME ${NAME} COMMAND ${NAME} -v -p TEST_PORT=${TEST_PORT}) - set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) - math (EXPR TEST_PORT "${TEST_PORT}+20") + add_test (NAME ${NAME} COMMAND ${NAME} -v -p TEST_PORT=${TEST_PORT}) + set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) + math (EXPR TEST_PORT "${TEST_PORT}+20") + endif() endmacro (add_nng_test) # Compatibility tests are only added if all of the legacy protocols @@ -111,57 +113,61 @@ if (NNG_TESTS) endif() endmacro (add_nng_cpp_test) + macro (add_nng_proto_test NAME TIMEOUT P1 P2) + if (${P1} AND ${P2}) + add_nng_test(${NAME} ${TIMEOUT} ON) + else() + message (STATUS "Protocol test ${NAME} disabled (unconfigured)") + endif() + endmacro() else () - macro (add_nng_test NAME TIMEOUT) + macro (add_nng_test NAME TIMEOUT COND) 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_proto_test NAME TIMEOUT P1 P2) + endmacro() endif () -add_nng_test(aio 5) -add_nng_test(bus 5) -add_nng_test(files 5) -add_nng_test(idhash 5) -add_nng_test(inproc 5) -add_nng_test(ipc 5) -add_nng_test(list 5) -add_nng_test(platform 5) -add_nng_test(reqrep 5) -add_nng_test(pipeline 5) -add_nng_test(pollfd 5) -add_nng_test(pubsub 5) -add_nng_test(reconnect 5) -add_nng_test(resolv 10) -add_nng_test(sock 5) -add_nng_test(survey 5) -add_nng_test(synch 5) -add_nng_test(transport 5) -add_nng_test(tls 10) -add_nng_test(tcp 5) -add_nng_test(tcp6 5) -add_nng_test(scalability 20) -add_nng_test(message 5) -add_nng_test(device 5) -add_nng_test(errors 2) -add_nng_test(pair1 5) -add_nng_test(udp 5) -add_nng_test(zt 60) -add_nng_test(multistress 60) -add_nng_test(ws 30) - -if (NNG_SUPP_BASE64) - add_nng_test(base64 5) -endif() -if (NNG_SUPP_HTTP) - add_nng_test(httpclient 30) - add_nng_test(httpserver 30) -endif() -if (NNG_SUPP_SHA1) - add_nng_test(sha1 5) -endif() +add_nng_test(aio 5 ON) +add_nng_test(base64 5 NNG_SUPP_BASE64) +add_nng_test(device 5 ON) +add_nng_test(errors 2 ON) +add_nng_test(files 5 ON) +add_nng_test(httpclient 30 NNG_SUPP_HTTP) +add_nng_test(httpserver 30 NNG_SUPP_HTTP) +add_nng_test(idhash 5 ON) +add_nng_test(inproc 5 NNG_TRANSPORT_INPROC) +add_nng_test(ipc 5 NNG_TRANSPORT_IPC) +add_nng_test(list 5 ON) +add_nng_test(message 5 ON) +add_nng_test(multistress 60 ON) +add_nng_test(platform 5 ON) +add_nng_test(pollfd 5 ON) +add_nng_test(reconnect 5 ON) +add_nng_test(resolv 10 ON) +add_nng_test(scalability 20 ON) +add_nng_test(sha1 5 NNG_SUPP_SHA1) +add_nng_test(sock 5 ON) +add_nng_test(synch 5 ON) +add_nng_test(tls 10 NNG_TRANSPORT_TLS) +add_nng_test(tcp 5 NNG_TRANSPORT_TCP) +add_nng_test(tcp6 5 NNG_TRANSPORT_TCP) +add_nng_test(transport 5 ON) +add_nng_test(udp 5 ON) +add_nng_test(ws 30 NNG_TRANSPORT_WS) +add_nng_test(wss 30 NNG_TRANSPORT_WSS) +add_nng_test(zt 60 NNG_TRANSPORT_ZEROTIER) + +add_nng_proto_test(bus 5 NNG_PROTO_BUS0 NNG_PROTO_BUS0) +add_nng_test(pipeline 5 NNG_PROTO_PULL0 NNG_PROTO_PIPELINE0) +add_nng_proto_test(pair1 5 NNG_PROTO_PAIR1 NNG_PROTO_PAIR1) +add_nng_proto_test(pubsub 5 NNG_PROTO_PUB0 NNG_PROTO_SUB0) +add_nng_proto_test(reqrep 5 NNG_PROTO_REQ0 NNG_PROTO_REP0) +add_nng_test(survey 5 NNG_PROTO_SURVEYOR0 NNG_PROTO_RESPONDENT0) # compatbility tests # We only support these if ALL the legacy protocols are supported. This -- cgit v1.2.3-70-g09d2