summaryrefslogtreecommitdiffstats
path: root/tests/shell/run-tests.sh
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-09-06 13:52:08 +0200
committerFlorian Westphal <fw@strlen.de>2023-09-07 19:35:20 +0200
commit4649d4fba8f0c6a531f6cb687a152fd7655a37d6 (patch)
treece6c5929d16914a9696630d06b427ae69957c22b /tests/shell/run-tests.sh
parent5da2ad76337d8709f4ae842a37fde400fa5ad5ce (diff)
tests/shell: normalize boolean configuration in environment variables
Previously, we would honor "y" as opt-in, and all other values meant false. - accept alternatives to "y", like "1" or "true". - normalize the value, to either be "y" or "n". Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/run-tests.sh')
-rwxr-xr-xtests/shell/run-tests.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 65aa041f..905fa0c1 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -13,6 +13,17 @@ msg_info() {
echo "I: $1"
}
+bool_y() {
+ case "$1" in
+ y|Y|yes|Yes|YES|1|true|True|TRUE)
+ printf y
+ ;;
+ *)
+ printf n
+ ;;
+ esac
+}
+
usage() {
echo " $0 [OPTIONS] [TESTS...]"
echo
@@ -57,10 +68,10 @@ if [ "${1}" != "run" ]; then
fi
shift
-VERBOSE="$VERBOSE"
-DUMPGEN="$DUMPGEN"
-VALGRIND="$VALGRIND"
-KMEMLEAK="$KMEMLEAK"
+VERBOSE="$(bool_y "$VERBOSE")"
+DUMPGEN="$(bool_y "$DUMPGEN")"
+VALGRIND="$(bool_y "$VALGRIND")"
+KMEMLEAK="$(bool_y "$KMEMLEAK")"
DO_LIST_TESTS=
TESTS=()