]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: fix "KNOWN FAILED" for subtests
authorRuediger Meier <ruediger.meier@ga-group.nl>
Mon, 12 May 2014 20:56:57 +0000 (22:56 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 13 May 2014 13:39:25 +0000 (15:39 +0200)
It didn't worked for tests with subtests.

Here we consolidate both cases which fixes the issue by the way. This
is basically a rewrite of 7641ccec.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/functions.sh

index 1dc671d9eb440f2c8c693d7f2291034ee95e0292..7174a35af77e9139a98ef99068de15774d7bac94 100644 (file)
@@ -64,25 +64,25 @@ function ts_skip_nonroot {
 }
 
 function ts_failed_subtest {
+       local msg="FAILED"
+       local ret=1
+       if [ "$TS_KNOWN_FAIL" = "yes" ]; then
+               msg="KNOWN FAILED"
+               ret=0
+       fi
+
        if [ x"$1" == x"" ]; then
-               ts_report " FAILED ($TS_NS)"
+               ts_report " $msg ($TS_NS)"
        else
-               ts_report " FAILED ($1)"
+               ts_report " $msg ($1)"
        fi
+
+       return $ret
 }
 
 function ts_failed {
        ts_failed_subtest "$1"
-       exit 1
-}
-
-function ts_known_failed {
-       if [ x"$1" == x"" ]; then
-               ts_report " KNOWN FAILED ($TS_NS)"
-       else
-               ts_report " KNOWN FAILED ($1)"
-       fi
-       exit 0
+       exit $?
 }
 
 function ts_ok_subtest {
@@ -393,9 +393,6 @@ function ts_finalize {
        if [ -s $TS_EXPECTED ]; then
                ts_gen_diff
                if [ $? -eq 1 ]; then
-                       if [ "$TS_KNOWN_FAIL" = "yes" ]; then
-                               ts_known_failed "$1"
-                       fi
                        ts_failed "$1"
                fi
                ts_ok "$1"