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