[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: testsuite -C dir
From: |
Eric Blake |
Subject: |
Re: testsuite -C dir |
Date: |
Mon, 28 Jan 2008 22:54:32 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paolo Bonzini on 1/28/2008 2:01 PM:
|
|> I don't see how to solve this without parsing the argument list twice
|> (scanning for -C first), or somehow deferring the setting of the
|> variables which are passed on the command line.
|
| Setting a variable with the (escaped, semicolon-separated) command line
| arguments and then eval'ing it should work.
Which we already have, thanks to passing the same information onto debug
scripts. Thanks for the idea. I also caused another regression; when
moving the code that source atlocal, I inadvertently stripped the leading
./, so atlocal wasn't being sourced if the current directory was not in
the path in absolute form.
There was another bug I found in the process: './testsuite =' made the
shell warn about =: command not found, then the subsequent 'export ' dumps
the entire environment. Committing the following:
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHnr+X84KuGfSFAYARAuhNAJ4vsEdfqmjR4Xf5fvoJt5P903TIQgCeJH4P
VLKCuV+mN+ACAtfRo6lPMD8=
=ZoiN
-----END PGP SIGNATURE-----
>From 372769ca9eb0c5db10aac8173906116b5a260356 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 28 Jan 2008 22:42:17 -0700
Subject: [PATCH] Fix regression in handling VAR=VALUE arguments to testsuite.
* lib/autotest/general.m4 (AT_INIT) <PARSE_ARGS_END>: Detect
leading = as invalid. Defer use of command-line variable
assignments...
<PREPARE_TESTS>: ...here, after atconfig has been sourced. Fix
regression in sourcing files.
* tests/autotest.at (Using atlocal): New test to catch this.
(Debugging a successful test, Choosing where testsuite is run):
Use correct shell.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 11 ++++++++++
lib/autotest/general.m4 | 13 +++++++----
tests/autotest.at | 51 +++++++++++++++++++++++++++++++++++++++-------
3 files changed, 62 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a3f52fe..42da03c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-01-28 Eric Blake <address@hidden>
+ Fix regression in handling VAR=VALUE arguments to testsuite.
+ * lib/autotest/general.m4 (AT_INIT) <PARSE_ARGS_END>: Detect
+ leading = as invalid. Defer use of command-line variable
+ assignments...
+ <PREPARE_TESTS>: ...here, after atconfig has been sourced. Fix
+ regression in sourcing files.
+ * tests/autotest.at (Using atlocal): New test to catch this.
+ (Debugging a successful test, Choosing where testsuite is run):
+ Use correct shell.
+ Reported by Ralf Wildenhues.
+
Document grep peculiarity.
* doc/autoconf.texi (Limitations of Usual Tools) <grep>: Document
BSD behavior on binary input.
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 662f2cb..25b2d36 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -569,12 +569,12 @@ m4_divert_push([PARSE_ARGS_END])dnl
*=*)
at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
+ test "x$at_envvar" = "x" ||
+ expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
AS_ERROR([invalid variable name: $at_envvar])
at_value=`AS_ECHO(["$at_optarg"]) | sed "s/'/'\\\\\\\\''/g"`
- eval "$at_envvar='$at_value'"
+ # Export now, but save eval for later and for debug scripts.
export $at_envvar
- # Propagate to debug scripts.
at_debug_args="$at_debug_args $at_envvar='$at_value'"
;;
@@ -708,16 +708,19 @@ if $at_change_dir ; then
at_dir=`pwd`
fi
-# Load the config file.
+# Load the config files for any default variable assignments.
for at_file in atconfig atlocal
do
test -r $at_file || continue
- . $at_file || AS_ERROR([invalid content: $at_file])
+ . ./$at_file || AS_ERROR([invalid content: $at_file])
done
# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
: ${at_top_build_prefix=$at_top_builddir}
+# Perform any assignments requested during argument parsing.
+eval $at_debug_args
+
# atconfig delivers names relative to the directory the test suite is
# in, but the groups themselves are run in testsuite-dir/group-dir.
if test -n "$at_top_srcdir"; then
diff --git a/tests/autotest.at b/tests/autotest.at
index 4fbdba2..2fb36e5 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -359,7 +359,7 @@ AT_CHECK_AT_TEST([Debugging a successful test],
[AT_CHECK([:])], [], [], [], [ignore],
[# Without options, when all tests pass, no test directory should exist.
AT_CHECK([test -d micro-suite.dir/1 && exit 42
- ./micro-suite -d 1], [], [ignore], [ignore])
+ $CONFIG_SHELL ./micro-suite -d 1], [], [ignore], [ignore])
# Running with -d should leave a reproducible test group.
# Also, running the test script from the test group locks the
# directory from removal on some platforms; the script should still be
@@ -396,26 +396,61 @@ AT_CHECK([(cd micro-suite.dir/1 && ./run MY_VAR='one
space')],
])
+# Setting default variable values via atlocal.
+AT_CHECK_AT_TEST([Using atlocal],
+ [AT_CHECK([test "x$MY_VAR" = xset || exit 42])],
+ [], [1], [ignore], [ignore], [
+dnl check that command line can set variable
+AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR=set], [0], [ignore])
+dnl check that command line overrides environment
+AT_CHECK([MY_VAR=set $CONFIG_SHELL ./micro-suite MY_VAR=unset],
+ [1], [ignore], [ignore])
+dnl check that atlocal can give it a default
+AT_CHECK([cat <<EOF >atlocal
+MY_VAR=set
+export MY_VAR
+dnl Also populate enough of atlocal to do what atconfig normally does.
+at_testdir=.
+abs_builddir=`pwd`
+at_srcdir=.
+abs_srcdir=`pwd`
+at_top_srcdir=.
+abs_top_srcdir=`pwd`
+at_top_build_prefix=
+abs_top_builddir=`pwd`
+EOF
+])
+AT_CHECK([$CONFIG_SHELL ./micro-suite], [0], [ignore])
+dnl check that atlocal overrides environment
+AT_CHECK([MY_VAR=unset $CONFIG_SHELL ./micro-suite], [0], [ignore])
+dnl check that command line overrides atlocal
+AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR=], [1], [ignore], [ignore])
+dnl check that syntax error is detected
+AT_CHECK([$CONFIG_SHELL ./micro-suite =], [1], [], [ignore], [ignore])
+])
+
+
# Controlling where the testsuite is run.
AT_CHECK_AT_TEST([Choosing where testsuite is run],
[AT_CHECK([:])], [], [], [], [], [
dnl AT_CHECK_AT_TEST tests the default of running in `.'.
AT_CHECK([rm micro-suite.log && mkdir sub1 sub2])
dnl check specifying a different relative path to run in.
-AT_CHECK([./micro-suite -C sub1], [0], [ignore], [])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1], [0], [ignore], [])
AT_CHECK([test -f micro-suite.log], [1])
AT_CHECK([test -f sub1/micro-suite.log], [0])
dnl check specifying an absolute path to run in.
-AT_CHECK([./micro-suite --directory="`pwd`/sub2"], [0], [ignore], [])
+AT_CHECK([$CONFIG_SHELL ./micro-suite --directory="`pwd`/sub2"],
+ [0], [ignore], [])
AT_CHECK([test -f micro-suite.log], [1])
AT_CHECK([test -f sub2/micro-suite.log], [0])
dnl check for failure detection with bad, missing, or empty directory.
-AT_CHECK([./micro-suite -C nonesuch], [1], [ignore], [ignore])
-AT_CHECK([./micro-suite -C ''], [1], [ignore], [ignore])
-AT_CHECK([./micro-suite -C -], [1], [ignore], [ignore])
-AT_CHECK([./micro-suite -C], [1], [ignore], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch], [1], [ignore], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C ''], [1], [ignore], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C -], [1], [ignore], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C], [1], [ignore], [ignore])
dnl check that --help overrides bad directory selection.
-AT_CHECK([./micro-suite -C nonesuch --help], [0], [ignore], [])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch --help], [0], [ignore], [])
])
--
1.5.3.8
- testsuite -C dir, Eric Blake, 2008/01/26
- Re: testsuite -C dir, Paolo Bonzini, 2008/01/27
- Re: testsuite -C dir, Paul Eggert, 2008/01/27
- Re: testsuite -C dir, Eric Blake, 2008/01/28
- Re: testsuite -C dir, Ralf Wildenhues, 2008/01/28
- Re: testsuite -C dir, Eric Blake, 2008/01/28
- Re: testsuite -C dir, Ralf Wildenhues, 2008/01/28
- Re: testsuite -C dir, Paolo Bonzini, 2008/01/28
- Re: testsuite -C dir,
Eric Blake <=
- Re: testsuite -C dir, Paolo Bonzini, 2008/01/29
- Re: testsuite -C dir, Eric Blake, 2008/01/29
- Re: testsuite -C dir, Paolo Bonzini, 2008/01/29
- Re: testsuite -C dir, Eric Blake, 2008/01/29
- Re: testsuite -C dir, Eric Blake, 2008/01/29
- Re: testsuite -C dir, Ralf Wildenhues, 2008/01/29
- Re: testsuite -C dir, Eric Blake-1, 2008/01/29
- Re: testsuite -C dir, Ralf Wildenhues, 2008/01/29
- Re: testsuite -C dir, Ralf Wildenhues, 2008/01/29
- Re: testsuite -C dir, Eric Blake-1, 2008/01/29