aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/run-all
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-06 17:59:25 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-06 17:59:25 +0200
commit9a8ece51582b83a2d4ed3e1854dca703d5113da2 (patch)
treeab95eba570a91d20796edbf935ad9bd755f92117 /shell/hush_test/run-all
parent3c9688e58737665d204ab70e6b0e10c745c99c30 (diff)
downloadbusybox-w32-9a8ece51582b83a2d4ed3e1854dca703d5113da2.tar.gz
busybox-w32-9a8ece51582b83a2d4ed3e1854dca703d5113da2.tar.bz2
busybox-w32-9a8ece51582b83a2d4ed3e1854dca703d5113da2.zip
shell: syncronize ash_test/run-all and hush_test/run-all a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/run-all')
-rwxr-xr-xshell/hush_test/run-all51
1 files changed, 28 insertions, 23 deletions
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
9unset LC_TIME 9unset LC_TIME
10unset LC_ALL 10unset LC_ALL
11 11
12TOPDIR=`pwd`
13
12if test ! -x hush; then 14if 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
97else 102else
98 while [ $# -ge 1 ]; do 103 while [ $# -ge 1 ]; do