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