From a81b604cc1e9d8eb5c91c581129c9b74c843253e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 2 Mar 2017 15:36:53 +0100 Subject: 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 --- tools/run-nm-test.sh | 14 +++++++++++--- 1 file 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 -- cgit v1.2.1