run_regress: test more options, improvements - webdump_tests - Testfiles for webdump
HTML git clone git://git.codemadness.org/webdump_tests
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 0e47543f04094e6ebbc055018ad8bfc1f50e7c60
DIR parent 655108e8644464151f0222587e68a8dc95b3f140
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 13 Mar 2026 12:50:50 +0100
run_regress: test more options, improvements
- test more options and combinations.
- test output of -x which is redirected to fd 3.
- show amount of tests succeeded.
- check if status != 0 of any command, currently should not happen.
- stop directly if one test failed.
Diffstat:
M run_regress.sh | 74 ++++++++++++++++++++++++++-----
1 file changed, 62 insertions(+), 12 deletions(-)
---
DIR diff --git a/run_regress.sh b/run_regress.sh
@@ -1,30 +1,80 @@
#!/bin/sh
+name="webdump"
bin1="$HOME/p/webdump/webdump"
bin2="/tmp/webdump/webdump"
-for opt in "" "-r -l" "-u a" "-d -8 -r -i -l -a" "-x" "-b https://codemadness.org -l"; do
+statefile="/tmp/$name.fail"
+die() {
+ printf '%s\n' "$1" >&2
+ echo 1>"$statefile"
+ exit 1
+}
+
+info() {
+ printf '%s\n' "$1"
+}
+
+cleanup() {
+ rm -f "/tmp/$name.log"
+ rm -f /tmp/t1 /tmp/t2
+ rm -f "$statefile"
+}
+
+test -e "$bin1" || die "$bin1 does not exist"
+test -e "$bin2" || die "$bin2 does not exist"
+
+cleanup
+
+for opt in \
+ ""\
+ "-r"\
+ "-r -w 50"\
+ "-r -w 50 -I"\
+ "-r -l"\
+ "-s a"\
+ "-u a"\
+ "-I -i -d"\
+ "-d -8 -r -I -i -l -a"\
+ "-d -8 -r -i -l -a"\
+ "-b https://codemadness.org -l"\
+ "-x"; do
find . -iname "*.html" | while read -r f; do
- echo "webdump $opt: $f"
+ info "$name $opt: $f"
- "$bin1" < "$f" > /tmp/t1
+ "$bin1" < "$f" 3>&1 > /tmp/t1
status1="$?"
- "$bin2" < "$f" > /tmp/t2
+ "$bin2" < "$f" 3>&1 > /tmp/t2
status2="$?"
+ if test "$status1" != "0"; then
+ die "$name $opt: statuscode non-zero for file $f, bin: $bin1"
+ fi
+
+ if test "$status2" != "0"; then
+ die "$name $opt: statuscode non-zero for file $f, bin: $bin2"
+ fi
+
if test "$status1" != "$status2"; then
- echo "webdump $opt: statuscode differs for file $f, statuscode: $status1 != $status2"
- exit 1
+ die "$name $opt: statuscode differs for file $f, statuscode: $status1 != $status2"
fi
if ! diff -u /tmp/t1 /tmp/t2; then
- echo "webdump $opt: diff -u differs for file: $f"
- exit 1
+ die "$name $opt: diff -u differs for file: $f"
fi
-done
-done
+done || exit $?
+done | tee "/tmp/$name.log"
+
+statuscode="0"
+if test -e "$statefile"; then
+ info "FAIL"
+ statuscode="1"
+else
+ info "OK"
+ wc -l < "/tmp/$name.log"
+fi
-echo "OK"
+cleanup
-exit 0
+exit "$statuscode"