summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index e76408baf..0366f163b 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -97,6 +97,21 @@ function ts_log {
function ts_has_option {
NAME="$1"
ALL="$2"
+
+ # user may set options by env for a single test or whole component
+ # e.g. TS_OPT_ipcs_limits2_fake="yes" or TS_OPT_ipcs_fake="yes"
+ eval local env_opt_test=\$TS_OPT_${TS_COMPONENT}_${TS_TESTNAME}_${NAME}
+ eval local env_opt_comp=\$TS_OPT_${TS_COMPONENT}_${NAME}
+ if [ "$env_opt_test" = "yes" \
+ -o "$env_opt_comp" = "yes" -a "$env_opt_test" != "no" ]; then
+ echo "yes"
+ return
+ elif [ "$env_opt_test" = "no" \
+ -o "$env_opt_comp" = "no" -a "$env_opt_test" != "yes" ]; then
+ return
+ fi
+
+ # or just check the global command line options
echo -n $ALL | sed 's/ //g' | awk 'BEGIN { FS="="; RS="--" } /('$NAME'$|'$NAME'=)/ { print "yes" }'
}