summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorSami Kerola2014-02-17 00:54:15 +0100
committerKarel Zak2014-02-17 15:01:02 +0100
commit40e6f7a06355cba0305e987ca6536b212e0718cf (patch)
tree641cc4f0cafd1abb18d54be86389495111372fca /tests/functions.sh
parenttests: fdisk now prints SGI system partitions too (diff)
downloadkernel-qcow2-util-linux-40e6f7a06355cba0305e987ca6536b212e0718cf.tar.gz
kernel-qcow2-util-linux-40e6f7a06355cba0305e987ca6536b212e0718cf.tar.xz
kernel-qcow2-util-linux-40e6f7a06355cba0305e987ca6536b212e0718cf.zip
tests: make tests to run parallel
Unarguably this change makes test output to be more messy, but when I compare run time tells with clear numbers parallel is quicker. For me the quickness is important factor. Running test suite always after a change is preferrably quick, and if something is indicated to be broken it is ok to spend time in drilling down what happen. $ time ./tests/run.sh --parallel=5 [...] real 1m48.037s Same without parallelization. $ time ./tests/run.sh real 3m16.687s The default is changed to be parallel, where job count is same as number of CPUs. [kzak@redhat.com: - propagate --parallel into function.sh - don't use extra title for non-parallel execution - disable by default] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh34
1 files changed, 27 insertions, 7 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index c802136e2..5e2292d9b 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -31,8 +31,17 @@ function ts_canonicalize {
fi
}
+function ts_report {
+ if [ "$TS_PARALLEL" == "yes" ]; then
+ echo "$TS_TITLE $1"
+ else
+ echo "$1"
+ fi
+
+}
+
function ts_skip_subtest {
- echo " IGNORE ($1)"
+ ts_report " IGNORE ($1)"
}
function ts_skip {
@@ -51,9 +60,9 @@ function ts_skip_nonroot {
function ts_failed_subtest {
if [ x"$1" == x"" ]; then
- echo " FAILED ($TS_NS)"
+ ts_report " FAILED ($TS_NS)"
else
- echo " FAILED ($1)"
+ ts_report " FAILED ($1)"
fi
}
@@ -64,9 +73,9 @@ function ts_failed {
function ts_ok_subtest {
if [ x"$1" == x"" ]; then
- echo " OK"
+ ts_report " OK"
else
- echo " OK ($1)"
+ ts_report " OK ($1)"
fi
}
@@ -162,6 +171,7 @@ function ts_init_env {
ts_init_core_env
TS_VERBOSE=$(ts_has_option "verbose" "$*")
+ TS_PARALLEL=$(ts_has_option "parallel" "$*")
BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
@@ -209,7 +219,12 @@ function ts_init_subtest {
[ $TS_NSUBTESTS -eq 0 ] && echo
TS_NSUBTESTS=$(( $TS_NSUBTESTS + 1 ))
- printf "%16s: %-27s ..." "" "$TS_SUBNAME"
+ 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"
+ fi
}
function ts_init {
@@ -223,7 +238,12 @@ function ts_init {
ts_init_env "$*"
- printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC"
+ 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"
+ fi
[ "$is_fake" == "yes" ] && ts_skip "fake mode"
[ "$TS_OPTIONAL" == "yes" -a "$is_force" != "yes" ] && ts_skip "optional"