Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 1 | #!/bin/sh |
2 | |||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 3 | [ -n "$srcdir" ] || srcdir=$(pwd) |
4 | [ -n "$bindir" ] || bindir=$(dirname $(pwd)) | ||||
5 | PATH=$bindir:$PATH | ||||
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 6 | |
7 | run_applet_testcase () | ||||
8 | { | ||||
9 | local applet=$1 | ||||
10 | local testcase=$2 | ||||
11 | |||||
12 | local status=0 | ||||
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 13 | local RES= |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 14 | |
15 | local uc_applet=$(echo $applet | tr a-z A-Z) | ||||
16 | local testname=$(basename $testcase) | ||||
17 | |||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 18 | if grep -q "^# CONFIG_${uc_applet} is not set$" $bindir/.config; then |
Eric Andersen | 650fe63 | 2004-04-06 11:10:30 +0000 | [diff] [blame] | 19 | echo UNTESTED: $testname |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 20 | return 0 |
21 | fi | ||||
22 | |||||
Matt Kraai | 6b140ea | 2002-02-19 23:43:08 +0000 | [diff] [blame] | 23 | if grep -q "^# FEATURE: " $testcase; then |
24 | local feature=`sed -ne 's/^# FEATURE: //p' $testcase` | ||||
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 25 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 26 | if grep -q "^# ${feature} is not set$" $bindir/.config; then |
Eric Andersen | 650fe63 | 2004-04-06 11:10:30 +0000 | [diff] [blame] | 27 | echo UNTESTED: $testname |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 28 | return 0 |
29 | fi | ||||
30 | fi | ||||
31 | |||||
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 32 | rm -rf tmp |
33 | mkdir -p tmp | ||||
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 34 | pushd tmp >/dev/null |
35 | |||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 36 | d=$srcdir sh -x -e $testcase >.logfile.txt 2>&1 |
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 37 | |
38 | if [ $? != 0 ] ; then | ||||
Eric Andersen | 650fe63 | 2004-04-06 11:10:30 +0000 | [diff] [blame] | 39 | echo FAIL: $testname |
40 | if [ "$verbose" = 1 ]; then | ||||
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 41 | cat .logfile.txt |
Eric Andersen | 650fe63 | 2004-04-06 11:10:30 +0000 | [diff] [blame] | 42 | #exit 1; |
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 43 | fi; |
Matt Kraai | 35d6042 | 2002-03-27 17:33:31 +0000 | [diff] [blame] | 44 | status=$? |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 45 | else |
Eric Andersen | 650fe63 | 2004-04-06 11:10:30 +0000 | [diff] [blame] | 46 | echo PASS: $testname |
Eric Andersen | c354f6e | 2004-04-06 00:41:39 +0000 | [diff] [blame] | 47 | rm -f .logfile.txt |
Matt Kraai | 35d6042 | 2002-03-27 17:33:31 +0000 | [diff] [blame] | 48 | status=$? |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 49 | fi |
50 | |||||
51 | popd >/dev/null | ||||
52 | rm -rf tmp | ||||
53 | |||||
54 | return $status | ||||
55 | } | ||||
56 | |||||
57 | run_applet_tests () | ||||
58 | { | ||||
59 | local applet=$1 | ||||
60 | |||||
61 | local status=0 | ||||
62 | |||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 63 | for testcase in $srcdir/$applet/*; do |
64 | if [ "$testcase" = "$srcdir/$applet/CVS" ]; then | ||||
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 65 | continue |
66 | fi | ||||
67 | |||||
68 | if run_applet_testcase $applet $testcase; then | ||||
69 | : | ||||
70 | else | ||||
71 | status=1 | ||||
72 | fi | ||||
73 | done | ||||
74 | |||||
75 | return $status | ||||
76 | } | ||||
77 | |||||
78 | |||||
79 | status=0 | ||||
80 | |||||
Matt Kraai | 01d2ea9 | 2002-01-02 20:37:59 +0000 | [diff] [blame] | 81 | if [ x"$1" = x"-v" ]; then |
82 | verbose=1 | ||||
83 | shift | ||||
84 | fi | ||||
85 | |||||
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 86 | if [ $# -ne 0 ]; then |
87 | applets="$@" | ||||
88 | else | ||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 89 | applets=$(ls $srcdir) |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 90 | fi |
91 | |||||
92 | for applet in $applets; do | ||||
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 93 | if [ "$applet" != CVS -a -d "$srcdir/$applet" ]; then |
Matt Kraai | 3889078 | 2001-10-30 23:11:20 +0000 | [diff] [blame] | 94 | if run_applet_tests $applet; then |
95 | : | ||||
96 | else | ||||
97 | status=1 | ||||
98 | fi | ||||
99 | fi | ||||
100 | done | ||||
101 | |||||
102 | exit $status |