]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: --parallel prints results in a single line
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 17 Dec 2015 09:46:32 +0000 (10:46 +0100)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Sat, 5 Mar 2016 16:43:45 +0000 (17:43 +0100)
Like in non-parallel case we are printing only one line per
(sub)test now. The output lines must contain the full test name
to be useful.

This patch does not change anything for the non-parallel output
format except a bit code cleanup.

BTW changed blkid/low-probe test description to have shorter
lines.

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

index e639e73628fd42f59ad06a2051fc3d899f52bff9..c367f011e1955d630fd78e936fe068a80d264984 100644 (file)
@@ -46,11 +46,22 @@ function ts_cd {
 }
 
 function ts_report {
-       if [ "$TS_PARALLEL" == "yes" ]; then
-               echo "$TS_TITLE $1"
+       local desc=
+
+       if [ "$TS_PARALLEL" != "yes" ]; then
+               if [ $TS_NSUBTESTS -ne 0 ] && [ -z "$TS_SUBNAME" ]; then
+                       desc=$(printf "%11s...")
+               fi
+               echo "$desc$1"
+               return
+       fi
+
+       if [ -n "$TS_SUBNAME" ]; then
+               desc=$(printf "%s: [%02d] %s" "$TS_DESC" "$TS_NSUBTESTS" "$TS_SUBNAME")
        else
-               echo "$1"
+               desc=$TS_DESC
        fi
+       printf "%13s: %-45s ...%s\n" "$TS_COMPONENT" "$desc" "$1"
 }
 
 function ts_check_test_command {
@@ -170,6 +181,7 @@ function ts_option_argument {
 }
 
 function ts_init_core_env {
+       TS_SUBNAME=""
        TS_NS="$TS_COMPONENT/$TS_TESTNAME"
        TS_OUTPUT="$TS_OUTDIR/$TS_TESTNAME"
        TS_VGDUMP="$TS_OUTDIR/$TS_TESTNAME.vgdump"
@@ -294,17 +306,12 @@ function ts_init_env {
 function ts_init_subtest {
 
        TS_SUBNAME="$1"
-
        ts_init_core_subtest_env
-
-       [ $TS_NSUBTESTS -eq 0 ] && echo
        TS_NSUBTESTS=$(( $TS_NSUBTESTS + 1 ))
 
-       if [ "$TS_PARALLEL" == "yes" ]; then
-               TS_TITLE=$(printf "%13s: %-30s ...\n%16s: %-27s ..." "$TS_COMPONENT" "$TS_DESC" "" "$TS_SUBNAME")
-       else
-               TS_TITLE=$(printf "%16s: %-27s ..." "" "$TS_SUBNAME")
-               echo -n "$TS_TITLE"
+       if [ "$TS_PARALLEL" != "yes" ]; then
+               [ $TS_NSUBTESTS -eq 1 ] && echo
+               printf "%16s: %-27s ..." "" "$TS_SUBNAME"
        fi
 }
 
@@ -314,11 +321,8 @@ function ts_init {
        local is_fake=$( ts_has_option "fake" "$*")
        local is_force=$( ts_has_option "force" "$*")
 
-       if [ "$TS_PARALLEL" == "yes" ]; then
-               TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC")
-       else
-               TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC")
-               echo -n "$TS_TITLE"
+       if [ "$TS_PARALLEL" != "yes" ]; then
+               printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC"
        fi
 
        [ "$is_fake" == "yes" ] && ts_skip "fake mode"
@@ -420,7 +424,6 @@ function ts_finalize {
        ts_cleanup_on_exit
 
        if [ $TS_NSUBTESTS -ne 0 ]; then
-               printf "%11s..."
                if [ $TS_NSUBFAILED -ne 0 ]; then
                        ts_failed "$TS_NSUBFAILED from $TS_NSUBTESTS sub-tests"
                else
index 628b8a63fd118cd5d83bb3f210e16fda62b94563..38023b8a134fd2eae16c58f14957d62f08e90c8b 100755 (executable)
@@ -17,7 +17,7 @@
 #
 
 TS_TOPDIR="${0%/*}/../.."
-TS_DESC="low-level superblocks probing"
+TS_DESC="superblocks probing"
 
 . $TS_TOPDIR/functions.sh