From: Ruediger Meier Date: Thu, 17 Dec 2015 09:46:32 +0000 (+0100) Subject: tests: --parallel prints results in a single line X-Git-Tag: v2.28-rc1~53^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2979724f5d0bf81aea17b2f412e8a760e03ac11b;p=thirdparty%2Futil-linux.git tests: --parallel prints results in a single line 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 --- diff --git a/tests/functions.sh b/tests/functions.sh index e639e73628..c367f011e1 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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 diff --git a/tests/ts/blkid/low-probe b/tests/ts/blkid/low-probe index 628b8a63fd..38023b8a13 100755 --- a/tests/ts/blkid/low-probe +++ b/tests/ts/blkid/low-probe @@ -17,7 +17,7 @@ # TS_TOPDIR="${0%/*}/../.." -TS_DESC="low-level superblocks probing" +TS_DESC="superblocks probing" . $TS_TOPDIR/functions.sh