Patch from Kent Robotti to being fdisk in sync with v2.12 final.
[oweals/busybox.git] / testsuite / runtest
index b19be3dd8cdd2a69b19a9500662e96ccf7e52f55..2cf85f5d8ee48cdb7f597c35ff25388876f71d07 100755 (executable)
@@ -2,34 +2,49 @@
 
 PATH=$(dirname $(pwd)):$PATH
 
+show_result ()
+{
+       local resolution=$1
+       local testcase=$2
+       local status=0
+
+       if [ $resolution = XPASS -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
        local testcase=$2
 
        local status=0
-       local U=
        local X=
 
        local uc_applet=$(echo $applet | tr a-z A-Z)
        local testname=$(basename $testcase)
 
        if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
-               echo "UNSUPPORTED: $testname"
+               show_result UNTESTED $testname
                return 0
        fi
 
-       if grep -q "^# UNSUPPORTED: " $testcase; then
-               local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase`
+       if grep -q "^# FEATURE: " $testcase; then
+               local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
 
                if grep -q "^# ${feature} is not set$" ../.config; then
-                       echo "UNSUPPORTED: $testname"
+                       show_result UNTESTED $testname
                        return 0
                fi
        fi
 
        if grep -q "^# XFAIL$" $testcase; then
-               U=U
                X=X
        fi
 
@@ -37,15 +52,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 ${X}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 +89,11 @@ run_applet_tests ()
 
 status=0
 
+if [ x"$1" = x"-v" ]; then
+       verbose=1
+       shift
+fi
+
 if [ $# -ne 0 ]; then
        applets="$@"
 else