summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog161
-rw-r--r--NEWS4
-rw-r--r--THANKS2
-rw-r--r--automake.in9
-rw-r--r--doc/automake.texi8
-rw-r--r--lib/am/dejagnu.am20
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/Makefile.in7
-rwxr-xr-xtests/dejagnu-absolute-builddir.test62
-rwxr-xr-xtests/dejagnu-relative-srcdir.test86
-rwxr-xr-xtests/dejagnu-siteexp-append.test72
-rwxr-xr-xtests/dejagnu-siteexp-extend.test161
-rwxr-xr-xtests/dejagnu-siteexp-useredit.test69
-rw-r--r--tests/list-of-tests.mk5
-rwxr-xr-xtests/silent-lex-gcc.test10
-rwxr-xr-xtests/silent-lex-generic.test10
16 files changed, 615 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index b96e994b8..45914920c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,125 @@
+2011-10-20 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ deps: partially revert commit `v1.11-512-geeee551'
+ This change partly reverts commit "Create subdirs for generated
+ sources even when not dep tracking", of 2011-04-02.
+ That commit had caused the bugs #8485 and #8526. Since we are
+ nearing the bug-fixing automake release 1.11.2, the safest policy
+ at the moment is to just revert the problematic hunks: an older,
+ known bug is better than a regression.
+ * automake.in (handle_single_transform): Don't add a dirstamp
+ dependency, even when $object is derived and lands in a subdir.
+ * tests/Makefile.am (XFAIL_TESTS): Add lex-subobj-nodep.test,
+ remove yacc-dist-nobuild-subdir.test.
+
+2011-10-19 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ dejagnu: allow the package developer to extend site.exp
+ Fixes automake bug#7873.
+ * lib/am/dejagnu.am (site.exp): Depend from the files listed in
+ $(EXTRA_DEJAGNU_SITE_CONFIG), if any. Append their contents to
+ the generated site.exp (still preserving user edits).
+ * doc/automake.texi (Dejagnu Tests): Update.
+ * tests/dejagnu-siteexp-append.test: New test.
+ * tests/dejagnu-siteexp-extend.test: Likewise.
+ * tests/dejagnu-siteexp-useredit.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ * NEWS: Update.
+ Suggestion by Rainer Orth.
+
+2011-10-19 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ dejagnu: ensure 'srcdir' is defined as a relative directory
+ This change fixes automake bug#7833.
+ * lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
+ over calculating and using the absolute path of $(srcdir).
+ * tests/dejagnu-relative-srcdir.test: New test.
+ * tests/dejagnu-absolute-builddir.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ Report by Ian Lance Taylor. Suggestions by Ralf Wildenhues.
+
+2010-12-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Fix testsuite failure of check12.test without DejaGNU.
+ * tests/check12.test: Require runtest.
+
+2010-12-10 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ Extend and improve tests on DejaGnu support.
+ * tests/dejagnu.test: Do not create useless dummy test script.
+ Add trailing `:' command. In heading comments, add reference
+ to ...
+ * tests/check12.test: ... this new "semantic" test, covering
+ concurrent use of dejagnu tests, simple tests and `check-local'
+ target.
+ * tests/dejagnu2.test: Make test more reliable, by avoid weak
+ grepping of make output. Prefer `cat' over `echo' to append
+ to configure.in. Quote literal dots in grep regexps. Prefer
+ `grep -c ...' over `grep ... | wc -l'. Make grepping of
+ automake stderr slightly stricter. Add trailing `:' command.
+ * tests/dejagnu3.test: Prefer `cat' over `echo' to append to
+ configure.in. Check stderr of expected-to-fail "make" call.
+ Remove extra blank lines from Makefile.am.
+ * tests/dejagnu4.test: Prefer `cat' over `echo' to append to
+ configure.in. Prefer `mv -f' over plain `mv' when the target
+ file already exists. Avoid extra mkdir calls by creating more
+ directories at once. Better use of blank lines. Check that
+ the `*.log' and `*.sum' files are created by runtest also when
+ "make check" fails.
+ * tests/dejagnu7.test: Prefer `cat' over `echo' to append to
+ configure.in. Better use of blank lines. Add a trailing `:'
+ command.
+ * tests/dejagnu6.test: Likewise, and give the dejagnu test a
+ more descriptive name.
+ * tests/dejagnu5.test: Likewise. Also, simply define package
+ name to `$me' rather than using a non-obvious sed script to
+ extract it from `AC_INIT', and write the Makefile.am with only
+ one command.
+ * tests/Makefile.am (TESTS): Updated.
+
+2011-10-21 Peter Rosin <peda@lysator.liu.se>
+
+ * THANKS: Fix whitespace issue.
+
+2011-10-25 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ tests: fix spurious failures due to missing 'yywrap()' function
+
+ The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
+ the "lex library" expected to provide a `yywrap' function (function
+ which is required to link most lex-generated programs). On the
+ contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
+ fail, configure declares that no lex library is needed, and simply
+ proceeds with the configuration process -- only for the build to
+ possibly fail later, at make time.
+
+ This behaviour is intended; the Autoconf manual reads:
+ ``You are encouraged to use Flex in your sources, since it is
+ both more pleasant to use than plain Lex and the C source it
+ produces is portable. In order to ensure portability, however,
+ you must either provide a function `yywrap' or, if you don't use
+ it (e.g., your scanner has no `#include'-like feature), simply
+ include a `%noyywrap' statement in the scanner's source.''
+
+ This AC_PROG_LEX behaviour is causing some spurious failures of
+ the Automake testsuite in environments which lack a proper library
+ providing `yywrap' (this happens for example on Fedora-based
+ systems). The proper workaround is to simply provide a fall-back
+ implementation of `yywrap' in our lexers.
+
+ See also partially-overlapping commit `v1.11-871-geb147a1' (from
+ the 'testsuite-work' branch), which was motivated by similar
+ spurious failures experienced when cross-compiling.
+
+ Reported by Jim Meyering:
+ <http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>
+
+ * tests/cond35.test: Provide a dummy `yywrap' function.
+ * tests/lex3.test: Likewise.
+ * tests/lexvpath.test: Likewise.
+ * tests/silent-lex-generic.test: Likewise.
+ * tests/silent-lex-gcc.test: Likewise.
+
2011-10-21 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: more faithful 'installcheck' support in few tests
@@ -8100,11 +8222,6 @@
* tests/libobj20c.test: Likewise.
Report by Ralf Wildenhues.
-2010-12-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-
- Fix testsuite failure of check12.test without DejaGNU.
- * tests/check12.test: Require runtest.
-
2010-12-12 Stefano Lattarini <stefano.lattarini@gmail.com>
Tests defs: more uses of $top_testsrcdir.
@@ -8202,40 +8319,6 @@
* tests/colon3.test: Likewise (but with the sister test being
`colon2.test' here).
-2010-12-10 Stefano Lattarini <stefano.lattarini@gmail.com>
-
- Extend and improve tests on DejaGnu support.
- * tests/dejagnu.test: Do not create useless dummy test script.
- Add trailing `:' command. In heading comments, add reference
- to ...
- * tests/check12.test: ... this new "semantic" test, covering
- concurrent use of dejagnu tests, simple tests and `check-local'
- target.
- * tests/dejagnu2.test: Make test more reliable, by avoid weak
- grepping of make output. Prefer `cat' over `echo' to append
- to configure.in. Quote literal dots in grep regexps. Prefer
- `grep -c ...' over `grep ... | wc -l'. Make grepping of
- automake stderr slightly stricter. Add trailing `:' command.
- * tests/dejagnu3.test: Prefer `cat' over `echo' to append to
- configure.in. Check stderr of expected-to-fail "make" call.
- Remove extra blank lines from Makefile.am.
- * tests/dejagnu4.test: Prefer `cat' over `echo' to append to
- configure.in. Prefer `mv -f' over plain `mv' when the target
- file already exists. Avoid extra mkdir calls by creating more
- directories at once. Better use of blank lines. Check that
- the `*.log' and `*.sum' files are created by runtest also when
- "make check" fails.
- * tests/dejagnu7.test: Prefer `cat' over `echo' to append to
- configure.in. Better use of blank lines. Add a trailing `:'
- command.
- * tests/dejagnu6.test: Likewise, and give the dejagnu test a
- more descriptive name.
- * tests/dejagnu5.test: Likewise. Also, simply define package
- name to `$me' rather than using a non-obvious sed script to
- extract it from `AC_INIT', and write the Makefile.am with only
- one command.
- * tests/Makefile.am (TESTS): Updated.
-
2010-12-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Avoid running installed automake from 'libtool --help'.
diff --git a/NEWS b/NEWS
index bf051cbc6..e5e2eb0fe 100644
--- a/NEWS
+++ b/NEWS
@@ -150,6 +150,10 @@ New in 1.11a:
user; still, the old Makefile.am files that used to define it should
still continue to work as before.
+ - When using DejaGnu-based testsuites, the user can extend the `site.exp'
+ file generated by automake-provided rules by defining the special make
+ variable `$(EXTRA_DEJAGNU_SITE_CONFIG)'.
+
- Support for automatic de-ANSI-fication has been removed.
Bugs fixed in 1.11a:
diff --git a/THANKS b/THANKS
index 5156a3d50..5276b1819 100644
--- a/THANKS
+++ b/THANKS
@@ -84,7 +84,7 @@ Diab Jerius djerius@cfa.harvard.edu
Didier Cassirame faded@free.fr
Dieter Baron dillo@stieltjes.smc.univie.ac.at
Dieter Jurzitza DJurzitza@harmanbecker.com
-Дилян Палаузов dilyan.palauzov@aegee.org
+Дилян Палаузов dilyan.palauzov@aegee.org
Dmitry Mikhin dmitrym@acres.com.au
Dmitry V. Levin ldv@altlinux.org
Doug Evans devans@cygnus.com
diff --git a/automake.in b/automake.in
index b8fea3c7a..c93437be8 100644
--- a/automake.in
+++ b/automake.in
@@ -1922,15 +1922,6 @@ sub handle_single_transform ($$$$$%)
# derived from is not.
&push_dist_common ($object)
unless ($topparent =~ /^(?:nobase_)?nodist_/);
-
- # If resulting derived source is in a subdir, we need to make
- # sure the subdir exists at build time.
- if ($object =~ /\//)
- {
- my $dirstamp = require_build_directory_maybe ($object);
- depend ($object, $dirstamp)
- if ($dirstamp);
- }
next;
}
diff --git a/doc/automake.texi b/doc/automake.texi
index 5fcb37173..736b66e12 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -9834,6 +9834,14 @@ not the place where the test suite author should define new variables:
this should be done elsewhere in the real test suite code.
Especially, @file{site.exp} should not be distributed.
+Still, if the package author has legitimate reasons to extend
+@file{site.exp} at @command{make} time, he can do so by defining
+the variable @code{EXTRA_DEJAGNU_SITE_CONFIG}; the files listed
+there will be considered @file{site.exp} prerequisites, and their
+content will be appended to it (in the same order in which they
+appear in @code{EXTRA_DEJAGNU_SITE_CONFIG}). Note that files are
+@emph{not} distributed by default.
+
For more information regarding DejaGnu test suites, see @ref{Top, , ,
dejagnu, The DejaGnu Manual}.
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 37f34ca44..010504f39 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
.PHONY: check-DEJAGNU
check-DEJAGNU: site.exp
## Life is easiest with an absolute srcdir, so do that.
- srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ srcdir='$(srcdir)'; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
## Allow this to work when expect and DejaGnu are in tree.
## Only required when --cygnus in force.
@@ -72,12 +72,12 @@ check-DEJAGNU: site.exp
## Note that in the rule we don't directly generate site.exp to avoid
## the possibility of a corrupted site.exp if make is interrupted.
## Jim Meyering has some useful text on this topic.
-site.exp: Makefile
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
- @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
## Quote the *_alias variables because they might be empty.
?BUILD? @echo 'set build_alias "$(build_alias)"' >>site.tmp
@@ -86,9 +86,17 @@ site.exp: Makefile
?HOST? @echo 'set host_triplet $(host_triplet)' >>site.tmp
?TARGET? @echo 'set target_alias "$(target_alias)"' >>site.tmp
?TARGET? @echo 'set target_triplet $(target_triplet)' >>site.tmp
- @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
- @test ! -f site.exp || \
- sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+## Allow the package author to extend site.exp.
+ @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+ echo "## Begin content included from file $$f. Do not modify. ##" \
+ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+ && echo "## End content included from file $$f. ##" \
+ || exit 1; \
+ done >> site.tmp
+ @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+ @if test -f site.exp; then \
+ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+ fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1e4b6d544..bc6564f74 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -47,7 +47,7 @@ gcj6.test \
override-conditional-2.test \
java-nobase.test \
pr8365-remake-timing.test \
-yacc-dist-nobuild-subdir.test \
+lex-subobj-nodep.test \
vala-vpath.test \
txinfo5.test
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3226126a4..5a34c995a 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -321,7 +321,7 @@ gcj6.test \
override-conditional-2.test \
java-nobase.test \
pr8365-remake-timing.test \
-yacc-dist-nobuild-subdir.test \
+lex-subobj-nodep.test \
vala-vpath.test \
txinfo5.test
@@ -609,6 +609,11 @@ dejagnu4.test \
dejagnu5.test \
dejagnu6.test \
dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
+dejagnu-siteexp-append.test \
+dejagnu-siteexp-extend.test \
+dejagnu-siteexp-useredit.test \
depacl2.test \
depcomp.test \
depcomp2.test \
diff --git a/tests/dejagnu-absolute-builddir.test b/tests/dejagnu-absolute-builddir.test
new file mode 100755
index 000000000..ad9578f6d
--- /dev/null
+++ b/tests/dejagnu-absolute-builddir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'objdir' defined (as a TCL variable)
+# to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = tcl.test/tcl.exp
+END
+
+mkdir tcl.test
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+ pass "test_tcl_objdir"
+} else {
+ fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-relative-srcdir.test b/tests/dejagnu-relative-srcdir.test
new file mode 100755
index 000000000..8a70d58e8
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to a relative path
+# (both as TCL variable and as environment variable).
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value. Thanks to Ian Lance Taylor for the
+# suggestion.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^\.\.?$" $env_srcdir ] } {
+ pass "test_env_src"
+} else {
+ fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^\.\.?$" $srcdir ] } {
+ pass "test_tcl_src"
+} else {
+ fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+ pass "test_tcl_orig_src"
+} else {
+ fail "test_tcl_orig_src"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-siteexp-append.test b/tests/dejagnu-siteexp-append.test
new file mode 100755
index 000000000..7bd34edb4
--- /dev/null
+++ b/tests/dejagnu-siteexp-append.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the files in $(EXTRA_DEJAGNU_SITE_CONFIG) get appended to
+# site.exp in the same order in which they're listed in that variable.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tool
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE site.exp
+sed '/^##.*##$/d' site.exp > expected
+
+cat > foo.exp << 'END'
+foo1
+foo2
+foo3
+END
+
+cat foo.exp - >> expected << 'END'
+BAR 1
+# foo
+BAR 2
+END
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG = foo.exp bar.exp
+bar.exp:
+ @(echo 'BAR 1' && echo '# foo' && echo 'BAR 2') > $@
+END
+
+$AUTOMAKE Makefile
+./config.status Makefile
+
+rm -f site.exp
+$MAKE site.exp
+sed '/^##.*##$/d' site.exp > obtained
+
+cat expected
+cat site.exp
+
+diff expected obtained
+
+:
diff --git a/tests/dejagnu-siteexp-extend.test b/tests/dejagnu-siteexp-extend.test
new file mode 100755
index 000000000..591267e5f
--- /dev/null
+++ b/tests/dejagnu-siteexp-extend.test
@@ -0,0 +1,161 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the developer can extend the site.exp generated by the
+# automake-generated Makefile.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+write_check_for ()
+{
+ echo "send_user \"$1: \$$1\\n\""
+ cat << END
+if { \$$1 == "/$1/" } {
+ pass "test_$1"
+} else {
+ fail "test_$1"
+}
+END
+}
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tool
+
+EXTRA_DIST = tool.test/tool.exp
+
+EXTRA_DEJAGNU_SITE_CONFIG = foo.exp
+EXTRA_DIST += foo.exp
+END
+
+echo 'set foo "/foo/"' > foo.exp
+
+mkdir tool.test
+write_check_for foo > tool.test/tool.exp
+cat tool.test/tool.exp
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+cat foo.exp
+cat site.exp
+grep 'PASS: test_foo' tool.sum
+
+write_check_for bar >> tool.test/tool.exp
+write_check_for baz >> tool.test/tool.exp
+cat tool.test/tool.exp
+
+# Ensure that foo.exp will be newer than site.exp, which will
+# thus have to be remade.
+$sleep
+# With this, below we'll also check that settings in files coming later in
+# $(EXTRA_DEJAGNU_SITE_CONFIG) override those in files coming earlier.
+cat >> foo.exp <<'END'
+set bar "/foo/"
+set baz "/foo/"
+set qux "/foo/"
+END
+
+$MAKE check && { cat site.exp; Exit 1; }
+grep 'PASS: test_foo' tool.sum
+grep 'FAIL: test_bar' tool.sum
+grep 'FAIL: test_baz' tool.sum
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG += bar bar.dir/bar
+EXTRA_DIST += bar
+DISTCLEANFILES = bar.dir/bar
+bar.dir/bar:
+ test -d bar.dir || mkdir bar.dir
+ echo 'set baz "/baz/"' > $@
+END
+
+echo 'set bar "/bar/"' > bar
+# This will allow us to check one more time that settings in files
+# coming later in $(EXTRA_DEJAGNU_SITE_CONFIG) override those in
+# files coming earlier.
+echo 'set baz "/xyz/"' >> bar
+
+# Ensure that the Makefile will be newer than site.exp, which will
+# thus have to be remade.
+$sleep
+$AUTOMAKE Makefile
+./config.status Makefile
+
+$MAKE check || { cat site.exp; Exit 1; }
+cat site.exp
+cat bar.dir/bar
+$FGREP '/bar/' site.exp
+$FGREP '/baz/' site.exp
+grep 'PASS: test_foo' tool.sum
+grep 'PASS: test_bar' tool.sum
+grep 'PASS: test_baz' tool.sum
+
+# Check that the features we're testing behave well in VPATH builds.
+$MAKE distcheck
+
+# Check that the user can edit the site.exp file, and that his edits
+# are retained.
+write_check_for zardoz >> tool.test/tool.exp
+cat tool.test/tool.exp
+echo 'set zardoz "/zardoz/"' >> site.exp
+
+$MAKE check
+cat site.exp
+grep 'PASS: test_zardoz' tool.sum
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG += quux.exp
+quux.exp:
+ echo 'set zardoz "/quux/"' > $@
+END
+
+# Ensure that the Makefile will be newer than on site.exp, which will
+# thus have to be remade.
+$sleep
+$AUTOMAKE Makefile
+./config.status Makefile
+grep 'zardoz.*/quux/' Makefile
+
+$MAKE site.exp
+cat site.exp
+cat quux.exp
+grep 'zardoz.*/quux/' site.exp
+
+$MAKE check
+grep 'PASS: test_zardoz' tool.sum
+grep 'zardoz: /zardoz/' tool.log
+grep 'zardoz.*quux' tool.log && Exit 1
+
+# Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed
+# by default.
+$MAKE distdir
+ls -l $me-1.0
+test ! -r $me-1.0/bar.dir/bar
+test ! -r $me-1.0/quux.exp
+
+:
diff --git a/tests/dejagnu-siteexp-useredit.test b/tests/dejagnu-siteexp-useredit.test
new file mode 100755
index 000000000..a51bc407a
--- /dev/null
+++ b/tests/dejagnu-siteexp-useredit.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the user can edit the Makefile-generated site.exp, and
+# have its edits survive to the remaking of that file.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = foo
+END
+
+# Deliberately select a variable defined automatically by
+# the Makefile-generated site.exp.
+mkdir foo.test
+cat > foo.test/foo.exp << 'END'
+send_user "objdir: $objdir\n"
+set pipe "|"
+if { $objdir == "${pipe}objdir${pipe}" } {
+ pass "test_obj"
+} else {
+ fail "test_obj"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE site.exp
+echo 'set objdir "|objdir|"' >> site.exp
+cat site.exp
+$sleep
+touch Makefile
+$MAKE site.exp
+cat site.exp
+is_newest site.exp Makefile # Sanity check.
+grep '|objdir|' site.exp
+test `grep -c '|objdir|' site.exp` -eq 1
+
+# We can done a "more semantic" check if DejaGnu is available.
+if runtest SOMEPROGRAM=someprogram --version; then
+ $MAKE check
+ grep 'PASS: test_obj' foo.sum
+fi
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index ff7b39bbc..d8473e368 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -285,6 +285,11 @@ dejagnu4.test \
dejagnu5.test \
dejagnu6.test \
dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
+dejagnu-siteexp-append.test \
+dejagnu-siteexp-extend.test \
+dejagnu-siteexp-useredit.test \
depacl2.test \
depcomp.test \
depcomp2.test \
diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test
index e01fd72ac..5ab5ecd9e 100755
--- a/tests/silent-lex-gcc.test
+++ b/tests/silent-lex-gcc.test
@@ -56,14 +56,8 @@ cat > foo.l <<'EOF'
.
%%
/* Avoid possible link errors. */
-int yywrap (void)
-{
- return 1;
-}
-int main (void)
-{
- return 0;
-}
+int yywrap (void) { return 1; }
+int main (void) { return 0; }
EOF
cp foo.l sub/bar.l
diff --git a/tests/silent-lex-generic.test b/tests/silent-lex-generic.test
index 7d2b197db..219d1e709 100755
--- a/tests/silent-lex-generic.test
+++ b/tests/silent-lex-generic.test
@@ -56,14 +56,8 @@ cat > foo.l <<'EOF'
.
%%
/* Avoid possible link errors. */
-int yywrap (void)
-{
- return 1;
-}
-int main (void)
-{
- return 0;
-}
+int yywrap (void) { return 1; }
+int main (void) { return 0; }
EOF
cp foo.l sub/bar.l