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