diff options
| author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-01-02 20:37:59 +0000 |
|---|---|---|
| committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-01-02 20:37:59 +0000 |
| commit | 40eaf38eeb910e47a28a8b13be2d465cf7701f8f (patch) | |
| tree | 8e4b2e322f2351080898525cf9cf124e9baa8a75 | |
| parent | ce247f6625980a8490eb0daaa520c084e98d50d9 (diff) | |
| download | busybox-w32-40eaf38eeb910e47a28a8b13be2d465cf7701f8f.tar.gz busybox-w32-40eaf38eeb910e47a28a8b13be2d465cf7701f8f.tar.bz2 busybox-w32-40eaf38eeb910e47a28a8b13be2d465cf7701f8f.zip | |
* testsuite/README: Document -v option.
* testsuite/runtest: Handle -v option.
(show_result): New.
(run_applet_testcase): Call it.
git-svn-id: svn://busybox.net/trunk/busybox@3994 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | testsuite/README | 6 | ||||
| -rwxr-xr-x | testsuite/runtest | 38 |
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 @@ | |||
| 1 | To run the test suite, change to this directory and run | 1 | To run the test suite, change to this directory and run |
| 2 | "./runtest". To only run the test cases for particular applets, | 2 | "./runtest". It will run all of the test cases, and list those |
| 3 | specify them as parameters to runtest. | 3 | with unexpected outcomes. Adding the -v option will cause it to |
| 4 | show expected outcomes as well. To only run the test cases for | ||
| 5 | particular applets, specify them as parameters to runtest. | ||
| 4 | 6 | ||
| 5 | The test cases for an applet reside in the subdirectory of the | 7 | The test cases for an applet reside in the subdirectory of the |
| 6 | applet name. The name of the test case should be the assertion | 8 | 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 @@ | |||
| 2 | 2 | ||
| 3 | PATH=$(dirname $(pwd)):$PATH | 3 | PATH=$(dirname $(pwd)):$PATH |
| 4 | 4 | ||
| 5 | show_result () | ||
| 6 | { | ||
| 7 | local resolution=$1 | ||
| 8 | local testcase=$2 | ||
| 9 | local status=0 | ||
| 10 | |||
| 11 | if [ $resolution = UPASS -o $resolution = FAIL ]; then | ||
| 12 | 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 | |||
| 5 | run_applet_testcase () | 22 | run_applet_testcase () |
| 6 | { | 23 | { |
| 7 | local applet=$1 | 24 | local applet=$1 |
| @@ -15,7 +32,7 @@ run_applet_testcase () | |||
| 15 | local testname=$(basename $testcase) | 32 | local testname=$(basename $testcase) |
| 16 | 33 | ||
| 17 | if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then | 34 | if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then |
| 18 | echo "UNSUPPORTED: $testname" | 35 | show_result UNSUPPORTED $testname |
| 19 | return 0 | 36 | return 0 |
| 20 | fi | 37 | fi |
| 21 | 38 | ||
| @@ -23,7 +40,7 @@ run_applet_testcase () | |||
| 23 | local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase` | 40 | local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase` |
| 24 | 41 | ||
| 25 | if grep -q "^# ${feature} is not set$" ../.config; then | 42 | if grep -q "^# ${feature} is not set$" ../.config; then |
| 26 | echo "UNSUPPORTED: $testname" | 43 | show_result UNSUPPORTED $testname |
| 27 | return 0 | 44 | return 0 |
| 28 | fi | 45 | fi |
| 29 | fi | 46 | fi |
| @@ -37,15 +54,11 @@ run_applet_testcase () | |||
| 37 | pushd tmp >/dev/null | 54 | pushd tmp >/dev/null |
| 38 | 55 | ||
| 39 | if . ../$testcase >/dev/null 2>&1; then | 56 | if . ../$testcase >/dev/null 2>&1; then |
| 40 | echo "${U}PASS: $testname" | 57 | show_result ${U}PASS $testname |
| 41 | if [ "$U" ]; then | 58 | status=$! |
| 42 | status=1 | ||
| 43 | fi | ||
| 44 | else | 59 | else |
| 45 | echo "${X}FAIL: $testname" | 60 | show_result ${X}FAIL $testname |
| 46 | if [ ! "$X" ]; then | 61 | status=$! |
| 47 | status=1 | ||
| 48 | fi | ||
| 49 | fi | 62 | fi |
| 50 | 63 | ||
| 51 | popd >/dev/null | 64 | popd >/dev/null |
| @@ -78,6 +91,11 @@ run_applet_tests () | |||
| 78 | 91 | ||
| 79 | status=0 | 92 | status=0 |
| 80 | 93 | ||
| 94 | if [ x"$1" = x"-v" ]; then | ||
| 95 | verbose=1 | ||
| 96 | shift | ||
| 97 | fi | ||
| 98 | |||
| 81 | if [ $# -ne 0 ]; then | 99 | if [ $# -ne 0 ]; then |
| 82 | applets="$@" | 100 | applets="$@" |
| 83 | else | 101 | else |
