aboutsummaryrefslogtreecommitdiff
path: root/src/testzzuf/zzuf_test_runner.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testzzuf/zzuf_test_runner.sh')
-rwxr-xr-xsrc/testzzuf/zzuf_test_runner.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/testzzuf/zzuf_test_runner.sh b/src/testzzuf/zzuf_test_runner.sh
new file mode 100755
index 00000000..aa1dfdde
--- /dev/null
+++ b/src/testzzuf/zzuf_test_runner.sh
@@ -0,0 +1,55 @@
1#!/bin/sh
2
3mhd_listen_ip='127.0.0.1'
4max_runtime_sec='300'
5
6if test "x${ZZUF}" = "xno" ; then
7 echo "zzuf command missing" 1>&2
8 exit 77
9fi
10
11if command -v "${ZZUF}" > /dev/null 2>&1 ; then : ; else
12 echo "zzuf command missing" 1>&2
13 exit 77
14fi
15
16# zzuf cannot pass-through the return value of checked program
17# so try the direct dry-run first to get possibe 77 or 99 codes
18echo "## Dry-run of the $@..."
19if "$@" --dry-run ; then
20 echo "# Dry-run succeded."
21else
22 res_code=$?
23 echo "Dry-run failed with exit code $res_code. $@ will not be run with zzuf." 1>&2
24 exit $res_code
25fi
26
27# fuzz the input only for IP ${mhd_listen_ip}. libcurl uses another IP
28# in this test therefore libcurl input is not fuzzed.
29zzuf_all_params="--ratio=0.001:0.4 --autoinc --verbose --signal \
30 --max-usertime=${max_runtime_sec} --check-exit --network \
31 --allow=${mhd_listen_ip} --exclude=."
32
33if test -n "${ZZUF_SEED}" ; then
34 zzuf_all_params="${zzuf_all_params} --seed=${ZZUF_SEED}"
35fi
36
37if test -n "${ZZUF_FLAGS}" ; then
38 zzuf_all_params="${zzuf_all_params} ${ZZUF_FLAGS}"
39fi
40
41# Uncomment the next line to see more data in logs
42#zzuf_all_params="${zzuf_all_params} -dd"
43
44echo "## Dry-run of the $@ with zzuf..."
45if "$ZZUF" ${zzuf_all_params} "$@" --dry-run ; then
46 echo "# Dry-run with zzuf succeded."
47else
48 res_code=$?
49 echo "$@ cannot be run with zzuf. The test is skipped." 1>&2
50 exit 77
51fi
52
53echo "## Real test of $@ with zzuf..."
54"$ZZUF" ${zzuf_all_params} "$@"
55exit $?