summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-02 15:36:53 +0100
committerThomas Haller <thaller@redhat.com>2017-03-02 16:08:54 +0100
commita81b604cc1e9d8eb5c91c581129c9b74c843253e (patch)
treee86f4607399962e37ab3aeb021b1550ff800434c
parent61f7dd7284e47981794e3a28ca821c3ca539704c (diff)
downloadNetworkManager-a81b604cc1e9d8eb5c91c581129c9b74c843253e.tar.gz
tests: accept trailing arguments to "tools/run-nm-test.sh"
Previously, the test runner would only accept leading options, an optional "--" separator, followed by "$TEST" and optional arguments for the test. Like ./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh That is annoying, because to toggle an option you have to seek the curser in the before the test name. Now, accept a "--test" option, so that the above can be done with trialing arguments: ./tools/run-nm-test.sh -t src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -m However, the arguments for the tests still must come last: ./tools/run-nm-test.sh -m [--] src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -p /settings/plugins/ifcfg-rh/bridge/write-master ./tools/run-nm-test.sh -t src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -m [--] -p /settings/plugins/ifcfg-rh/bridge/write-master
-rwxr-xr-xtools/run-nm-test.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh
index b631c76426..5848d0a061 100755
--- a/tools/run-nm-test.sh
+++ b/tools/run-nm-test.sh
@@ -94,8 +94,9 @@ else
else
NMTST_LIBTOOL=($NMTST_LIBTOOL --mode=execute)
fi
- for a in "$@"; do
- case "$a" in
+ unset TEST
+ while test $# -gt 0; do
+ case "$1" in
"--launch-dbus")
NMTST_LAUNCH_DBUS=1
shift
@@ -120,6 +121,11 @@ else
NMTST_USE_VALGRIND=0
shift;
;;
+ "--test"|-t)
+ shift
+ TEST="$1"
+ shift
+ ;;
"--")
shift
break
@@ -131,7 +137,9 @@ else
done
# we support calling the script directly. In this case,
# only pass the path to the test to run.
- TEST="$1"; shift
+ if test -z "${TEST+x}"; then
+ TEST="$1"; shift
+ fi
if [[ -z "${NMTST_SUPPRESSIONS+x}" ]]; then
NMTST_SUPPRESSIONS="$SCRIPT_PATH/../valgrind.suppressions"
fi