blob: 89aba3985015c0cacdcc8f86130f32f4b787bd1a [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
Eric Andersenc354f6e2004-04-06 00:41:39 +000011 local RES=
Matt Kraai38890782001-10-30 23:11:20 +000012
13 local uc_applet=$(echo $applet | tr a-z A-Z)
14 local testname=$(basename $testcase)
15
16 if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
Eric Andersen650fe632004-04-06 11:10:30 +000017 echo UNTESTED: $testname
Matt Kraai38890782001-10-30 23:11:20 +000018 return 0
19 fi
20
Matt Kraai6b140ea2002-02-19 23:43:08 +000021 if grep -q "^# FEATURE: " $testcase; then
22 local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
Matt Kraai38890782001-10-30 23:11:20 +000023
24 if grep -q "^# ${feature} is not set$" ../.config; then
Eric Andersen650fe632004-04-06 11:10:30 +000025 echo UNTESTED: $testname
Matt Kraai38890782001-10-30 23:11:20 +000026 return 0
27 fi
28 fi
29
Eric Andersenc354f6e2004-04-06 00:41:39 +000030 rm -rf tmp
31 mkdir -p tmp
Matt Kraai38890782001-10-30 23:11:20 +000032 pushd tmp >/dev/null
33
Eric Andersenc354f6e2004-04-06 00:41:39 +000034 sh -x -e ../$testcase >.logfile.txt 2>&1
35
36 if [ $? != 0 ] ; then
Eric Andersen650fe632004-04-06 11:10:30 +000037 echo FAIL: $testname
38 if [ "$verbose" = 1 ]; then
Eric Andersenc354f6e2004-04-06 00:41:39 +000039 cat .logfile.txt
Eric Andersen650fe632004-04-06 11:10:30 +000040 #exit 1;
Eric Andersenc354f6e2004-04-06 00:41:39 +000041 fi;
Matt Kraai35d60422002-03-27 17:33:31 +000042 status=$?
Matt Kraai38890782001-10-30 23:11:20 +000043 else
Eric Andersen650fe632004-04-06 11:10:30 +000044 echo PASS: $testname
Eric Andersenc354f6e2004-04-06 00:41:39 +000045 rm -f .logfile.txt
Matt Kraai35d60422002-03-27 17:33:31 +000046 status=$?
Matt Kraai38890782001-10-30 23:11:20 +000047 fi
48
49 popd >/dev/null
50 rm -rf tmp
51
52 return $status
53}
54
55run_applet_tests ()
56{
57 local applet=$1
58
59 local status=0
60
61 for testcase in $applet/*; do
62 if [ "$testcase" = "$applet/CVS" ]; then
63 continue
64 fi
65
66 if run_applet_testcase $applet $testcase; then
67 :
68 else
69 status=1
70 fi
71 done
72
73 return $status
74}
75
76
77status=0
78
Matt Kraai01d2ea92002-01-02 20:37:59 +000079if [ x"$1" = x"-v" ]; then
80 verbose=1
81 shift
82fi
83
Matt Kraai38890782001-10-30 23:11:20 +000084if [ $# -ne 0 ]; then
85 applets="$@"
86else
87 applets="*"
88fi
89
90for applet in $applets; do
91 if [ "$applet" != CVS -a -d "$applet" ]; then
92 if run_applet_tests $applet; then
93 :
94 else
95 status=1
96 fi
97 fi
98done
99
100exit $status