1 |
slords |
1.1 |
#! /bin/bash |
2 |
|
|
|
3 |
|
|
eval $(grep '^\(TESTPROGRAMS\|SUBDIRS\)=' runtests.sh) |
4 |
|
|
|
5 |
|
|
FAILURES_BOGUS=( |
6 |
|
|
":gethostbyname" # network test; net might not be available in test environment |
7 |
|
|
|
8 |
|
|
":stdlib:tst-environ" # test uses environ function in unsupported ways (dup keys) |
9 |
|
|
":stdlib:tst-rand48" # platform dependent; does not give reliable results |
10 |
|
|
":stdlib:tst-strtod" # infinite recursion in __dtostr() |
11 |
|
|
":time:tst-mktime" # dietlibc does not support $TZ env |
12 |
|
|
":time:tst-posixtz" # dietlibc does not support $TZ env |
13 |
|
|
":time:tst-strftime" # dietlibc does not support glibc specific format specifications |
14 |
|
|
) |
15 |
|
|
|
16 |
|
|
FAILURES_KNOWN=( |
17 |
|
|
":sendfile" # stdin/stdout not supported; test must be wrapped |
18 |
|
|
":stdio:tstdiomisc" # scanf(3) fails on some constructs |
19 |
|
|
":stdio:tst-fphex" # printf(3) does not support %a specifiers |
20 |
|
|
":stdio:tst-printf" # printf(3) does not support some floating point ops |
21 |
|
|
":stdio:tst-sscanf" # scanf(3) fails on double input |
22 |
|
|
":stdlib:test-canon" # realpath(3) is broken... |
23 |
|
|
) |
24 |
|
|
|
25 |
|
|
function is_in() { |
26 |
|
|
local val=$1 |
27 |
|
|
local i |
28 |
|
|
shift |
29 |
|
|
|
30 |
|
|
for i; do |
31 |
|
|
test x"$i" != x"$val" || return 0 |
32 |
|
|
done |
33 |
|
|
return 1 |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
rc=0 |
37 |
|
|
|
38 |
|
|
: ${RUNTEST_INDENT=0} |
39 |
|
|
export RUNTEST_INDENT |
40 |
|
|
export RUNTEST_NS |
41 |
|
|
|
42 |
|
|
for p in $TESTPROGRAMS; do |
43 |
|
|
! tty -s || printf '%*s%-20s' $RUNTEST_INDENT '' "$p" |
44 |
|
|
|
45 |
|
|
is_in "$RUNTEST_NS:$p" "${FAILURES_BOGUS[@]}" && fail_bogus=true || fail_bogus=false |
46 |
|
|
is_in "$RUNTEST_NS:$p" "${FAILURES_KNOWN[@]}" && fail_known=true || fail_known=false |
47 |
|
|
./$p >/dev/null && failed=false || failed=true |
48 |
|
|
|
49 |
|
|
case $failed:$fail_known:$fail_bogus in |
50 |
|
|
(false:false:*) res='OK';; |
51 |
|
|
(false:true:true) res='OK (bogus)';; |
52 |
|
|
(false:true:false) res="OK (unexpected)"; let ++rc;; |
53 |
|
|
(true:*:true) res='FAIL (bogus)';; |
54 |
|
|
(true:true:*) res="FAIL (known)";; |
55 |
|
|
(true:false:*) res='FAIL'; let ++rc;; |
56 |
|
|
esac |
57 |
|
|
|
58 |
|
|
! tty -s || printf '\r' |
59 |
|
|
|
60 |
|
|
printf '%*s%-20s%s\n' $RUNTEST_INDENT '' "$p" "$res" |
61 |
|
|
done |
62 |
|
|
|
63 |
|
|
test $rc -eq 0 || \ |
64 |
|
|
printf "%*s--> %u tests failed\n" $RUNTEST_INDENT '' $rc |
65 |
|
|
|
66 |
|
|
for d in $SUBDIRS; do |
67 |
|
|
echo "--- entering directory $d ---" |
68 |
|
|
let RUNTEST_INDENT+=2 |
69 |
|
|
old_ns=$RUNTEST_NS |
70 |
|
|
RUNTEST_NS=$RUNTEST_NS:$d |
71 |
|
|
|
72 |
|
|
cd $d && bash ./runtests-X.sh || let ++rc |
73 |
|
|
|
74 |
|
|
RUNTEST_NS=$old_ns |
75 |
|
|
let RUNTEST_INDENT-=2 |
76 |
|
|
|
77 |
|
|
cd $OLDPWD || exit 1 |
78 |
|
|
done |
79 |
|
|
|
80 |
|
|
test $rc -eq 0 && exit 0 || exit 1 |