diff options
author | Ruediger Meier | 2015-12-17 10:46:32 +0100 |
---|---|---|
committer | Ruediger Meier | 2016-03-05 17:43:45 +0100 |
commit | 2979724f5d0bf81aea17b2f412e8a760e03ac11b (patch) | |
tree | bc97bf4fec2fbdc6217cc81ff1cfd67c10c74ef3 /tests/functions.sh | |
parent | blkdiscard: add --zeroout (BLKZEROOUT ioctl) (diff) | |
download | kernel-qcow2-util-linux-2979724f5d0bf81aea17b2f412e8a760e03ac11b.tar.gz kernel-qcow2-util-linux-2979724f5d0bf81aea17b2f412e8a760e03ac11b.tar.xz kernel-qcow2-util-linux-2979724f5d0bf81aea17b2f412e8a760e03ac11b.zip |
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 <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r-- | tests/functions.sh | 37 |
1 files changed, 20 insertions, 17 deletions
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 |