aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2002-01-02 20:37:59 +0000
committerMatt Kraai <kraai@debian.org>2002-01-02 20:37:59 +0000
commit01d2ea908b88a80b2f5d36c23229032dd76d621c (patch)
tree8e4b2e322f2351080898525cf9cf124e9baa8a75
parent39fcb5a7502ffb35a90b9539478c5b0d314c3b8e (diff)
downloadbusybox-01d2ea908b88a80b2f5d36c23229032dd76d621c.tar.gz
* testsuite/README: Document -v option.
* testsuite/runtest: Handle -v option. (show_result): New. (run_applet_testcase): Call it.
-rw-r--r--testsuite/README6
-rwxr-xr-xtestsuite/runtest38
2 files changed, 32 insertions, 12 deletions
diff --git a/testsuite/README b/testsuite/README
index a886b4217..b02dfa49c 100644
--- a/testsuite/README
+++ b/testsuite/README
@@ -1,6 +1,8 @@
To run the test suite, change to this directory and run
-"./runtest". To only run the test cases for particular applets,
-specify them as parameters to runtest.
+"./runtest". It will run all of the test cases, and list those
+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
applet name. The name of the test case should be the assertion
diff --git a/testsuite/runtest b/testsuite/runtest
index b19be3dd8..2e8d391e0 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -2,6 +2,23 @@
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 ()
{
local applet=$1
@@ -15,7 +32,7 @@ run_applet_testcase ()
local testname=$(basename $testcase)
if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
- echo "UNSUPPORTED: $testname"
+ show_result UNSUPPORTED $testname
return 0
fi
@@ -23,7 +40,7 @@ run_applet_testcase ()
local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase`
if grep -q "^# ${feature} is not set$" ../.config; then
- echo "UNSUPPORTED: $testname"
+ show_result UNSUPPORTED $testname
return 0
fi
fi
@@ -37,15 +54,11 @@ run_applet_testcase ()
pushd tmp >/dev/null
if . ../$testcase >/dev/null 2>&1; then
- echo "${U}PASS: $testname"
- if [ "$U" ]; then
- status=1
- fi
+ show_result ${U}PASS $testname
+ status=$!
else
- echo "${X}FAIL: $testname"
- if [ ! "$X" ]; then
- status=1
- fi
+ show_result ${X}FAIL $testname
+ status=$!
fi
popd >/dev/null
@@ -78,6 +91,11 @@ run_applet_tests ()
status=0
+if [ x"$1" = x"-v" ]; then
+ verbose=1
+ shift
+fi
+
if [ $# -ne 0 ]; then
applets="$@"
else