*=*)
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'"
;;
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
[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
])
+# 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], [])
])