diff options
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | tools/nngcat/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_ambiguous_test.sh | 2 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_async_test.sh | 5 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_dup_proto_test.sh | 2 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_help_test.sh | 2 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_incompat_test.sh | 3 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_need_proto_test.sh | 2 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_pubsub_test.sh | 6 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_recvmaxsz_test.sh | 6 | ||||
| -rw-r--r-- | tools/nngcat/nngcat_unlimited_test.sh | 6 |
11 files changed, 28 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 03116540..abb1e214 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ include (CheckCCompilerFlag) include (CMakeDependentOption) include (GNUInstallDirs) include (TestBigEndian) +include (FindUnixCommands) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/tools/nngcat/CMakeLists.txt b/tools/nngcat/CMakeLists.txt index bcd356ee..e6d4278c 100644 --- a/tools/nngcat/CMakeLists.txt +++ b/tools/nngcat/CMakeLists.txt @@ -14,10 +14,9 @@ if (NNG_ENABLE_NNGCAT) target_link_libraries (nngcat ${PROJECT_NAME}) install (TARGETS nngcat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - if (NNG_TESTS AND NNG_PLATFORM_POSIX) + if (NNG_TESTS AND NNG_PLATFORM_POSIX AND BASH) macro(add_nngcat_test NAME TIMEOUT) - file (COPY ${NAME}_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - add_test (NAME ${NAME} COMMAND bash ${NAME}_test.sh) + add_test (NAME ${NAME} COMMAND ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}_test.sh $<TARGET_FILE:nngcat>) set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT}) endmacro() add_nngcat_test (nngcat_async 10) diff --git a/tools/nngcat/nngcat_ambiguous_test.sh b/tools/nngcat/nngcat_ambiguous_test.sh index 54aec7f5..414b6d19 100644 --- a/tools/nngcat/nngcat_ambiguous_test.sh +++ b/tools/nngcat/nngcat_ambiguous_test.sh @@ -10,8 +10,10 @@ # found online at https://opensource.org/licenses/MIT. # +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} CMD="${NNGCAT} --re --dial=tcp://127.0.0.1:27272" + echo -n "Verify ambiguous options fail: " if ${CMD} >/dev/null 2>&1 then diff --git a/tools/nngcat/nngcat_async_test.sh b/tools/nngcat/nngcat_async_test.sh index 527c92d1..2b03e522 100644 --- a/tools/nngcat/nngcat_async_test.sh +++ b/tools/nngcat/nngcat_async_test.sh @@ -10,11 +10,12 @@ # found online at https://opensource.org/licenses/MIT. # -echo -n "Verify async connect: " - +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} ADDR="ipc:///tmp/nngcat_async_test" +echo -n "Verify async connect: " + ${NNGCAT} --async -d 1 --connect ${ADDR} --req0 -D "ping" & diff --git a/tools/nngcat/nngcat_dup_proto_test.sh b/tools/nngcat/nngcat_dup_proto_test.sh index 8ba9c3d6..1513d01c 100644 --- a/tools/nngcat/nngcat_dup_proto_test.sh +++ b/tools/nngcat/nngcat_dup_proto_test.sh @@ -10,7 +10,9 @@ # found online at https://opensource.org/licenses/MIT. # +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} + echo -n "Verify only a single protocol is allowed: " if ${NNGCAT} --pub0 --sub0 --dial=tcp://127.0.0.1:8989 >/dev/null 2>&1 then diff --git a/tools/nngcat/nngcat_help_test.sh b/tools/nngcat/nngcat_help_test.sh index 2629633e..95ed9e3e 100644 --- a/tools/nngcat/nngcat_help_test.sh +++ b/tools/nngcat/nngcat_help_test.sh @@ -10,7 +10,9 @@ # found online at https://opensource.org/licenses/MIT. # +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} + echo -n "Verify nngcat help: " if ${NNGCAT} --help >/dev/null 2>&1 then diff --git a/tools/nngcat/nngcat_incompat_test.sh b/tools/nngcat/nngcat_incompat_test.sh index fcadef80..128b57ba 100644 --- a/tools/nngcat/nngcat_incompat_test.sh +++ b/tools/nngcat/nngcat_incompat_test.sh @@ -10,7 +10,9 @@ # found online at https://opensource.org/licenses/MIT. # +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} + echo "Verify incompatible options: " # Just bind something to this so other ones connect @@ -69,4 +71,3 @@ echo "pass" echo "PASS." exit 0 - diff --git a/tools/nngcat/nngcat_need_proto_test.sh b/tools/nngcat/nngcat_need_proto_test.sh index 791b8c4b..d6733cad 100644 --- a/tools/nngcat/nngcat_need_proto_test.sh +++ b/tools/nngcat/nngcat_need_proto_test.sh @@ -10,7 +10,9 @@ # found online at https://opensource.org/licenses/MIT. # +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} + echo -n "Verify a protocol is needed: " if ${NNGCAT} --dial=tcp://127.0.0.1:8989 >/dev/null 2>&1 then diff --git a/tools/nngcat/nngcat_pubsub_test.sh b/tools/nngcat/nngcat_pubsub_test.sh index a28cf865..b9ba90ed 100644 --- a/tools/nngcat/nngcat_pubsub_test.sh +++ b/tools/nngcat/nngcat_pubsub_test.sh @@ -10,11 +10,13 @@ # found online at https://opensource.org/licenses/MIT. # -echo -n "Verify pub sub: " - +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} ADDR="ipc:///tmp/nngcat_pub_sub_test" OUTPUT=/tmp/nngcat_pubsub_test.$$.out + +echo -n "Verify pub sub: " + trap "rm $OUTPUT" 0 ${NNGCAT} --listen ${ADDR} --count=3 --recv-timeout=20 --sub0 --subscribe=one --subscribe=two --quoted > $OUTPUT 2>/dev/null & diff --git a/tools/nngcat/nngcat_recvmaxsz_test.sh b/tools/nngcat/nngcat_recvmaxsz_test.sh index d77a5658..b5d4ff4a 100644 --- a/tools/nngcat/nngcat_recvmaxsz_test.sh +++ b/tools/nngcat/nngcat_recvmaxsz_test.sh @@ -10,11 +10,13 @@ # found online at https://opensource.org/licenses/MIT. # -echo -n "Verify maximum receive size: " - +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} ADDR="ipc:///tmp/nngcat_recvmaxsz_test" OUTPUT=/tmp/nngcat_recvmaxsz_test.$$.out + +echo -n "Verify maximum receive size: " + trap "rm $OUTPUT" 0 ${NNGCAT} --listen ${ADDR} --count=3 --recv-maxsz=5 --pull0 --quoted > $OUTPUT 2>/dev/null & diff --git a/tools/nngcat/nngcat_unlimited_test.sh b/tools/nngcat/nngcat_unlimited_test.sh index 5cc46f08..0486b9b1 100644 --- a/tools/nngcat/nngcat_unlimited_test.sh +++ b/tools/nngcat/nngcat_unlimited_test.sh @@ -10,12 +10,14 @@ # found online at https://opensource.org/licenses/MIT. # -echo -n "Verify unlimited receive size: " - +NNGCAT=${NNGCAT:=$1} NNGCAT=${NNGCAT:-./nngcat} ADDR="ipc:///tmp/nngcat_unlimited_test" INPUT=/tmp/nngcat_unlimited_test.$$.in OUTPUT=/tmp/nngcat_unlimited_test.$$.out + +echo -n "Verify unlimited receive size: " + trap "rm $OUTPUT $INPUT" 0 # 4 MB |
