blob: f57f464ee789384a1a9dffd450d0c2171b569019 [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=
Eric Andersenc354f6e2004-04-06 00:41:39 +000029 local RES=
Matt Kraai38890782001-10-30 23:11:20 +000030
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 Kraai7c718222002-02-19 23:38:08 +000035 show_result UNTESTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000036 return 0
37 fi
38
Matt Kraai6b140ea2002-02-19 23:43:08 +000039 if grep -q "^# FEATURE: " $testcase; then
40 local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
Matt Kraai38890782001-10-30 23:11:20 +000041
42 if grep -q "^# ${feature} is not set$" ../.config; then
Matt Kraai7c718222002-02-19 23:38:08 +000043 show_result UNTESTED $testname
Matt Kraai38890782001-10-30 23:11:20 +000044 return 0
45 fi
46 fi
47
48 if grep -q "^# XFAIL$" $testcase; then
Matt Kraai38890782001-10-30 23:11:20 +000049 X=X
50 fi
51
Eric Andersenc354f6e2004-04-06 00:41:39 +000052 rm -rf tmp
53 mkdir -p tmp
Matt Kraai38890782001-10-30 23:11:20 +000054 pushd tmp >/dev/null
55
Eric Andersenc354f6e2004-04-06 00:41:39 +000056 sh -x -e ../$testcase >.logfile.txt 2>&1
57
58 if [ $? != 0 ] ; then
59 show_result ${X}FAIL $testname
60 if [ "$verbose" == 1 ]; then
61 cat .logfile.txt
62 exit 1;
63 fi;
Matt Kraai35d60422002-03-27 17:33:31 +000064 status=$?
Matt Kraai38890782001-10-30 23:11:20 +000065 else
Eric Andersenc354f6e2004-04-06 00:41:39 +000066 show_result ${X}PASS $testname
67 rm -f .logfile.txt
Matt Kraai35d60422002-03-27 17:33:31 +000068 status=$?
Matt Kraai38890782001-10-30 23:11:20 +000069 fi
70
71 popd >/dev/null
72 rm -rf tmp
73
74 return $status
75}
76
77run_applet_tests ()
78{
79 local applet=$1
80
81 local status=0
82
83 for testcase in $applet/*; do
84 if [ "$testcase" = "$applet/CVS" ]; then
85 continue
86 fi
87
88 if run_applet_testcase $applet $testcase; then
89 :
90 else
91 status=1
92 fi
93 done
94
95 return $status
96}
97
98
99status=0
100
Matt Kraai01d2ea92002-01-02 20:37:59 +0000101if [ x"$1" = x"-v" ]; then
102 verbose=1
103 shift
104fi
105
Matt Kraai38890782001-10-30 23:11:20 +0000106if [ $# -ne 0 ]; then
107 applets="$@"
108else
109 applets="*"
110fi
111
112for applet in $applets; do
113 if [ "$applet" != CVS -a -d "$applet" ]; then
114 if run_applet_tests $applet; then
115 :
116 else
117 status=1
118 fi
119 fi
120done
121
122exit $status