blob: 693fa59b7ec7ed37ce93f4e5b79cc1fab677956a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/sh
run_test() {
[ -x "$1"/setup ] && "$1"/setup
if [ -r "$1"/tlsdated-flags ]; then
flags=$(cat "$1"/tlsdated-flags | sed "s/@TESTDIR@/$1/g")
elif [ -r "$1"/test.conf ]; then
flags="-w -p -r -l -s -f $1/test.conf"
else
flags="-w -p -r -l -s -f test.conf"
fi
# flags are deliberately unquoted here so that they'll be interpolated
timeout 5 src/tlsdated $flags -- "$1"/subproc.sh <"$1"/input >"$1"/run-output \
2>"$1"/run-err
[ -x "$1"/teardown ] && "$1"/teardown
}
test_passed() {
diff "$t"/output "$t"/run-output >/dev/null
}
total=0
passed=0
for t in tests/*; do
[ ! -d "$t" ] && continue
name="$(basename "$t")"
echo -n "$name: "
run_test "$t"
if test_passed "$t"; then
echo "ok"
passed=$((passed + 1))
else
echo "failed"
fi
total=$((total + 1))
done
echo "Passed: $passed/$total"
[ $passed != $total ]
exit $?
|