From: Ruediger Meier Date: Mon, 12 May 2014 20:56:57 +0000 (+0200) Subject: tests: fix "KNOWN FAILED" for subtests X-Git-Tag: v2.25-rc1~156^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=733094a8510133a8ea72d52d5b8b3732b843b5fe;p=thirdparty%2Futil-linux.git tests: fix "KNOWN FAILED" for subtests 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 --- diff --git a/tests/functions.sh b/tests/functions.sh index 1dc671d9eb..7174a35af7 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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"