From eb07a5811b8df9ef3f94fb98adccf0f7d74f8559 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 25 Jul 2012 12:56:43 +0200 Subject: [PATCH] runtest: support passing options over to the shell * runtest.in: Here. Also, support '--help' to display a nice help screen. Signed-off-by: Stefano Lattarini --- runtest.in | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/runtest.in b/runtest.in index 31f8e012c..3c6981c2f 100644 --- a/runtest.in +++ b/runtest.in @@ -28,12 +28,26 @@ set -e; set -u error () { echo "$0: $*" >&2; exit 255; } # Some shell flags should be passed over to the test scripts. -#while test $# -gt 0; do -# case $1 in -# --help) echo "Usage: $0 [SHELL-OPTIONS] TEST [TEST-OPTIONS]"; exit $?;; -# -*) -# esac -#done +shell_opts= +while test $# -gt 0; do + case $1 in + --help) + echo "Usage: $0 [SHELL-OPTIONS] TEST [TEST-OPTIONS]" + exit $? + ;; + -o) + test $# -gt 1 || error "missing argument for option '-o'" + shell_opts="-o $2" + shift + ;; + -*) + # Assume it is an option to pass through to the shell. + shell_opts=$1;; + *) + break;; + esac + shift +done test $# -gt 0 || error "missing argument" @@ -58,5 +72,5 @@ case $tst in ;; esac -wrapper "$AM_TEST_RUNNER_SHELL" "$tst" "$@" +wrapper "$AM_TEST_RUNNER_SHELL" $shell_opts "$tst" "$@" error "dead code reached" -- 2.11.4.GIT