summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-06-01 10:08:57 -0700
committerGarrett D'Amore <garrett@damore.org>2018-06-01 12:43:56 -0700
commitc2a001e57b33682314964d32e2ed2ca67226d080 (patch)
tree203944e916e678d672164620669b4fe9750775d8 /tools
parent566cf0dbbe51ce9b76a6c2bb2d6f81eebc274d21 (diff)
downloadnng-c2a001e57b33682314964d32e2ed2ca67226d080.tar.gz
nng-c2a001e57b33682314964d32e2ed2ca67226d080.tar.bz2
nng-c2a001e57b33682314964d32e2ed2ca67226d080.zip
fixes #496 nngcat tests fail in Xcode build
This avoids copying the tests, but runs them with bash from the source directory, and passes the path to the built nngcat binary to the script. It also permits these to run if we find bash, so that systems without bash won't run it and fail. We still only do this on POSIX though, because Windows bash is too broken to use for some of the tests.
Diffstat (limited to 'tools')
-rw-r--r--tools/nngcat/CMakeLists.txt5
-rw-r--r--tools/nngcat/nngcat_ambiguous_test.sh2
-rw-r--r--tools/nngcat/nngcat_async_test.sh5
-rw-r--r--tools/nngcat/nngcat_dup_proto_test.sh2
-rw-r--r--tools/nngcat/nngcat_help_test.sh2
-rw-r--r--tools/nngcat/nngcat_incompat_test.sh3
-rw-r--r--tools/nngcat/nngcat_need_proto_test.sh2
-rw-r--r--tools/nngcat/nngcat_pubsub_test.sh6
-rw-r--r--tools/nngcat/nngcat_recvmaxsz_test.sh6
-rw-r--r--tools/nngcat/nngcat_unlimited_test.sh6
10 files changed, 27 insertions, 12 deletions
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