From 855f7f06507f5b2f547da054898ae751bec888bb Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Sat, 5 Mar 2016 15:40:57 +0100 Subject: 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 --- .travis-functions.sh | 1 + tests/functions.sh | 17 +++++++++++++---- tests/run.sh | 22 ++++++++-------------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.travis-functions.sh b/.travis-functions.sh index 3315a9159..3c1855951 100755 --- a/.travis-functions.sh +++ b/.travis-functions.sh @@ -15,6 +15,7 @@ fi # travis docs say we get 1.5 CPUs MAKE="make -j2" DUMP_CONFIG_LOG="short" +export TS_OPT_parsable="yes" function xconfigure { 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 diff --git a/tests/run.sh b/tests/run.sh index 03cd9f5c2..aad3acb0d 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -43,20 +43,14 @@ function find_test_scripts() while [ -n "$1" ]; do case "$1" in - --force) - OPTS="$OPTS --force" - ;; - --fake) - OPTS="$OPTS --fake" - ;; - --memcheck) - OPTS="$OPTS --memcheck" - ;; - --verbose) - OPTS="$OPTS --verbose" - ;; - --skip-loopdevs) - OPTS="$OPTS --skip-loopdevs" + --force |\ + --fake |\ + --memcheck |\ + --verbose |\ + --skip-loopdevs |\ + --parsable) + # these options are simply forwarded to the test scripts + OPTS="$OPTS $1" ;; --nonroot) if [ $(id -ru) -eq 0 ]; then -- cgit v1.2.3-55-g7522