Debian Codegraph @

shell/ash_test/run-all

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 unset LANG LANGUAGE
4 unset LC_COLLATE
5 unset LC_CTYPE
6 unset LC_MONETARY
7 unset LC_MESSAGES
8 unset LC_NUMERIC
9 unset LC_TIME
10 unset LC_ALL
11
12 TOPDIR=`pwdscip-shell system . . pwd.`
13
14 if testscip-shell system . . test. ! -x ash; then
15 if testscip-shell system . . test. ! -x ../../busybox; then
16 echoscip-shell system . . echo. "Can't run tests. Put ash binary into this directory (`pwd`)"
17 exit 1
18 fi
19 echoscip-shell system . . echo. "No ./ash - creating a link to ../../busybox"
20 lnscip-shell system . . ln. -s ../../busybox ash
21 fi
22 if testscip-shell system . . test. ! -f .config; then
23 if testscip-shell system . . test. ! -f ../../.config; then
24 echoscip-shell system . . echo. "Missing .config file"
25 exit 1
26 fi
27 cpscip-shell system . . cp. ../../.config . || exit 1
28 fi
29
30 eval $(sedscip-shell system . . sed. -e '/^#/dscip-shell filesystem . . `/^#/d`.' -e '/^$/dscip-shell filesystem . . `/^$/d`.' -e 's:^:export :' .config)
31
32 testscip-shell system . . test. -x printenv || gccscip-shell system . . gcc. -O2 -o printenv printenv.c || exit $?
33 testscip-shell system . . test. -x recho || gccscip-shell system . . gcc. -O2 -o recho recho.c || exit $?
34 testscip-shell system . . test. -x zecho || gccscip-shell system . . gcc. -O2 -o zecho zecho.c || exit $?
35
36 PATH="`pwdscip-shell system . . pwd.`:$PATH" # for ash and recho/zecho/printenv
37 export PATH
38
39 THIS_SH="`pwdscip-shell system . . pwd.`/ash"
40 export THIS_SH
41
42 do_testscip-shell shell shell-project 0.0.0 do_test().()
43 {
44 testscip-shell system . . test. -d "$1" || return 0
45 d=${d%/}
46 # echo Running tests in directory "$1"
47 # $1 but with / replaced by # so that it can be used as filename part
48 noslash=`echoscip-shell system . . echo. "$1" | sedscip-shell system . . sed. 's:/:#:g'`
49 (
50 tret=0
51 cd "$1" || { echoscip-shell system . . echo. "cannot cd $1!"; exit 1; }
52 for x in run-*; do
53 testscip-shell system . . test. -f "$x" || continue
54 case "$x" in
55 "$0"|run-minimal|run-gprof) ;;
56 *.orig|*~) ;;
57 #*) echo $x ; sh $x ;;
58 *)
59 echoscip-shell system . . echo. -n "$1/$x:"
60 shscip-shell system . . sh. "$x" >"$TOPDIR/$noslash-$x.fail" 2>&1 && \
61 { { echoscip-shell system . . echo. " ok"; rmscip-shell system . . rm. "$TOPDIR/$noslash-$x.fail"; } || echoscip-shell system . . echo. " fail"; }
62 ;;
63 esac
64 done
65 # Many bash run-XXX scripts just do this,
66 # no point in duplication it all over the place
67 for x in *.tests; do
68 testscip-shell system . . test. -x "$x" || continue
69 name="${x%%.tests}"
70 testscip-shell system . . test. -f "$name.right" || continue
71 # echo Running test: "$x"
72 echoscip-shell system . . echo. -n "$1/$x:"
73 (
74 "$THIS_SH" "./$x" 2>&1 | \
75 grep -va "^ash: using fallback suid method$" >"$name.xx"
76 r=$?
77 # filter C library differences
78 sedscip-shell system . . sed. -i \
79 -e "/: invalid option /s:'::gscip-shell filesystem . . `/: invalid option /s:'::g`." \
80 "$name.xx"
81 testscip-shell system . . test. $r -eq 77 && rmscip-shell system . . rm. -f "$TOPDIR/$noslash-$x.fail" && exit 77
82 diffscip-shell system . . diff. -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \
83 && rmscip-shell system . . rm. -f "$name.xx" "$TOPDIR/$noslash-$x.fail"
84 )
85 case $? in
86 0) echoscip-shell system . . echo. " ok";;
87 77) echoscip-shell system . . echo. " skip (feature disabled)";;
88 *) echoscip-shell system . . echo. " fail ($?)"; tret=1;;
89 esac
90 done
91 exit $tret
92 )
93 }
94
95 # Main part of this script
96 # Usage: run-all [directories]
97
98 ret=0
99
100 if [scip-shell system . . `[`. $# -lt 1 ]; then
101 # All sub directories
102 modules=`lsscip-shell system . . ls. -d ash-*`
103 # If you want to test ash against hush testsuite
104 # (have to copy hush_test dir to current dir first):
105 #modules=`ls -d ash-* hush_test/hush-*`
106
107 for module in $modules; do
108 do_testscip-shell shell shell-project 0.0.0 do_test(). $module || ret=1
109 done
110 else
111 while [scip-shell system . . `[`. $# -ge 1 ]; do
112 if [scip-shell system . . `[`. -d $1 ]; then
113 do_testscip-shell shell shell-project 0.0.0 do_test(). $1 || ret=1
114 fi
115 shift
116 done
117 fi
118
119 exit $ret