blob: 8fb92e696dd9256191614ab66819d1a6fc03d22e [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
Matt Kraaifa144712002-02-19 23:54:42 +000011 if [ $resolution = XPASS -o $resolution = FAIL ]; then
Matt Kraai01d2ea92002-01-02 20:37:59 +000012 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
Matt Kraai38890782001-10-30 23:11:20 +000028 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 Kraai7c718222002-02-19 23:38:08 +000034 show_result UNTESTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000035 return 0
36 fi
37
Matt Kraai6b140ea2002-02-19 23:43:08 +000038 if grep -q "^# FEATURE: " $testcase; then
39 local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
Matt Kraai38890782001-10-30 23:11:20 +000040
41 if grep -q "^# ${feature} is not set$" ../.config; then
Matt Kraai7c718222002-02-19 23:38:08 +000042 show_result UNTESTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000043 return 0
44 fi
45 fi
46
47 if grep -q "^# XFAIL$" $testcase; then
Matt Kraai38890782001-10-30 23:11:20 +000048 X=X
49 fi
50
51 mkdir tmp
52 pushd tmp >/dev/null
53
54 if . ../$testcase >/dev/null 2>&1; then
Matt Kraaifa144712002-02-19 23:54:42 +000055 show_result ${X}PASS $testname
Matt Kraai01d2ea92002-01-02 20:37:59 +000056 status=$!
Matt Kraai38890782001-10-30 23:11:20 +000057 else
Matt Kraai01d2ea92002-01-02 20:37:59 +000058 show_result ${X}FAIL $testname
59 status=$!
Matt Kraai38890782001-10-30 23:11:20 +000060 fi
61
62 popd >/dev/null
63 rm -rf tmp
64
65 return $status
66}
67
68run_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
90status=0
91
Matt Kraai01d2ea92002-01-02 20:37:59 +000092if [ x"$1" = x"-v" ]; then
93 verbose=1
94 shift
95fi
96
Matt Kraai38890782001-10-30 23:11:20 +000097if [ $# -ne 0 ]; then
98 applets="$@"
99else
100 applets="*"
101fi
102
103for 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
111done
112
113exit $status