blob: 2e8d391e04be5062fc111aeec97b20d0b920b04c [file] [log] [blame]
Matt Kraai38890782001-10-30 23:11:20 +00001#!/bin/sh
2
3PATH=$(dirname $(pwd)):$PATH
4
Matt Kraai01d2ea92002-01-02 20:37:59 +00005show_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 Kraai38890782001-10-30 23:11:20 +000022run_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 Kraai01d2ea92002-01-02 20:37:59 +000035 show_result UNSUPPORTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000036 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 Kraai01d2ea92002-01-02 20:37:59 +000043 show_result UNSUPPORTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000044 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 Kraai01d2ea92002-01-02 20:37:59 +000057 show_result ${U}PASS $testname
58 status=$!
Matt Kraai38890782001-10-30 23:11:20 +000059 else
Matt Kraai01d2ea92002-01-02 20:37:59 +000060 show_result ${X}FAIL $testname
61 status=$!
Matt Kraai38890782001-10-30 23:11:20 +000062 fi
63
64 popd >/dev/null
65 rm -rf tmp
66
67 return $status
68}
69
70run_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
92status=0
93
Matt Kraai01d2ea92002-01-02 20:37:59 +000094if [ x"$1" = x"-v" ]; then
95 verbose=1
96 shift
97fi
98
Matt Kraai38890782001-10-30 23:11:20 +000099if [ $# -ne 0 ]; then
100 applets="$@"
101else
102 applets="*"
103fi
104
105for 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
113done
114
115exit $status