From 2979724f5d0bf81aea17b2f412e8a760e03ac11b Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Thu, 17 Dec 2015 10:46:32 +0100 Subject: 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 --- tests/functions.sh | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'tests/functions.sh') diff --git a/tests/functions.sh b/tests/functions.sh index e639e7362..c367f011e 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 -- cgit v1.2.3-55-g7522