aboutsummaryrefslogtreecommitdiff
path: root/tools/nngcat/nngcat_unlimited_test.sh
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-05-07 14:58:07 -0700
committerGarrett D'Amore <garrett@damore.org>2018-05-07 17:39:03 -0700
commite89202c83138bbc6bad1d5c5dcf55e00c0ee1800 (patch)
tree58f3e2bc5e824c34a6954dc6276bd77725794b69 /tools/nngcat/nngcat_unlimited_test.sh
parentd066d6d4307371f3bea1134a694dba18c381f564 (diff)
downloadnng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.tar.gz
nng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.tar.bz2
nng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.zip
fixes #413 desire --count option for nngcat
fixes #249 nngcat needs test cases fixes #416 transports do not permit unlimited message size with 0 fixes #417 nngcat truncates input files to 4k fixes #348 nngcat should have switch to adjust maximum receive size
Diffstat (limited to 'tools/nngcat/nngcat_unlimited_test.sh')
-rw-r--r--tools/nngcat/nngcat_unlimited_test.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/nngcat/nngcat_unlimited_test.sh b/tools/nngcat/nngcat_unlimited_test.sh
new file mode 100644
index 00000000..7b5b4f2c
--- /dev/null
+++ b/tools/nngcat/nngcat_unlimited_test.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+#
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2018 Capitar IT Group BV <info@capitar.com>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+echo -n "Verify unlimited receive size: "
+
+NNGCAT=${NNGCAT:-./nngcat}
+ADDR="ipc:///tmp/nngcat_unlimited_test"
+INPUT=/tmp/nngcat_unlimited_test.$$.in
+OUTPUT=/tmp/nngcat_unlimited_test.$$.out
+trap "rm $OUTPUT $INPUT" 0
+
+# 4 MB
+dd if=/dev/urandom of=${INPUT} bs=1024 count=4096 >/dev/null 2>&1
+goodsum=$(cksum ${INPUT})
+goodsum=${goodsum%% *}
+
+${NNGCAT} --listen ${ADDR} --count=1 --recv-maxsz=0 --pull0 --raw > $OUTPUT 2>/dev/null &
+sleep 1
+# for speed of execution, run these in the background, they should be ignored
+${NNGCAT} --connect ${ADDR} --push0 --file ${INPUT}
+wait $bgid 2>/dev/null
+
+sum=$(cksum ${OUTPUT})
+sum=${sum%% *}
+
+if [[ ${sum} == ${goodsum} ]]
+then
+ echo "pass"
+ exit 0
+fi
+echo "FAIL: Checksum failed (Wanted ${goodsum} got ${sum})"
+echo "OUTPUT:"
+ls -la ${OUTPUT}
+
+exit 1