aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test
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/ash_test
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/ash_test')
-rwxr-xr-xshell/ash_test/run-all102
1 files changed, 54 insertions, 48 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
3TOPDIR=$PWD 3TOPDIR=`pwd`
4 4
5test -x ash || { 5test -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 $?
10test -x recho || gcc -O2 -o recho recho.c || exit $? 10test -x recho || gcc -O2 -o recho recho.c || exit $?
11test -x zecho || gcc -O2 -o zecho zecho.c || exit $? 11test -x zecho || gcc -O2 -o zecho zecho.c || exit $?
12 12
13PATH="$PWD:$PATH" # for ash and recho/zecho/printenv 13PATH="`pwd`:$PATH" # for ash and recho/zecho/printenv
14export PATH 14export PATH
15 15
16THIS_SH="$PWD/ash" 16THIS_SH="`pwd`/ash"
17export THIS_SH 17export THIS_SH
18 18
19do_test() 19do_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
61ret=0
62
59if [ $# -lt 1 ]; then 63if [ $# -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
69else 73else
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
76fi 80fi
81
82exit ${ret}