From: Stefano Lattarini Date: Thu, 3 Jan 2013 12:16:14 +0000 (+0100) Subject: runtest: better command line API X-Git-Tag: v1.13b~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a59ac344dfe05e36a69cb70c49750d81b02a06ed;p=platform%2Fupstream%2Fautomake.git runtest: better command line API * t/ax/runtest.in: Accept options '-k' and '--keep-testdirs' (same as exporting '$keep_testdirs' to "yes"). To improve compatibility with the "make check" interface, allow environment variables to be passes on the command line. Minor adjustments while at it. Signed-off-by: Stefano Lattarini --- diff --git a/t/ax/runtest.in b/t/ax/runtest.in index 57d16a0..57ce889 100644 --- a/t/ax/runtest.in +++ b/t/ax/runtest.in @@ -58,6 +58,7 @@ for v in \ done unset v +xecho () { printf '%s\n' "$*"; } error () { echo "$0: $*" >&2; exit 255; } # Some shell flags should be passed over to the test scripts. @@ -65,7 +66,8 @@ shell_opts= while test $# -gt 0; do case $1 in --help) - echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]" + xecho "Usage: $0 [--shell=PATH] [-k] [SHELL-OPTIONS]" \ + "[VAR=VALUE ...] TEST [TEST-OPTIONS]" exit $? ;; --shell) @@ -81,9 +83,17 @@ while test $# -gt 0; do shell_opts="$shell_opts -o $2" shift ;; + -k|--keep-testdir|--keep-testdirs) + keep_testdirs=yes; export keep_testdirs;; -*) # Assume it is an option to pass through to the shell. shell_opts="$shell_opts $1";; + *=*) + var=${1%%=*} val=${1#*=} + xecho "$var" | LC_ALL=C grep '^[a-zA-Z_][a-zA-Z0-9_]*$' >/dev/null \ + || error "'$var': invalid variable name" + eval "$var=\$val && export $var" || exit 1 + ;; *) break;; esac