* testsuite/README: Document -v option.

* testsuite/runtest: Handle -v option.
  (show_result): New.
  (run_applet_testcase): Call it.
This commit is contained in:
Matt Kraai 2002-01-02 20:37:59 +00:00
parent 39fcb5a750
commit 01d2ea908b
2 changed files with 32 additions and 12 deletions

View File

@ -1,6 +1,8 @@
To run the test suite, change to this directory and run To run the test suite, change to this directory and run
"./runtest". To only run the test cases for particular applets, "./runtest". It will run all of the test cases, and list those
specify them as parameters to runtest. with unexpected outcomes. Adding the -v option will cause it to
show expected outcomes as well. To only run the test cases for
particular applets, specify them as parameters to runtest.
The test cases for an applet reside in the subdirectory of the The test cases for an applet reside in the subdirectory of the
applet name. The name of the test case should be the assertion applet name. The name of the test case should be the assertion

View File

@ -2,6 +2,23 @@
PATH=$(dirname $(pwd)):$PATH PATH=$(dirname $(pwd)):$PATH
show_result ()
{
local resolution=$1
local testcase=$2
local status=0
if [ $resolution = UPASS -o $resolution = FAIL ]; then
status=1
fi
if [ "$verbose" -o $status -eq 1 ]; then
echo "$resolution: $testcase"
fi
return $status
}
run_applet_testcase () run_applet_testcase ()
{ {
local applet=$1 local applet=$1
@ -15,7 +32,7 @@ run_applet_testcase ()
local testname=$(basename $testcase) local testname=$(basename $testcase)
if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
echo "UNSUPPORTED: $testname" show_result UNSUPPORTED $testname
return 0 return 0
fi fi
@ -23,7 +40,7 @@ run_applet_testcase ()
local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase` local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase`
if grep -q "^# ${feature} is not set$" ../.config; then if grep -q "^# ${feature} is not set$" ../.config; then
echo "UNSUPPORTED: $testname" show_result UNSUPPORTED $testname
return 0 return 0
fi fi
fi fi
@ -37,15 +54,11 @@ run_applet_testcase ()
pushd tmp >/dev/null pushd tmp >/dev/null
if . ../$testcase >/dev/null 2>&1; then if . ../$testcase >/dev/null 2>&1; then
echo "${U}PASS: $testname" show_result ${U}PASS $testname
if [ "$U" ]; then status=$!
status=1
fi
else else
echo "${X}FAIL: $testname" show_result ${X}FAIL $testname
if [ ! "$X" ]; then status=$!
status=1
fi
fi fi
popd >/dev/null popd >/dev/null
@ -78,6 +91,11 @@ run_applet_tests ()
status=0 status=0
if [ x"$1" = x"-v" ]; then
verbose=1
shift
fi
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
applets="$@" applets="$@"
else else