summaryrefslogtreecommitdiff
path: root/test/run_tests.sh
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-09-20 00:28:44 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-09-20 00:28:44 +0200
commit992d3a207d0a6cf4faeb835ea6a37ff33df9c87d (patch)
tree595c8eeca098a2cacc17bee8abc75a6a47165c1f /test/run_tests.sh
parent7829bfe4e6ae433120b2f4bc95d8ab5018f67e90 (diff)
dumb fuzzer: randpkt vs nDPId-test
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'test/run_tests.sh')
-rwxr-xr-xtest/run_tests.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh
index df6fdd277..d7370b171 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -5,7 +5,7 @@ set -e
LINE_SPACES=${LINE_SPACES:-48}
MYDIR="$(realpath "$(dirname ${0})")"
nDPId_test_EXEC="$(realpath "${2:-"${MYDIR}/../nDPId-test"}")"
-NETCAT_EXEC="nc -q 0 -l 127.0.0.1 9000"
+NETCAT_EXEC="$(which 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"}")"
@@ -22,6 +22,10 @@ EOF
return 0
}
+test -z "$(which flock)" && { printf '%s\n' 'flock not found'; exit 1; }
+test -z "$(which pkill)" && { printf '%s\n' 'pkill not found'; exit 1; }
+test -z "$(which nc)" && { printf '%s\n' 'nc not found'; exit 1; }
+
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
@@ -40,14 +44,14 @@ LOCKFILE="$(realpath "${0}").lock"
touch "${LOCKFILE}"
exec 42< "${LOCKFILE}"
-flock -x -n 42 || {
+$(which flock) -x -n 42 || {
printf '%s\n' "Could not aquire file lock for ${0}. Already running instance?" >&2;
exit 3;
}
function sighandler()
{
printf '%s\n' ' Received shutdown SIGNAL, bye' >&2
- pkill -P $$
+ $(which pkill) -P $$
wait
rm -f "${LOCKFILE}"
exit 4
@@ -60,9 +64,9 @@ if [ ! -x "${nDPId_test_EXEC}" ]; then
exit 5
fi
-nc -h |& head -n1 | grep -qoE '^OpenBSD netcat' || {
- printf '%s\n' "OpenBSD netcat (nc) version required!" >&2;
- printf '%s\n' "Your version: $(nc -h |& head -n1)" >&2;
+$(which nc) -h |& head -n1 | grep -qoE '^OpenBSD netcat' || {
+ printf '%s\n' "$(which nc): OpenBSD netcat (nc) version required!" >&2;
+ printf '%s\n' "$(which nc): Your version: $(nc -h |& head -n1)" >&2;
exit 6;
}