summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorRuediger Meier2016-03-05 15:40:57 +0100
committerRuediger Meier2016-03-05 22:19:24 +0100
commit855f7f06507f5b2f547da054898ae751bec888bb (patch)
treed2dbaa7e7407d6992b95d248e69e7828898be2df /tests/functions.sh
parenttests: --parallel prints results in a single line (diff)
downloadkernel-qcow2-util-linux-855f7f06507f5b2f547da054898ae751bec888bb.tar.gz
kernel-qcow2-util-linux-855f7f06507f5b2f547da054898ae751bec888bb.tar.xz
kernel-qcow2-util-linux-855f7f06507f5b2f547da054898ae751bec888bb.zip
tests: add option --parsable
This is to force the one-line results also for non-parallel case. We are using it for travis auto-build and on other build farms. Moreover you can set this (and any other) option globally by env which is the only way to pass it to make distcheck. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index c367f011e..9e5d24325 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -48,7 +48,7 @@ function ts_cd {
function ts_report {
local desc=
- if [ "$TS_PARALLEL" != "yes" ]; then
+ if [ "$TS_PARSABLE" != "yes" ]; then
if [ $TS_NSUBTESTS -ne 0 ] && [ -z "$TS_SUBNAME" ]; then
desc=$(printf "%11s...")
fi
@@ -169,7 +169,14 @@ function ts_has_option {
fi
# or just check the global command line options
- if [[ $ALL =~ ([$' \t\n']|^)--$NAME([$'= \t\n']|$) ]]; then echo yes; fi
+ if [[ $ALL =~ ([$' \t\n']|^)--$NAME([$'= \t\n']|$) ]]; then
+ echo yes
+ return
+ fi
+
+ # or the _global_ env, e.g TS_OPT_parsable="yes"
+ eval local env_opt=\$TS_OPT_${v_name}
+ if [ "$env_opt" = "yes" ]; then echo "yes"; fi
}
function ts_option_argument {
@@ -259,6 +266,8 @@ function ts_init_env {
TS_PARALLEL=$(ts_has_option "parallel" "$*")
TS_KNOWN_FAIL=$(ts_has_option "known-fail" "$*")
TS_SKIP_LOOPDEVS=$(ts_has_option "skip-loopdevs" "$*")
+ TS_PARSABLE=$(ts_has_option "parsable" "$*")
+ [ "$TS_PARSABLE" = "yes" ] || TS_PARSABLE="$TS_PARALLEL"
tmp=$( ts_has_option "memcheck" "$*")
if [ "$tmp" == "yes" -a -f /usr/bin/valgrind ]; then
@@ -309,7 +318,7 @@ function ts_init_subtest {
ts_init_core_subtest_env
TS_NSUBTESTS=$(( $TS_NSUBTESTS + 1 ))
- if [ "$TS_PARALLEL" != "yes" ]; then
+ if [ "$TS_PARSABLE" != "yes" ]; then
[ $TS_NSUBTESTS -eq 1 ] && echo
printf "%16s: %-27s ..." "" "$TS_SUBNAME"
fi
@@ -321,7 +330,7 @@ function ts_init {
local is_fake=$( ts_has_option "fake" "$*")
local is_force=$( ts_has_option "force" "$*")
- if [ "$TS_PARALLEL" != "yes" ]; then
+ if [ "$TS_PARSABLE" != "yes" ]; then
printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC"
fi