diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-01-03 13:16:14 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-01-03 13:16:14 +0100 |
commit | a59ac344dfe05e36a69cb70c49750d81b02a06ed (patch) | |
tree | a259ad778c08970302e939c9b9f25d3983b2ea16 /t/ax/runtest.in | |
parent | da0dfbe7715c8f9558d7ee212b7eb8aac852a2ec (diff) | |
download | automake-a59ac344dfe05e36a69cb70c49750d81b02a06ed.tar.gz |
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 <stefano.lattarini@gmail.com>
Diffstat (limited to 't/ax/runtest.in')
-rw-r--r-- | t/ax/runtest.in | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/ax/runtest.in b/t/ax/runtest.in index 57d16a0db..57ce889c1 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 |