summaryrefslogtreecommitdiff
path: root/test/run_tests.sh
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-05-12 12:24:54 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-05-12 12:46:49 +0200
commitfa079d2346ec105d73fcb3ccf500c48aa9f219c0 (patch)
treedb13d80bf726815c4548036b11241606a2107025 /test/run_tests.sh
parent50f9c1bba149e6cd5cb512087f60ad6e293ea542 (diff)
Git submodule libnDPI update.
* enable ctest to run integration tests (**only** if BUILD_NDPI=ON) Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'test/run_tests.sh')
-rwxr-xr-xtest/run_tests.sh29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh
index 4bebf7a3c..6268fc39d 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -9,18 +9,24 @@ NETCAT_EXEC="nc -q 0 -l 127.0.0.1 9000"
JSON_VALIDATOR="$(realpath "${3:-"${MYDIR}/../examples/py-schema-validation/py-schema-validation.py"}")"
SEMN_VALIDATOR="$(realpath "${4:-"${MYDIR}/../examples/py-semantic-validation/py-semantic-validation.py"}")"
-if [ $# -eq 0 -a -x "${MYDIR}/../libnDPI/tests/pcap" ]; then
- nDPI_SOURCE_ROOT="${MYDIR}/../libnDPI"
-elif [ $# -ne 1 -a $# -ne 2 -a $# -ne 3 -a $# -ne 4 ]; then
+function usage()
+{
cat <<EOF
usage: ${0} [path-to-nDPI-source-root] \\
- [path-to-nDPId-test-exec] [path-to-nDPId-JSON-validator] [path-to-nDPId-SEMANTIC-validator]
+ [path-to-nDPId-test-exec] [path-to-nDPId-JSON-validator] [path-to-nDPId-SEMANTIC-validator]
- path-to-nDPId-test-exec defaults to ${nDPId_test_EXEC}
- path-to-nDPId-JSON-validator defaults to ${JSON_VALIDATOR}
- path-to-nDPId-SEMANTIC-validator default to ${SEMN_VALIDATOR}
+ path-to-nDPId-test-exec defaults to ${nDPId_test_EXEC}
+ path-to-nDPId-JSON-validator defaults to ${JSON_VALIDATOR}
+ path-to-nDPId-SEMANTIC-validator default to ${SEMN_VALIDATOR}
EOF
-exit 2
+return 0
+}
+
+if [ $# -eq 0 -a -x "${MYDIR}/../libnDPI/tests/pcap" ]; then
+ nDPI_SOURCE_ROOT="${MYDIR}/../libnDPI"
+elif [ $# -ne 1 -a $# -ne 2 -a $# -ne 3 -a $# -ne 4 ]; then
+ usage
+ exit 2
else
nDPI_SOURCE_ROOT="$(realpath "${1}")"
fi
@@ -42,10 +48,9 @@ function sighandler()
trap sighandler SIGINT SIGTERM
if [ ! -x "${nDPId_test_EXEC}" ]; then
-cat >&2 <<EOF
-Required nDPId-test executable does not exist; ${nDPId_test_EXEC}
-EOF
-exit 5
+ usage
+ printf '\n%s\n' "Required nDPId-test executable does not exist; ${nDPId_test_EXEC}"
+ exit 5
fi
nc -h |& head -n1 | grep -qoE '^OpenBSD netcat' || {