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
This commit is contained in:
Thomas Haller 2017-03-02 15:36:53 +01:00
parent 61f7dd7284
commit a81b604cc1

View file

@ -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