aboutsummaryrefslogtreecommitdiff
path: root/src/testzzuf/zzuf_test_runner.sh
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-10-28 12:06:46 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-06-20 23:22:54 +0300
commitc0f7cbb280cff285b5ca7991fb865b761f230f8a (patch)
tree515f126432615f61a265da85898818925c48bb95 /src/testzzuf/zzuf_test_runner.sh
parent40b675518b14fef4d327323f63c9c70f1b2bc44e (diff)
downloadlibmicrohttpd-c0f7cbb280cff285b5ca7991fb865b761f230f8a.tar.gz
libmicrohttpd-c0f7cbb280cff285b5ca7991fb865b761f230f8a.zip
Added back testing with socat as a fallback option
Diffstat (limited to 'src/testzzuf/zzuf_test_runner.sh')
-rwxr-xr-xsrc/testzzuf/zzuf_test_runner.sh45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/testzzuf/zzuf_test_runner.sh b/src/testzzuf/zzuf_test_runner.sh
index aa1dfdde..40367639 100755
--- a/src/testzzuf/zzuf_test_runner.sh
+++ b/src/testzzuf/zzuf_test_runner.sh
@@ -13,6 +13,40 @@ if command -v "${ZZUF}" > /dev/null 2>&1 ; then : ; else
13 exit 77 13 exit 77
14fi 14fi
15 15
16run_with_socat ()
17{
18 echo "Trying to run the test with socat..."
19 script_dir=""
20 if command -v dirname > /dev/null 2>&1 ; then
21 test_dir=`dirname /`
22 if test "x${test_dir}" = "x/" ; then
23 if dirname "$1" > /dev/null 2>&1 ; then
24 script_dir=`dirname "$1"`
25 if test -n "${script_dir}" ; then
26 # Assume script is not in the root dir
27 script_dir="${script_dir}/"
28 else
29 script_dir="./"
30 fi
31 fi
32 fi
33 fi
34 if test -z "${script_dir}" ; then
35 if echo "$1" | sed 's|[^/]*$||' > /dev/null 2>&1 ; then
36 script_dir=`echo "$1" | sed 's|[^/]*$||'`
37 if test -z "${script_dir}" ; then
38 script_dir="./"
39 fi
40 fi
41 fi
42 if test -z "${script_dir}" ; then
43 echo "Cannot determine script location, will try current directory." 1>&2
44 script_dir="./"
45 fi
46 $SHELL "${script_dir}zzuf_socat_test_runner.sh" "$@"
47 exit $?
48}
49
16# zzuf cannot pass-through the return value of checked program 50# 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 51# so try the direct dry-run first to get possibe 77 or 99 codes
18echo "## Dry-run of the $@..." 52echo "## Dry-run of the $@..."
@@ -20,7 +54,11 @@ if "$@" --dry-run ; then
20 echo "# Dry-run succeded." 54 echo "# Dry-run succeded."
21else 55else
22 res_code=$? 56 res_code=$?
23 echo "Dry-run failed with exit code $res_code. $@ will not be run with zzuf." 1>&2 57 echo "Dry-run failed with exit code $res_code." 1>&2
58 if test $res_code -ne 99; then
59 run_with_socat "$@"
60 fi
61 echo "$@ will not be run with zzuf." 1>&2
24 exit $res_code 62 exit $res_code
25fi 63fi
26 64
@@ -46,8 +84,9 @@ if "$ZZUF" ${zzuf_all_params} "$@" --dry-run ; then
46 echo "# Dry-run with zzuf succeded." 84 echo "# Dry-run with zzuf succeded."
47else 85else
48 res_code=$? 86 res_code=$?
49 echo "$@ cannot be run with zzuf. The test is skipped." 1>&2 87 echo "$@ cannot be run with zzuf directly." 1>&2
50 exit 77 88 run_with_socat "$@"
89 exit $res_code
51fi 90fi
52 91
53echo "## Real test of $@ with zzuf..." 92echo "## Real test of $@ with zzuf..."