diff options
-rwxr-xr-x | shell/ash_test/run-all | 102 | ||||
-rwxr-xr-x | shell/hush_test/run-all | 51 |
2 files changed, 82 insertions, 71 deletions
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all index 8dfdddd9f..983e6d184 100755 --- a/shell/ash_test/run-all +++ b/shell/ash_test/run-all | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | TOPDIR=$PWD | 3 | TOPDIR=`pwd` |
4 | 4 | ||
5 | test -x ash || { | 5 | test -x ash || { |
6 | echo "No ./ash - creating a link to ../../busybox" | 6 | echo "No ./ash - creating a link to ../../busybox" |
@@ -10,67 +10,73 @@ test -x printenv || gcc -O2 -o printenv printenv.c || exit $? | |||
10 | test -x recho || gcc -O2 -o recho recho.c || exit $? | 10 | test -x recho || gcc -O2 -o recho recho.c || exit $? |
11 | test -x zecho || gcc -O2 -o zecho zecho.c || exit $? | 11 | test -x zecho || gcc -O2 -o zecho zecho.c || exit $? |
12 | 12 | ||
13 | PATH="$PWD:$PATH" # for ash and recho/zecho/printenv | 13 | PATH="`pwd`:$PATH" # for ash and recho/zecho/printenv |
14 | export PATH | 14 | export PATH |
15 | 15 | ||
16 | THIS_SH="$PWD/ash" | 16 | THIS_SH="`pwd`/ash" |
17 | export THIS_SH | 17 | export THIS_SH |
18 | 18 | ||
19 | do_test() | 19 | do_test() |
20 | { | 20 | { |
21 | test -d "$1" || return 0 | 21 | test -d "$1" || return 0 |
22 | # echo do_test "$1" | 22 | d=${d%/} |
23 | # $1 but with / replaced by # so that it can be used as filename part | 23 | # echo Running tests in directory "$1" |
24 | noslash=`echo "$1" | sed 's:/:#:g'` | 24 | # $1 but with / replaced by # so that it can be used as filename part |
25 | ( | 25 | noslash=`echo "$1" | sed 's:/:#:g'` |
26 | cd "$1" || { echo "cannot cd $1!"; exit 1; } | 26 | ( |
27 | for x in run-*; do | 27 | cd "$1" || { echo "cannot cd $1!"; exit 1; } |
28 | test -f "$x" || continue | 28 | for x in run-*; do |
29 | case "$x" in | 29 | test -f "$x" || continue |
30 | "$0"|run-minimal|run-gprof) ;; | 30 | case "$x" in |
31 | *.orig|*~) ;; | 31 | "$0"|run-minimal|run-gprof) ;; |
32 | #*) echo $x ; sh $x ;; | 32 | *.orig|*~) ;; |
33 | *) | 33 | #*) echo $x ; sh $x ;; |
34 | echo -n "$1/$x: " | 34 | *) |
35 | sh "$x" >"$TOPDIR/$noslash-$x.fail" 2>&1 && \ | 35 | echo -n "$1/$x:" |
36 | { echo "ok"; rm "$TOPDIR/$noslash-$x.fail"; } || echo "fail"; | 36 | sh "$x" >"$TOPDIR/$noslash-$x.fail" 2>&1 && \ |
37 | ;; | 37 | { { echo " ok"; rm "$TOPDIR/$noslash-$x.fail"; } || echo " fail"; } |
38 | esac | 38 | ;; |
39 | done | 39 | esac |
40 | # Many bash run-XXX scripts just do this, | 40 | done |
41 | # no point in duplication it all over the place | 41 | # Many bash run-XXX scripts just do this, |
42 | for x in *.tests; do | 42 | # no point in duplication it all over the place |
43 | test -x "$x" || continue | 43 | for x in *.tests; do |
44 | name="${x%%.tests}" | 44 | test -x "$x" || continue |
45 | test -f "$name.right" || continue | 45 | name="${x%%.tests}" |
46 | echo -n "$1/$x: " | 46 | test -f "$name.right" || continue |
47 | { | 47 | # echo Running test: "$x" |
48 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | 48 | echo -n "$1/$x:" |
49 | diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \ | 49 | { |
50 | && rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail" | 50 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 |
51 | } && echo "ok" || echo "fail" | 51 | diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \ |
52 | done | 52 | && rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail" |
53 | ) | 53 | } && echo " ok" || echo " fail" |
54 | done | ||
55 | ) | ||
54 | } | 56 | } |
55 | 57 | ||
56 | # main part of this script | 58 | # Main part of this script |
57 | # Usage: run-all [directories] | 59 | # Usage: run-all [directories] |
58 | 60 | ||
61 | ret=0 | ||
62 | |||
59 | if [ $# -lt 1 ]; then | 63 | if [ $# -lt 1 ]; then |
60 | # All sub directories | 64 | # All sub directories |
61 | modules=`ls -d ash-*` | 65 | modules=`ls -d ash-*` |
62 | # If you want to test ash against hush testsuite | 66 | # If you want to test ash against hush testsuite |
63 | # (have to copy hush_test dir to current dir first): | 67 | # (have to copy hush_test dir to current dir first): |
64 | #modules=`ls -d ash-* hush_test/hush-*` | 68 | #modules=`ls -d ash-* hush_test/hush-*` |
65 | 69 | ||
66 | for module in $modules; do | 70 | for module in $modules; do |
67 | do_test $module | 71 | do_test $module || ret=1 |
68 | done | 72 | done |
69 | else | 73 | else |
70 | while [ $# -ge 1 ]; do | 74 | while [ $# -ge 1 ]; do |
71 | if [ -d $1 ]; then | 75 | if [ -d $1 ]; then |
72 | do_test $1 | 76 | do_test $1 || ret=1 |
73 | fi | 77 | fi |
74 | shift | 78 | shift |
75 | done | 79 | done |
76 | fi | 80 | fi |
81 | |||
82 | exit ${ret} | ||
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all index 837b3f7da..1dd0edc39 100755 --- a/shell/hush_test/run-all +++ b/shell/hush_test/run-all | |||
@@ -9,6 +9,8 @@ unset LC_NUMERIC | |||
9 | unset LC_TIME | 9 | unset LC_TIME |
10 | unset LC_ALL | 10 | unset LC_ALL |
11 | 11 | ||
12 | TOPDIR=`pwd` | ||
13 | |||
12 | if test ! -x hush; then | 14 | if test ! -x hush; then |
13 | if test ! -x ../../busybox; then | 15 | if test ! -x ../../busybox; then |
14 | echo "Can't run tests. Put hush binary into this directory (`pwd`)" | 16 | echo "Can't run tests. Put hush binary into this directory (`pwd`)" |
@@ -38,6 +40,8 @@ do_test() | |||
38 | test -d "$1" || return 0 | 40 | test -d "$1" || return 0 |
39 | d=${d%/} | 41 | d=${d%/} |
40 | # echo Running tests in directory "$1" | 42 | # echo Running tests in directory "$1" |
43 | # $1 but with / replaced by # so that it can be used as filename part | ||
44 | noslash=`echo "$1" | sed 's:/:#:g'` | ||
41 | ( | 45 | ( |
42 | tret=0 | 46 | tret=0 |
43 | cd "$1" || { echo "cannot cd $1!"; exit 1; } | 47 | cd "$1" || { echo "cannot cd $1!"; exit 1; } |
@@ -49,34 +53,35 @@ do_test() | |||
49 | #*) echo $x ; sh $x ;; | 53 | #*) echo $x ; sh $x ;; |
50 | *) | 54 | *) |
51 | echo -n "$1/$x:" | 55 | echo -n "$1/$x:" |
52 | sh "$x" >"../$1-$x.fail" 2>&1 && \ | 56 | sh "$x" >"$TOPDIR/$noslash-$x.fail" 2>&1 && \ |
53 | { { echo " ok"; rm "../$1-$x.fail"; } || echo " fail"; } | 57 | { { echo " ok"; rm "$TOPDIR/$noslash-$x.fail"; } || echo " fail"; } |
54 | ;; | 58 | ;; |
55 | esac | 59 | esac |
56 | done | 60 | done |
57 | # Many bash run-XXX scripts just do this, | 61 | # Many bash run-XXX scripts just do this, |
58 | # no point in duplication it all over the place | 62 | # no point in duplication it all over the place |
59 | for x in *.tests; do | 63 | for x in *.tests; do |
60 | test -x "$x" || continue | 64 | test -x "$x" || continue |
61 | name="${x%%.tests}" | 65 | name="${x%%.tests}" |
62 | test -f "$name.right" || continue | 66 | test -f "$name.right" || continue |
63 | # echo Running test: "$x" | 67 | # echo Running test: "$x" |
64 | echo -n "$1/$x:" | 68 | echo -n "$1/$x:" |
65 | ( | 69 | ( |
66 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | 70 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 |
67 | r=$? | 71 | r=$? |
68 | # filter C library differences | 72 | # filter C library differences |
69 | sed -i \ | 73 | sed -i \ |
70 | -e "/: invalid option /s:'::g" \ | 74 | -e "/: invalid option /s:'::g" \ |
71 | "$name.xx" | 75 | "$name.xx" |
72 | test $r -eq 77 && rm -f "../$1-$x.fail" && exit 77 | 76 | test $r -eq 77 && rm -f "$TOPDIR/$noslash-$x.fail" && exit 77 |
73 | diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" | 77 | diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \ |
74 | ) | 78 | && rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail" |
75 | case $? in | 79 | ) |
76 | 0) echo " ok";; | 80 | case $? in |
77 | 77) echo " skip (feature disabled)";; | 81 | 0) echo " ok";; |
78 | *) echo " fail"; tret=1;; | 82 | 77) echo " skip (feature disabled)";; |
79 | esac | 83 | *) echo " fail"; tret=1;; |
84 | esac | ||
80 | done | 85 | done |
81 | exit ${tret} | 86 | exit ${tret} |
82 | ) | 87 | ) |
@@ -92,7 +97,7 @@ if [ $# -lt 1 ]; then | |||
92 | modules=`ls -d hush-*` | 97 | modules=`ls -d hush-*` |
93 | 98 | ||
94 | for module in $modules; do | 99 | for module in $modules; do |
95 | do_test $module || ret=1 | 100 | do_test $module || ret=1 |
96 | done | 101 | done |
97 | else | 102 | else |
98 | while [ $# -ge 1 ]; do | 103 | while [ $# -ge 1 ]; do |