blob: b19be3dd8cdd2a69b19a9500662e96ccf7e52f55 [file] [log] [blame]
Matt Kraai38890782001-10-30 23:11:20 +00001#!/bin/sh
2
3PATH=$(dirname $(pwd)):$PATH
4
5run_applet_testcase ()
6{
7 local applet=$1
8 local testcase=$2
9
10 local status=0
11 local U=
12 local X=
13
14 local uc_applet=$(echo $applet | tr a-z A-Z)
15 local testname=$(basename $testcase)
16
17 if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
18 echo "UNSUPPORTED: $testname"
19 return 0
20 fi
21
22 if grep -q "^# UNSUPPORTED: " $testcase; then
23 local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase`
24
25 if grep -q "^# ${feature} is not set$" ../.config; then
26 echo "UNSUPPORTED: $testname"
27 return 0
28 fi
29 fi
30
31 if grep -q "^# XFAIL$" $testcase; then
32 U=U
33 X=X
34 fi
35
36 mkdir tmp
37 pushd tmp >/dev/null
38
39 if . ../$testcase >/dev/null 2>&1; then
40 echo "${U}PASS: $testname"
41 if [ "$U" ]; then
42 status=1
43 fi
44 else
45 echo "${X}FAIL: $testname"
46 if [ ! "$X" ]; then
47 status=1
48 fi
49 fi
50
51 popd >/dev/null
52 rm -rf tmp
53
54 return $status
55}
56
57run_applet_tests ()
58{
59 local applet=$1
60
61 local status=0
62
63 for testcase in $applet/*; do
64 if [ "$testcase" = "$applet/CVS" ]; then
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
79status=0
80
81if [ $# -ne 0 ]; then
82 applets="$@"
83else
84 applets="*"
85fi
86
87for applet in $applets; do
88 if [ "$applet" != CVS -a -d "$applet" ]; then
89 if run_applet_tests $applet; then
90 :
91 else
92 status=1
93 fi
94 fi
95done
96
97exit $status