[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {maint} runtest: better command line API
From: |
Stefano Lattarini |
Subject: |
[FYI] {maint} runtest: better command line API |
Date: |
Thu, 3 Jan 2013 13:18:10 +0100 |
* 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 <address@hidden>
---
t/ax/runtest.in | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
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
--
1.8.1.rc3.27.g3b73c7d
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {maint} runtest: better command line API,
Stefano Lattarini <=