diff options
Diffstat (limited to 'shell/ash_test/run-all')
-rwxr-xr-x | shell/ash_test/run-all | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all new file mode 100755 index 000000000..ba1756e7d --- /dev/null +++ b/shell/ash_test/run-all | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | test -x ash || { echo "No ./ash?!"; exit; } | ||
4 | test -x printenv || gcc -O2 -o printenv printenv.c || exit $? | ||
5 | test -x recho || gcc -O2 -o recho recho.c || exit $? | ||
6 | test -x zecho || gcc -O2 -o zecho zecho.c || exit $? | ||
7 | |||
8 | PATH="$PWD:$PATH" # for ash and recho/zecho/printenv | ||
9 | export PATH | ||
10 | |||
11 | THIS_SH="$PWD/ash" | ||
12 | export THIS_SH | ||
13 | |||
14 | do_test() | ||
15 | { | ||
16 | test -d "$1" || return 0 | ||
17 | ( | ||
18 | cd "$1" || { echo "cannot cd $1!"; exit 1; } | ||
19 | for x in run-*; do | ||
20 | test -f "$x" || continue | ||
21 | case "$x" in | ||
22 | "$0"|run-minimal|run-gprof) ;; | ||
23 | *.orig|*~) ;; | ||
24 | #*) echo $x ; sh $x ;; | ||
25 | *) | ||
26 | sh "$x" >"../$1-$x.fail" 2>&1 && \ | ||
27 | { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; | ||
28 | ;; | ||
29 | esac | ||
30 | done | ||
31 | # Many bash run-XXX scripts just do this, | ||
32 | # no point in duplication it all over the place | ||
33 | for x in *.tests; do | ||
34 | test -x "$x" || continue | ||
35 | name="${x%%.tests}" | ||
36 | test -f "$name.right" || continue | ||
37 | { | ||
38 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | ||
39 | diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" | ||
40 | } && echo "$1/$x: ok" || echo "$1/$x: fail" | ||
41 | done | ||
42 | ) | ||
43 | } | ||
44 | |||
45 | # main part of this script | ||
46 | # Usage: run-all [directories] | ||
47 | |||
48 | if [ $# -lt 1 ]; then | ||
49 | # All sub directories | ||
50 | modules=`ls -d ash-*` | ||
51 | |||
52 | for module in $modules; do | ||
53 | do_test $module | ||
54 | done | ||
55 | else | ||
56 | while [ $# -ge 1 ]; do | ||
57 | if [ -d $1 ]; then | ||
58 | do_test $1 | ||
59 | fi | ||
60 | shift | ||
61 | done | ||
62 | fi | ||