run_regress.sh - webdump_tests - Testfiles for webdump
HTML git clone git://git.codemadness.org/webdump_tests
DIR Log
DIR Files
DIR Refs
DIR README
---
run_regress.sh (1357B)
---
1 #!/bin/sh
2
3 name="webdump"
4 bin1="$HOME/p/webdump/webdump"
5 bin2="/tmp/webdump/webdump"
6
7 statefile="/tmp/$name.fail"
8
9 die() {
10 printf '%s\n' "$1" >&2
11 echo 1>"$statefile"
12 exit 1
13 }
14
15 info() {
16 printf '%s\n' "$1"
17 }
18
19 cleanup() {
20 rm -f "/tmp/$name.log"
21 rm -f /tmp/t1 /tmp/t2
22 rm -f "$statefile"
23 }
24
25 test -e "$bin1" || die "$bin1 does not exist"
26 test -e "$bin2" || die "$bin2 does not exist"
27
28 cleanup
29
30 for opt in \
31 ""\
32 "-r"\
33 "-r -w 50"\
34 "-r -w 50 -I"\
35 "-r -l"\
36 "-s a"\
37 "-u a"\
38 "-I -i -d"\
39 "-d -8 -r -I -i -l -a"\
40 "-d -8 -r -i -l -a"\
41 "-b https://codemadness.org -l"\
42 "-x"; do
43 find . -iname "*.html" | while read -r f; do
44 info "$name $opt: $f"
45
46 "$bin1" < "$f" 3>&1 > /tmp/t1
47 status1="$?"
48 "$bin2" < "$f" 3>&1 > /tmp/t2
49 status2="$?"
50
51 if test "$status1" != "0"; then
52 die "$name $opt: statuscode non-zero for file $f, bin: $bin1"
53 fi
54
55 if test "$status2" != "0"; then
56 die "$name $opt: statuscode non-zero for file $f, bin: $bin2"
57 fi
58
59 if test "$status1" != "$status2"; then
60 die "$name $opt: statuscode differs for file $f, statuscode: $status1 != $status2"
61 fi
62
63 if ! diff -u /tmp/t1 /tmp/t2; then
64 die "$name $opt: diff -u differs for file: $f"
65 fi
66 done || exit $?
67 done | tee "/tmp/$name.log"
68
69 statuscode="0"
70 if test -e "$statefile"; then
71 info "FAIL"
72 statuscode="1"
73 else
74 info "OK"
75 wc -l < "/tmp/$name.log"
76 fi
77
78 cleanup
79
80 exit "$statuscode"