automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {testsuite-work} installcheck: support it in our own testsuite


From: Stefano Lattarini
Subject: [PATCH] {testsuite-work} installcheck: support it in our own testsuite
Date: Mon, 5 Sep 2011 11:50:43 +0200

I will push this in a couple of days; reviews are welcome.

* tests/defs-static.in ($am_running_installcheck): New variable.
Initialize it to a default of "no", and sanity-check its value.
($am_datadir, $am_docdir, $am_m4dir, $am_bindir, $am_scriptdir,
$am_pkgvdir): New variables, initialized from AC_SUBST'ed values
which are adaptively chosen depending on whether the testsuite
is running in "simple" mode or in "installcheck" mode.
($MISSING): Remove, it's not really required by the testsuite.
($PATH): Update using `$am_bindir', not `$testbuilddir'.
* Makefile.am (installcheck-local): New target.
* lib/Automake/tests/Makefile.am (installcheck-local): New target.
(AM_TESTS_ENVIRONMENT, AM_PL_LOG_FLAGS): Adaptively choose the
`-I' flags for perl based on whether the tests are being run by
"make check" or "make installcheck".
* tests/Makefile.am (installcheck-local): New target.
(defs-static): Generate it at make time, not at configure time;
done with the help of ...
(do_subst): ... this new macro.
(EXTRA_DIST): Explicitly distribute `defs-static.in'.
(CLEANFILES): Remove `defs-static'.
* configure.ac (AC_CONFIG_FILES): Remove `tests/defs-static'.
(AC_SUBST): Substitute also `m4datadir', `scriptdir' and `amdir'
to proper values.
* m4/Makefile.am (m4datadir): Don't explicitly define anymore.
* lib/Makefile.am (scriptdir): Likewise.
* lib/am/Makefile.am (amdir): Likewise.
* tests/amhello-binpkg.test: Use new `$am_...dir' variables,
instead of hard-coding values with $testsrcdir and $testbuilddir,
to test more faithfully under "make installcheck".
* tests/amhello-cflags.test: Likewise.
* tests/amhello-cross-compile.test: Likewise.
* tests/ansi2knr-no-more.test: Likewise.
* tests/autodist-stamp-vti.test: Likewise.
* tests/auxdir.test: Likewise.
* tests/check2.test: Likewise.
* tests/copy.test: Likewise.
* tests/multlib.test: Likewise.
* tests/obsolete.test: Likewise.
* tests/parallel-tests-interrupt.test: Likewise.
* tests/repeated-options.test: Likewise.
* tests/suffix5.test: Likewise.
* tests/tap-doc2.test: Likewise.
* tests/txinfo22.test: Likewise.
* tests/vtexi3.test: Likewise.
* tests/defs: Likewise.  Also, print the values of `$using_tap'
and `$am_running_installcheck', to simplify debugging, and do
some related code movings and tweakings.
* tests/aclocal3.test: Update to avoid possible spurious failures
when running under "make installcheck".
* tests/warnings-unknown.test: Likewise.
* tests/location.test: Likewise, and improve debugging input since
we are at it.
* tests/aclocal.test: Skip a check that does not (yet) work
under "make installcheck".
* tests/acloca10.test: Skip when doing a "make installcheck".
* tests/acloca18.test: Likewise.
* tests/dirlist.test: Likewise.
* tests/dirlist2.test: Likewise.
* tests/README: Update.
---
 ChangeLog                           |   62 ++++++++++++++++++++++++++++++
 Makefile.am                         |    4 ++
 Makefile.in                         |   18 ++++++--
 configure                           |   13 +++++-
 configure.ac                        |    5 +-
 doc/Makefile.in                     |    3 +
 lib/Automake/Makefile.in            |    3 +
 lib/Automake/tests/Makefile.am      |   15 ++++++-
 lib/Automake/tests/Makefile.in      |   29 ++++++++++----
 lib/Makefile.am                     |    1 -
 lib/Makefile.in                     |    4 +-
 lib/am/Makefile.am                  |    2 -
 lib/am/Makefile.in                  |    4 +-
 m4/Makefile.am                      |    4 +-
 m4/Makefile.in                      |    6 ++-
 tests/Makefile.am                   |   47 +++++++++++++++++++++++
 tests/Makefile.in                   |   72 +++++++++++++++++++++++++++++------
 tests/README                        |    7 +++
 tests/acloca10.test                 |    5 ++
 tests/acloca18.test                 |    5 ++
 tests/aclocal.test                  |    5 ++-
 tests/aclocal3.test                 |    8 +++-
 tests/amhello-binpkg.test           |    2 +-
 tests/amhello-cflags.test           |    2 +-
 tests/amhello-cross-compile.test    |    4 +-
 tests/ansi2knr-no-more.test         |    2 +-
 tests/autodist-stamp-vti.test       |    2 +-
 tests/auxdir.test                   |    2 +-
 tests/check2.test                   |    2 +-
 tests/copy.test                     |    4 +-
 tests/defs                          |   39 +++++++++++--------
 tests/defs-static.in                |   36 +++++++++++++++--
 tests/depmod.tap                    |    2 +-
 tests/dirlist.test                  |    5 ++
 tests/dirlist2.test                 |    5 ++
 tests/location.test                 |   27 +++++++++++--
 tests/multlib.test                  |    3 +-
 tests/obsolete.test                 |    2 +-
 tests/parallel-tests-interrupt.test |    2 +-
 tests/repeated-options.test         |    2 +-
 tests/suffix5.test                  |    2 +-
 tests/tap-doc2.test                 |    2 +-
 tests/txinfo22.test                 |    2 +-
 tests/vtexi3.test                   |    2 +-
 tests/warnings-unknown.test         |    6 ++-
 45 files changed, 386 insertions(+), 93 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 58ec84f..7dd9cca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,65 @@
+2011-09-05  Stefano Lattarini  <address@hidden>
+
+       installcheck: support it in our own testsuite
+       * tests/defs-static.in ($am_running_installcheck): New variable.
+       Initialize it to a default of "no", and sanity-check its value.
+       ($am_datadir, $am_docdir, $am_m4dir, $am_bindir, $am_scriptdir,
+       $am_pkgvdir): New variables, initialized from AC_SUBST'ed values
+       which are adaptively chosen depending on whether the testsuite
+       is running in "simple" mode or in "installcheck" mode.
+       ($MISSING): Remove, it's not really required by the testsuite.
+       ($PATH): Update using `$am_bindir', not `$testbuilddir'.
+       * Makefile.am (installcheck-local): New target.
+       * lib/Automake/tests/Makefile.am (installcheck-local): New target.
+       (AM_TESTS_ENVIRONMENT, AM_PL_LOG_FLAGS): Adaptively choose the
+       `-I' flags for perl based on whether the tests are being run by
+       "make check" or "make installcheck".
+       * tests/Makefile.am (installcheck-local): New target.
+       (defs-static): Generate it at make time, not at configure time;
+       done with the help of ...
+       (do_subst): ... this new macro.
+       (EXTRA_DIST): Explicitly distribute `defs-static.in'.
+       (CLEANFILES): Remove `defs-static'.
+       * configure.ac (AC_CONFIG_FILES): Remove `tests/defs-static'.
+       (AC_SUBST): Substitute also `m4datadir', `scriptdir' and `amdir'
+       to proper values.
+       * m4/Makefile.am (m4datadir): Don't explicitly define anymore.
+       * lib/Makefile.am (scriptdir): Likewise.
+       * lib/am/Makefile.am (amdir): Likewise.
+       * tests/amhello-binpkg.test: Use new `$am_...dir' variables,
+       instead of hard-coding values with $testsrcdir and $testbuilddir,
+       to test more faithfully under "make installcheck".
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
+       * tests/ansi2knr-no-more.test: Likewise.
+       * tests/autodist-stamp-vti.test: Likewise.
+       * tests/auxdir.test: Likewise.
+       * tests/check2.test: Likewise.
+       * tests/copy.test: Likewise.
+       * tests/multlib.test: Likewise.
+       * tests/obsolete.test: Likewise.
+       * tests/parallel-tests-interrupt.test: Likewise.
+       * tests/repeated-options.test: Likewise.
+       * tests/suffix5.test: Likewise.
+       * tests/tap-doc2.test: Likewise.
+       * tests/txinfo22.test: Likewise.
+       * tests/vtexi3.test: Likewise.
+       * tests/defs: Likewise.  Also, print the values of `$using_tap'
+       and `$am_running_installcheck', to simplify debugging, and do
+       some related code movings and tweakings.
+       * tests/aclocal3.test: Update to avoid possible spurious failures
+       when running under "make installcheck".
+       * tests/warnings-unknown.test: Likewise.
+       * tests/location.test: Likewise, and improve debugging input since
+       we are at it.
+       * tests/aclocal.test: Skip a check that does not (yet) work
+       under "make installcheck".
+       * tests/acloca10.test: Skip when doing a "make installcheck".
+       * tests/acloca18.test: Likewise.
+       * tests/dirlist.test: Likewise.
+       * tests/dirlist2.test: Likewise.
+       * tests/README: Update.
+
 2011-09-02  Stefano Lattarini  <address@hidden>
 
        tests: simplify wrapper for aclocal
diff --git a/Makefile.am b/Makefile.am
index 3b1751a..c4c333d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,6 +103,10 @@ automake aclocal: Makefile
 INSTALL: lib/INSTALL
        $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
 ## recheck: convenience proxy target for the test suites.
 .PHONY: recheck
 recheck:
diff --git a/Makefile.in b/Makefile.in
index d0611e4..a4c0dcd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -212,6 +212,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -237,6 +238,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -246,6 +248,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -914,7 +917,7 @@ install-ps: install-ps-recursive
 
 install-ps-am:
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -954,10 +957,11 @@ uninstall-am: uninstall-binSCRIPTS
        install-exec-am install-exec-hook install-html install-html-am \
        install-info install-info-am install-man install-pdf \
        install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs installdirs-am \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
-       uninstall uninstall-am uninstall-binSCRIPTS uninstall-hook
+       installcheck installcheck-am installcheck-local installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+       tags-recursive uninstall uninstall-am uninstall-binSCRIPTS \
+       uninstall-hook
 
 
 install-exec-hook:
@@ -989,6 +993,10 @@ automake aclocal: Makefile
 INSTALL: lib/INSTALL
        $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
 .PHONY: recheck
 recheck:
        @failcom='exit 1'; \
diff --git a/configure b/configure
index 499015d..ae264ed 100755
--- a/configure
+++ b/configure
@@ -578,6 +578,9 @@ HELP2MAN
 TEX
 PERL_THREADS
 PERL
+m4datadir
+amdir
+scriptdir
 pkgvdatadir
 APIVERSION
 AM_BACKSLASH
@@ -2355,9 +2358,14 @@ am__tar='${AMTAR} chof - "$$tardir"'; 
am__untar='${AMTAR} xf -'
 APIVERSION=`echo "$VERSION" | sed -e 's/^\([0-9]*\.[0-9]*[a-z]*\).*$/\1/'`
 
 
-# A versioned directory, defined here for convenience.
 pkgvdatadir="\${datadir}/$PACKAGE-$APIVERSION"
 
+scriptdir="\${pkgvdatadir}"
+
+amdir="\${pkgvdatadir}/am"
+
+m4datadir="\${datadir}/aclocal-$APIVERSION"
+
 
 # $AUTOMAKE and $ACLOCAL are always run after a `cd $top_srcdir',
 # hence `.' is really what we want for perllibdir, libdir, and acdir.
@@ -2832,7 +2840,7 @@ $as_echo "$as_me: WARNING: \`cd tests && ${MAKE-make} 
clean-local-check'" >&2;}
 sh_errexit_works=$am_cv_sh_errexit_works
 
 
-ac_config_files="$ac_config_files Makefile doc/Makefile lib/Automake/Makefile 
lib/Automake/tests/Makefile lib/Makefile lib/am/Makefile m4/Makefile 
tests/Makefile tests/defs-static"
+ac_config_files="$ac_config_files Makefile doc/Makefile lib/Automake/Makefile 
lib/Automake/tests/Makefile lib/Makefile lib/am/Makefile m4/Makefile 
tests/Makefile"
 
 ac_config_links="$ac_config_links tests/defs:tests/defs"
 
@@ -3589,7 +3597,6 @@ do
     "lib/am/Makefile") CONFIG_FILES="$CONFIG_FILES lib/am/Makefile" ;;
     "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
     "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
-    "tests/defs-static") CONFIG_FILES="$CONFIG_FILES tests/defs-static" ;;
     "tests/defs") CONFIG_LINKS="$CONFIG_LINKS tests/defs:tests/defs" ;;
     "tests/aclocal-${APIVERSION}") CONFIG_FILES="$CONFIG_FILES 
tests/aclocal-${APIVERSION}:tests/aclocal.in" ;;
     "tests/automake-${APIVERSION}") CONFIG_FILES="$CONFIG_FILES 
tests/automake-${APIVERSION}:tests/automake.in" ;;
diff --git a/configure.ac b/configure.ac
index cf3df4d..700ee63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,8 +51,10 @@ AM_INIT_AUTOMAKE([1.10a dist-bzip2 filename-length-max=99 
color-tests
 APIVERSION=`echo "$VERSION" | sed -e 
's/^\([[0-9]]*\.[[0-9]]*[[a-z]]*\).*$/\1/'`
 AC_SUBST([APIVERSION])
 
-# A versioned directory, defined here for convenience.
 AC_SUBST([pkgvdatadir], ["\${datadir}/$PACKAGE-$APIVERSION"])
+AC_SUBST([scriptdir], ["\${pkgvdatadir}"])
+AC_SUBST([amdir], ["\${pkgvdatadir}/am"])
+AC_SUBST([m4datadir], ["\${datadir}/aclocal-$APIVERSION"])
 
 # $AUTOMAKE and $ACLOCAL are always run after a `cd $top_srcdir',
 # hence `.' is really what we want for perllibdir, libdir, and acdir.
@@ -209,7 +211,6 @@ AC_CONFIG_FILES([
   lib/am/Makefile
   m4/Makefile
   tests/Makefile
-  tests/defs-static
 ])
 AC_CONFIG_LINKS([tests/defs:tests/defs])
 AC_CONFIG_FILES([tests/aclocal-${APIVERSION}:tests/aclocal.in],
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 1e53970..8fbc44f 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -196,6 +196,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -221,6 +222,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -230,6 +232,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index 76c82df..3228bdd 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -195,6 +195,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -220,6 +221,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -229,6 +231,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/lib/Automake/tests/Makefile.am b/lib/Automake/tests/Makefile.am
index c6254a3..2c33a76 100644
--- a/lib/Automake/tests/Makefile.am
+++ b/lib/Automake/tests/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to create Makefile.in
 
-# Copyright (C) 2002, 2003, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2008, 2009, 2010, 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
@@ -17,7 +17,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 PL_LOG_COMPILER = $(PERL)
-AM_PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w
+AM_TESTS_ENVIRONMENT = \
+  case $$am_running_installcheck in \
+    yes) am_pl_I_flags='-I $(pkgvdatadir)';; \
+      *) am_pl_I_flags='-I ../.. -I $(top_srcdir)/lib';; \
+  esac;
+AM_PL_LOG_FLAGS = -Mstrict -w $$am_pl_I_flags
 TEST_EXTENSIONS = .pl
 
 TESTS = \
@@ -45,3 +50,7 @@ Version3.pl
 EXTRA_DIST = $(TESTS)
 
 include $(top_srcdir)/CheckListOfTests.am
+
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 89ec5b2..ac8a529 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -15,8 +15,8 @@
 
 @SET_MAKE@
 
-# Copyright (C) 2002, 2003, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2008, 2009, 2010, 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
@@ -234,6 +234,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -259,6 +260,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -268,6 +270,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -277,7 +280,13 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 PL_LOG_COMPILER = $(PERL)
-AM_PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w
+AM_TESTS_ENVIRONMENT = \
+  case $$am_running_installcheck in \
+    yes) am_pl_I_flags='-I $(pkgvdatadir)';; \
+      *) am_pl_I_flags='-I ../.. -I $(top_srcdir)/lib';; \
+  esac;
+
+AM_PL_LOG_FLAGS = -Mstrict -w $$am_pl_I_flags
 TEST_EXTENSIONS = .pl
 TESTS = \
 Condition.pl \
@@ -649,7 +658,7 @@ install-ps: install-ps-am
 
 install-ps-am:
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -f Makefile
@@ -679,10 +688,10 @@ uninstall-am:
        install-dvi-am install-exec install-exec-am install-html \
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-generic pdf pdf-am ps ps-am recheck recheck-html \
-       uninstall uninstall-am
+       install-strip installcheck installcheck-am installcheck-local \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am recheck \
+       recheck-html uninstall uninstall-am
 
 
 .PHONY: maintainer-check-list-of-tests
@@ -728,6 +737,10 @@ clean-local: clean-maintcheck-testslist-tmp
 clean-maintcheck-testslist-tmp:
        rm -f $(am__tmk) $(am__tfs) $(am__tdf)
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 237fe61..b48428d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -25,7 +25,6 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex config-ml.in
 ## These must all be executable when installed.  However, if we use
 ## _SCRIPTS, then the program transform will be applied, which is not
 ## what we want.  So we make them executable by hand.
-scriptdir = $(pkgvdatadir)
 dist_script_DATA = \
   config.guess \
   config.sub \
diff --git a/lib/Makefile.in b/lib/Makefile.in
index d99ecfc..db0a42c 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -198,6 +198,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -223,6 +224,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -232,6 +234,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -242,7 +245,6 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUBDIRS = Automake am
 dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex config-ml.in
-scriptdir = $(pkgvdatadir)
 dist_script_DATA = \
   config.guess \
   config.sub \
diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am
index 037a4ae..e09a370 100644
--- a/lib/am/Makefile.am
+++ b/lib/am/Makefile.am
@@ -18,8 +18,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-amdir = $(pkgvdatadir)/am
-
 dist_am_DATA = \
 check.am \
 check2.am \
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 9bbecb9..e08626c 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -155,6 +155,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -180,6 +181,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -189,6 +191,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -197,7 +200,6 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-amdir = $(pkgvdatadir)/am
 dist_am_DATA = \
 check.am \
 check2.am \
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0cf074b..7a849e4 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
 ## Makefile for Automake m4.
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 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
@@ -18,8 +18,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
-
 dist_m4data_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
 as.m4 \
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 2b3b06a..931636b 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -16,7 +16,7 @@
 @SET_MAKE@
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 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
@@ -155,6 +155,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -180,6 +181,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -189,6 +191,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -197,7 +200,6 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
 dist_m4data_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
 as.m4 \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d166f25..15f562b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -138,6 +138,49 @@ checked_test_extensions = .test .tap
 expected_list_of_tests = $(handwritten_TESTS)
 include $(top_srcdir)/CheckListOfTests.am
 
+# Keep in sync with AC_SUBST'd stuff in defs-static.in.
+do_subst = sed \
+  -e 's|@address@hidden|$(abs_srcdir)|g' \
+  -e 's|@address@hidden|$(abs_top_srcdir)|g' \
+  -e 's|@address@hidden|$(abs_builddir)|g' \
+  -e 's|@address@hidden|$(prefix)|g' \
+  -e 's|@address@hidden|$(amdir)|g' \
+  -e 's|@address@hidden|$(bindir)|g' \
+  -e 's|@address@hidden|$(datadir)|g' \
+  -e 's|@address@hidden|$(docdir)|g' \
+  -e 's|@address@hidden|$(m4datadir)|g' \
+  -e 's|@address@hidden|$(scriptdir)|g' \
+  -e 's|@address@hidden|$(pkgvdatadir)|g' \
+  -e 's|@address@hidden|$(host_alias)|g' \
+  -e 's|@address@hidden|$(build_alias)|g' \
+  -e 's|@address@hidden|$(APIVERSION)|g' \
+  -e 's|@address@hidden|$(PATH_SEPARATOR)|g' \
+  -e 's|@address@hidden|$(SHELL)|g' \
+  -e 's|@address@hidden|$(PERL)|g' \
+  -e 's|@address@hidden|$(EGREP)|g' \
+  -e 's|@address@hidden|$(FGREP)|g' \
+  -e 's|@address@hidden|$(TEX)|g' \
+  -e 's|@address@hidden|$(MODIFICATION_DELAY)|g' \
+  -e 's|@address@hidden|$(am_AUTOCONF)|g' \
+  -e 's|@address@hidden|$(am_AUTOM4TE)|g' \
+  -e 's|@address@hidden|$(am_AUTORECONF)|g' \
+  -e 's|@address@hidden|$(am_AUTOHEADER)|g' \
+  -e 's|@address@hidden|$(am_AUTOUPDATE)|g' \
+  -e 's|@address@hidden|$(sh_errexit_works)|g' \
+  -e 's|@address@hidden|Generated from address@hidden  DO NOT EDIT BY HAND!|'
+
+defs-static: defs-static.in
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN)$(do_subst) $(srcdir)/defs-static.in >address@hidden
+       $(AM_V_at) : Sanity check on the substitutions; \
+       if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' address@hidden; then \
+         echo "$@ contains unexpanded substitution (see lines above)"; \
+         exit 1; \
+       fi
+       $(AM_V_at)chmod a-w address@hidden && mv -f address@hidden $@
+EXTRA_DIST += defs-static.in
+CLEANFILES = defs-static
+
 # Dependencies valid for each test case.
 $(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
 # FIXME: this should be made more granular once we have a cleaner
@@ -147,6 +190,10 @@ $(TEST_LOGS): plain-functions.sh tap-functions.sh
 ## Files containing auxiliary functions used by our test cases.
 EXTRA_DIST += tap-functions.sh plain-functions.sh
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 21ee6ad..f39bcec 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -51,8 +51,8 @@ build_triplet = @build@
 host_triplet = @host@
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
-       $(srcdir)/defs-static.in $(srcdir)/list-of-tests.mk \
-       $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am
+       $(srcdir)/list-of-tests.mk $(srcdir)/wrap-tests.am \
+       $(top_srcdir)/CheckListOfTests.am
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -66,8 +66,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
-CONFIG_CLEAN_FILES = defs-static aclocal-${APIVERSION} \
-       automake-${APIVERSION}
+CONFIG_CLEAN_FILES = aclocal-${APIVERSION} automake-${APIVERSION}
 CONFIG_CLEAN_VPATH_FILES = defs
 AM_V_GEN = $(am__v_GEN_$(V))
 am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@@ -253,6 +252,7 @@ am_AUTOUPDATE = @am_AUTOUPDATE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdir = @amdir@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -278,6 +278,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+m4datadir = @m4datadir@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -287,6 +288,7 @@ prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
 sbindir = @sbindir@
+scriptdir = @scriptdir@
 sh_errexit_works = @sh_errexit_works@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -307,7 +309,7 @@ AM_TAP_LOG_DRIVER_FLAGS = --merge --comments 
--diagnostic-string \
 EXTRA_DIST = ChangeLog-old $(handwritten_TESTS) gen-wrap-tests \
        wrap-tests.sh trivial-test-driver testsuite-summary-checks.sh \
        extract-testsuite-summary tap-setup.sh tap-summary-aux.sh \
-       tap-functions.sh plain-functions.sh
+       defs-static.in tap-functions.sh plain-functions.sh
 
 # Hand-written tests.
 
@@ -1616,6 +1618,39 @@ expected_list_of_tests = $(handwritten_TESTS)
 am__tmk = tests-in-makefile-list.tmp
 am__tfs = tests-on-filesystem-list.tmp
 am__tdf = diff-in-tests-lists.tmp
+
+# Keep in sync with AC_SUBST'd stuff in defs-static.in.
+do_subst = sed \
+  -e 's|@address@hidden|$(abs_srcdir)|g' \
+  -e 's|@address@hidden|$(abs_top_srcdir)|g' \
+  -e 's|@address@hidden|$(abs_builddir)|g' \
+  -e 's|@address@hidden|$(prefix)|g' \
+  -e 's|@address@hidden|$(amdir)|g' \
+  -e 's|@address@hidden|$(bindir)|g' \
+  -e 's|@address@hidden|$(datadir)|g' \
+  -e 's|@address@hidden|$(docdir)|g' \
+  -e 's|@address@hidden|$(m4datadir)|g' \
+  -e 's|@address@hidden|$(scriptdir)|g' \
+  -e 's|@address@hidden|$(pkgvdatadir)|g' \
+  -e 's|@address@hidden|$(host_alias)|g' \
+  -e 's|@address@hidden|$(build_alias)|g' \
+  -e 's|@address@hidden|$(APIVERSION)|g' \
+  -e 's|@address@hidden|$(PATH_SEPARATOR)|g' \
+  -e 's|@address@hidden|$(SHELL)|g' \
+  -e 's|@address@hidden|$(PERL)|g' \
+  -e 's|@address@hidden|$(EGREP)|g' \
+  -e 's|@address@hidden|$(FGREP)|g' \
+  -e 's|@address@hidden|$(TEX)|g' \
+  -e 's|@address@hidden|$(MODIFICATION_DELAY)|g' \
+  -e 's|@address@hidden|$(am_AUTOCONF)|g' \
+  -e 's|@address@hidden|$(am_AUTOM4TE)|g' \
+  -e 's|@address@hidden|$(am_AUTORECONF)|g' \
+  -e 's|@address@hidden|$(am_AUTOHEADER)|g' \
+  -e 's|@address@hidden|$(am_AUTOUPDATE)|g' \
+  -e 's|@address@hidden|$(sh_errexit_works)|g' \
+  -e 's|@address@hidden|Generated from address@hidden  DO NOT EDIT BY HAND!|'
+
+CLEANFILES = defs-static
 all: all-am
 
 .SUFFIXES:
@@ -1650,8 +1685,6 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-defs-static: $(top_builddir)/config.status $(srcdir)/defs-static.in
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 aclocal-${APIVERSION}: $(top_builddir)/config.status $(srcdir)/aclocal.in
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 automake-${APIVERSION}: $(top_builddir)/config.status $(srcdir)/automake.in
@@ -1937,6 +1970,7 @@ mostlyclean-generic:
        -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -1991,7 +2025,7 @@ install-ps: install-ps-am
 
 install-ps-am:
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -f Makefile
@@ -2021,10 +2055,10 @@ uninstall-am:
        install-dvi-am install-exec install-exec-am install-html \
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-generic pdf pdf-am ps ps-am recheck recheck-html \
-       uninstall uninstall-am
+       install-strip installcheck installcheck-am installcheck-local \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am recheck \
+       recheck-html uninstall uninstall-am
 
 
 print-list-of-tests:
@@ -2236,12 +2270,26 @@ clean-local: clean-maintcheck-testslist-tmp
 clean-maintcheck-testslist-tmp:
        rm -f $(am__tmk) $(am__tfs) $(am__tdf)
 
+defs-static: defs-static.in
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN)$(do_subst) $(srcdir)/defs-static.in >address@hidden
+       $(AM_V_at) : Sanity check on the substitutions; \
+       if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' address@hidden; then \
+         echo "$@ contains unexpanded substitution (see lines above)"; \
+         exit 1; \
+       fi
+       $(AM_V_at)chmod a-w address@hidden && mv -f address@hidden $@
+
 # Dependencies valid for each test case.
 $(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
 # FIXME: this should be made more granular once we have a cleaner
 # subdivision of the tests.
 $(TEST_LOGS): plain-functions.sh tap-functions.sh
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
diff --git a/tests/README b/tests/README
index fb12380..9bb5520 100644
--- a/tests/README
+++ b/tests/README
@@ -254,6 +254,13 @@ Do
   code preserves filenames with spaces.  This will catch errors like
   `echo $filename | ...`.
 
+  Make sure your test script can be used to faithfully check an
+  installed version of automake (as with "make installcheck").  For
+  example, if you need to copy or grep an automake-provided script,
+  do not assume that they can be found in the `$top_srcdir/lib'
+  directory, but use `$am_scriptdir' instead.  The complete list of
+  such `$am_..dir' variables can be found in tests/defs-static.in.
+
   Before commit: make sure the test is executable, add the tests to
   TESTS in Makefile.am, add it to XFAIL_TESTS in addition if needed,
   write a ChangeLog entry, send the diff to <address@hidden>.
diff --git a/tests/acloca10.test b/tests/acloca10.test
index df7da0e..6990880 100755
--- a/tests/acloca10.test
+++ b/tests/acloca10.test
@@ -22,6 +22,11 @@
 
 . ./defs || Exit 1
 
+# FIXME: we should improve our testsuite framework instead!
+if test $am_running_installcheck = yes; then
+  skip_ 'not supported under "installcheck"'
+fi
+
 cat >> configure.in << 'END'
 MACRO2
 MACRO1
diff --git a/tests/acloca18.test b/tests/acloca18.test
index a7a6e2e..ce094e8 100755
--- a/tests/acloca18.test
+++ b/tests/acloca18.test
@@ -19,6 +19,11 @@
 
 . ./defs || Exit 1
 
+# FIXME: we should improve our testsuite framework instead!
+if test $am_running_installcheck = yes; then
+  skip_ 'not supported under "installcheck"'
+fi
+
 cat >> configure.in << 'END'
 AM_MACRO1
 AM_MACRO2
diff --git a/tests/aclocal.test b/tests/aclocal.test
index 64b72e1..71e9d00 100755
--- a/tests/aclocal.test
+++ b/tests/aclocal.test
@@ -39,6 +39,9 @@ grep '[Tt]ry.*--help.*for more information' stderr
 
 $ACLOCAL --versi
 
-test x"`$ACLOCAL --print-ac-dir`" = x"$top_testsrcdir/m4"
+# FIXME: make this work also for "installcheck"
+if test $am_running_installcheck = no; then
+  test x"`$ACLOCAL --print-ac-dir`" = x"$am_m4dir"
+fi
 
 :
diff --git a/tests/aclocal3.test b/tests/aclocal3.test
index bd90782..f5b2474 100755
--- a/tests/aclocal3.test
+++ b/tests/aclocal3.test
@@ -24,10 +24,14 @@ mkdir macros
 
 cat > macros/gnome.m4 << 'END'
 AC_DEFUN([GNOME_X_CHECKS], [
-       AM_PATH_GTK(0.99.5,,AC_MSG_ERROR(GTK not installed, or gtk-config not 
in path))
+# Use a macro that cannot be installed in a third-party system-wide m4
+# file; otherwise, this test might fail under "make installcheck".
+       AM__PATH__GTK(0.99.5,,AC_MSG_ERROR(GTK not installed, or gtk-config not 
in path))
 ])
 END
 
 $ACLOCAL -I macros 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr
-grep 'macros/gnome.m4:2:.*AM_PATH_GTK.*not found' stderr
+grep '^macros/gnome\.m4:4:.*AM__PATH__GTK.*not found' stderr
+
+:
diff --git a/tests/amhello-binpkg.test b/tests/amhello-binpkg.test
index 00238e8..f42ce11 100755
--- a/tests/amhello-binpkg.test
+++ b/tests/amhello-binpkg.test
@@ -20,7 +20,7 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 gzip -dc amhello-1.0.tar.gz | tar xf -
diff --git a/tests/amhello-cflags.test b/tests/amhello-cflags.test
index 5811f45..a7977f3 100755
--- a/tests/amhello-cflags.test
+++ b/tests/amhello-cflags.test
@@ -22,7 +22,7 @@ am_create_testdir=empty
 required=gcc
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 gzip -dc amhello-1.0.tar.gz | tar xf -
diff --git a/tests/amhello-cross-compile.test b/tests/amhello-cross-compile.test
index cd00307..287462f 100755
--- a/tests/amhello-cross-compile.test
+++ b/tests/amhello-cross-compile.test
@@ -21,11 +21,11 @@ am_create_testdir=empty
 required=i586-mingw32msvc-gcc
 . ./defs || Exit 1
 
-cp "$top_testsrcdir"/doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 host=i586-mingw32msvc
-build=`"$top_testsrcdir"/lib/config.guess` && test -n "$build" \
+build=`"$am_scriptdir"/config.guess` && test -n "$build" \
   || fatal_ "cannot guess build platform"
 case $build in *mingw*) skip_ "build system is MinGW too";; esac
 
diff --git a/tests/ansi2knr-no-more.test b/tests/ansi2knr-no-more.test
index 0d405fe..c8cd4d4 100755
--- a/tests/ansi2knr-no-more.test
+++ b/tests/ansi2knr-no-more.test
@@ -32,7 +32,7 @@ $ACLOCAL -Wnone 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep "^configure\\.in:5:.*$warn_rx" stderr
 
-cat aclocal.sav "$top_testsrcdir"/m4/protos.m4 > aclocal.m4
+cat aclocal.sav "$am_m4dir"/protos.m4 > aclocal.m4
 $AUTOCONF -Wnone 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep "^configure\\.in:5:.*$warn_rx" stderr
diff --git a/tests/autodist-stamp-vti.test b/tests/autodist-stamp-vti.test
index 1dc91c7..f7a111b 100755
--- a/tests/autodist-stamp-vti.test
+++ b/tests/autodist-stamp-vti.test
@@ -46,7 +46,7 @@ END
 
 # Required when using Texinfo.
 : > texinfo.tex
-cp "$top_testsrcdir"/lib/mdate-sh .
+cp "$am_scriptdir"/mdate-sh .
 
 $ACLOCAL
 $AUTOCONF
diff --git a/tests/auxdir.test b/tests/auxdir.test
index 04e69f8..2dc548c 100755
--- a/tests/auxdir.test
+++ b/tests/auxdir.test
@@ -31,7 +31,7 @@ cat > Makefile.am << 'END'
 pkgdata_DATA =
 END
 
-cp "$top_testsrcdir/lib/mkinstalldirs" .
+cp "$am_scriptdir/mkinstalldirs" .
 
 # The "././" prefix confuses Automake into thinking it is doing a
 # subdir build.  Yes, this is hacky.
diff --git a/tests/check2.test b/tests/check2.test
index 4362424..0424bf8 100755
--- a/tests/check2.test
+++ b/tests/check2.test
@@ -44,7 +44,7 @@ CLEANFILES = echo.sh
 END
 
 if test x"$parallel_tests" = x"yes"; then
-  cp "$top_testsrcdir"/lib/test-driver .
+  cp "$am_scriptdir/test-driver" .
 fi
 
 $ACLOCAL
diff --git a/tests/copy.test b/tests/copy.test
index 3eb1c9e..8ad3f2a 100755
--- a/tests/copy.test
+++ b/tests/copy.test
@@ -73,7 +73,7 @@ test FAKE-DEPCOMP = `cat auxdir/depcomp`
 rm -rf auxdir
 mkdir auxdir
 cd auxdir
-ln -s "$top_testsrcdir/lib/missing" "$top_testsrcdir/lib/install-sh" .
+ln -s "$am_scriptdir/missing" "$am_scriptdir/install-sh" .
 cd ..
 
 $AUTOMAKE -a -c
@@ -84,6 +84,6 @@ test -f auxdir/missing
 test -h auxdir/missing
 test -f auxdir/depcomp
 test ! -h auxdir/depcomp
-diff $top_testsrcdir/lib/depcomp auxdir/depcomp
+diff "$am_scriptdir"/depcomp auxdir/depcomp
 
 :
diff --git a/tests/defs b/tests/defs
index 671ce6f..df67cd3 100644
--- a/tests/defs
+++ b/tests/defs
@@ -117,6 +117,15 @@ esac
 # by the configure-time detected $CONFIG_SHELL.
 
 
+## ----------------------- ##
+##  Early debugging info.  ##
+## ----------------------- ##
+
+echo "Running from installcheck: $am_running_installcheck"
+echo "Using TAP: $using_tap"
+echo "PATH = $PATH"
+
+
 ## ---------------------- ##
 ##  Environment cleanup.  ##
 ## ---------------------- ##
@@ -461,10 +470,10 @@ sed_unindent_prog="" # Avoid interferences from the 
environment.
 get_shell_script ()
 {
   if test x"$test_prefer_config_shell" = x"yes"; then
-    sed "1s|#!.*|#! $SHELL|" "$top_testsrcdir/lib/$1" > "$1"
+    sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1"
     chmod a+x "$1"
   else
-    cp "$top_testsrcdir/lib/$1" .
+    cp "$am_scriptdir/$1" .
   fi
   sed 10q "$1" # For debugging.
 }
@@ -498,9 +507,9 @@ fetch_tap_driver ()
   # TODO: with /bin/sh, for better coverage.
   case $am_tap_implementation in
     perl)
-      sed "1s|#!.*|#! $PERL -w|" "$top_testsrcdir"/lib/tap-driver.pl ;;
+      sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl ;;
     shell)
-      sed "1s|#!.*|#! $SHELL|" "$top_testsrcdir"/lib/tap-driver.sh ;;
+      sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh ;;
     *)
       fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
   esac > tap-driver \
@@ -517,10 +526,6 @@ am_tap_implementation=${am_tap_implementation-shell}
 ##  required by them.                                          ##
 ## ----------------------------------------------------------- ##
 
-# Print it here, so that the user will see it also if the test
-# will be skipped due to some tool missing in $PATH itself.
-echo "$PATH"
-
 # So that we can force the use of correct gcc, g++ etc., consistently
 # with cross-compilation settings.
 if cross_compiling; then
@@ -821,11 +826,6 @@ esac
 
 # We might need extra macros, e.g., from Libtool or Gettext.
 # Find them on the system.
-# Use `-I $top_testsrcdir/m4' in addition to `--acdir=$top_testsrcdir/m4',
-# because the other `-I' directories added for libtool and gettext might
-# contain files from an old version of Automake that we don't want to use.
-# Use `-Wno-syntax' because we do not want our test suite to fail because
-# some third-party .m4 file is underquoted.
 case " $required " in
   *' libtool '* | *' libtoolize '* | *' gettext '* )
     aclocaldir=$testprefix/share/aclocal
@@ -866,7 +866,12 @@ case " $required " in
         fi
         ;;
     esac
-    ACLOCAL="$ACLOCAL -Wno-syntax -I $top_testsrcdir/m4 $extra_includes -I 
$aclocaldir"
+    # Use `-I $am_m4dir' because the other `-I' directories added for
+    # libtool and gettext might contain files from an old version of
+    # Automake that we don't want to use.  Use `-Wno-syntax' because we
+    # do not want our test suite to fail because some third-party `.m4'
+    # file is underquoted.
+    ACLOCAL="$ACLOCAL -Wno-syntax -I $am_m4dir $extra_includes -I $aclocaldir"
     unset libtool_found gettext_found
     unset extra_includes aclocaldir
     ;;
@@ -941,9 +946,9 @@ else
   cd ./$testSubDir \
     || framework_failure_ "cannot chdir into test subdirectory"
   if test x"$am_create_testdir" != x"empty"; then
-    cp "$top_testsrcdir"/lib/install-sh "$top_testsrcdir"/lib/missing \
-       "$top_testsrcdir"/lib/depcomp . \
-      || framework_failure_ "fetching common files from lib/"
+    cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
+       "$am_scriptdir"/depcomp . \
+      || framework_failure_ "fetching common files from $am_scriptdir"
     # Build appropriate environment in test directory.  E.g., create
     # configure.in, touch all necessary files, etc.  Don't use AC_OUTPUT,
     # but AC_CONFIG_FILES so that appending still produces a valid
diff --git a/tests/defs-static.in b/tests/defs-static.in
index 532b0a8..b26a33c 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -89,6 +89,7 @@ for var in \
 done
 unset var
 
+
 # See whether the current test script is expected to use TAP or not.
 # Use a sensible default, while allowing the scripts to override this
 # check.
@@ -101,6 +102,33 @@ top_testsrcdir='@abs_top_srcdir@'
 testbuilddir='@abs_builddir@'
 testprefix='@prefix@'
 
+# Support for the "installcheck" target.
+case ${am_running_installcheck:=no} in
+  yes)
+    am_amdir='@amdir@'
+    am_bindir='@bindir@'
+    am_datadir='@datadir@'
+    am_docdir='@docdir@'
+    am_m4dir='@m4datadir@'
+    am_pkgvdatadir='@pkgvdatadir@'
+    am_scriptdir='@scriptdir@'
+    ;;
+  no)
+    am_amdir=$top_testsrcdir/lib/am
+    am_bindir=$testbuilddir
+    am_datadir=$top_testsrcdir
+    am_docdir=$top_testsrcdir/doc
+    am_m4dir=$top_testsrcdir/m4
+    am_pkgvdatadir=$top_testsrcdir/lib
+    am_scriptdir=$top_testsrcdir/lib
+    ;;
+  *)
+    echo "$argv0: variable \`am_running_installcheck' has invalid"
+         "value \`$am_running_installcheck'" >&2
+    exit 99
+    ;;
+esac
+
 APIVERSION='@APIVERSION@'
 PATH_SEPARATOR='@PATH_SEPARATOR@'
 
@@ -117,7 +145,6 @@ test -z "$AUTOM4TE" && AUTOM4TE="@am_AUTOM4TE@"
 test -z "$AUTORECONF" && AUTORECONF="@am_AUTORECONF@"
 test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@"
 test -z "$AUTOUPDATE" && AUTOUPDATE="@am_AUTOUPDATE@"
-test -z "$MISSING" && MISSING=$top_testsrcdir/lib/missing
 
 # Use -Werror because this also turns some Perl warnings into error.
 # Tests for which this is inappropriate should use -Wno-error.
@@ -168,10 +195,11 @@ sleep='sleep @MODIFICATION_DELAY@'
 # in UTC; see <http://www.gnu.org/gnu/initial-announcement.html>.
 old_timestamp=198309271735.59
 
-# Make our wrapper scripts accessible by default.  And avoid to uselessly
+# Make our wrapper script (or installed scripts, if running under
+# "installcheck") accessible by default.  And avoid to uselessly
 # extend $PATH multiple times if this file is sourced multiple times.
 case $PATH in
-  "$testbuilddir$PATH_SEPARATOR"*) ;;
-  *) PATH="$testbuilddir$PATH_SEPARATOR$PATH";;
+  $am_bindir$PATH_SEPARATOR*) ;;
+  *) PATH=$am_bindir$PATH_SEPARATOR$PATH;;
 esac
 export PATH
diff --git a/tests/depmod.tap b/tests/depmod.tap
index c40fea8..6f6a73e 100755
--- a/tests/depmod.tap
+++ b/tests/depmod.tap
@@ -63,7 +63,7 @@ ocwd=`pwd` || fatal_ "cannot get current working directory"
 
 # Keep this in sync with the contents of depend.m4.
 all_depmodes=`\
-  sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$top_testsrcdir/lib/depcomp" \
+  sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_scriptdir/depcomp" \
     | grep -v '^none$'` \
   && : Turn newlines and tabs into spaces, and strip extra whitespace. \
   && all_depmodes=`echo $all_depmodes` \
diff --git a/tests/dirlist.test b/tests/dirlist.test
index f6aa57e..9cb3ea3 100755
--- a/tests/dirlist.test
+++ b/tests/dirlist.test
@@ -19,6 +19,11 @@
 
 . ./defs || Exit 1
 
+# FIXME: we should improve our testsuite framework instead!
+if test $am_running_installcheck = yes; then
+  skip_ 'not supported under "installcheck"'
+fi
+
 cat > configure.in <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
diff --git a/tests/dirlist2.test b/tests/dirlist2.test
index 910c470..21d8093 100755
--- a/tests/dirlist2.test
+++ b/tests/dirlist2.test
@@ -20,6 +20,11 @@
 
 . ./defs || Exit 1
 
+# FIXME: we should improve our testsuite framework instead!
+if test $am_running_installcheck = yes; then
+  skip_ 'not supported under "installcheck"'
+fi
+
 cat > configure.in <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
diff --git a/tests/location.test b/tests/location.test
index 9013e31..f96a09e 100755
--- a/tests/location.test
+++ b/tests/location.test
@@ -42,11 +42,20 @@ VAR = 1 \
       3
 END
 
+# Smash the useless difference of lib file locations.
+smash_useless_diffs ()
+{
+  # FIXME: we could get rid of the second 's|||' once we improve our
+  # wrapper scripts ...
+  sed -e "s|^$am_amdir/\\([a-z]*\.am\\)|\\1|" \
+      -e "s|^automake-$APIVERSION:|automake:|" ${1+"$@"};
+}
+
 $ACLOCAL
 AUTOMAKE_fails -Wno-error
 
-# Smash the useless difference of lib file locations.
-sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
+smash_useless_diffs stderr >observed
+
 cat >expected <<\EOF
 Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
 Makefile.am:8: ... `VAR' previously defined here
@@ -68,10 +77,18 @@ program.am: ... `ctags$(EXEEXT)' previously defined here
 Makefile.am:6:   while processing program `ctags'
 EOF
 
+cat expected
+cat observed
 diff expected observed || Exit 1
 
 AUTOMAKE_fails -Werror
-sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
-( echo 'automake: warnings are treated as errors'; cat expected ) \
-  | diff - observed || Exit 1
+smash_useless_diffs stderr >observed
+(echo 'automake: warnings are treated as errors' && cat expected) > t
+mv -f t expected
+
+cat expected
+cat observed
+
+diff expected observed || Exit 1
+
 :
diff --git a/tests/multlib.test b/tests/multlib.test
index e2ab6f3..d196efd 100755
--- a/tests/multlib.test
+++ b/tests/multlib.test
@@ -106,8 +106,7 @@ mkdir libbar/sub
 
 : > libbar/bar.c
 
-cp "$top_testsrcdir/lib/config-ml.in" .
-cp "$top_testsrcdir/lib/symlink-tree" .
+cp "$am_scriptdir"/config-ml.in "$am_scriptdir"/symlink-tree .
 
 $ACLOCAL
 $AUTOCONF
diff --git a/tests/obsolete.test b/tests/obsolete.test
index 8a247d8..3a32858 100755
--- a/tests/obsolete.test
+++ b/tests/obsolete.test
@@ -28,7 +28,7 @@ AC_INIT
 END
 
 $PERL -ne '/AU_DEFUN\(\[(\w+)\]/ && print "$1\n"' \
-    "$top_testsrcdir/m4/obsolete.m4" >> obs
+    "$am_m4dir/obsolete.m4" > obs
 cat obs >> configure.in
 $PERL -ne 'chomp; print "grep $_ output || Exit 1\n"; ' obs > obs.1
 $PERL -ne 'chomp; print "grep $_ configure.in && Exit 1\n"; ' obs > obs.2
diff --git a/tests/parallel-tests-interrupt.test 
b/tests/parallel-tests-interrupt.test
index ed40412..8737a7a 100755
--- a/tests/parallel-tests-interrupt.test
+++ b/tests/parallel-tests-interrupt.test
@@ -37,7 +37,7 @@ END
 # This is hacky and ugly, but has the great advantage of avoiding us a lot
 # of pain with background processes and related synchronization issues.
 
-cat - "$top_testsrcdir"/lib/test-driver > test-driver <<'END'
+cat - "$am_scriptdir"/test-driver > test-driver <<'END'
 #!/bin/sh
 echo $$ > pid
 END
diff --git a/tests/repeated-options.test b/tests/repeated-options.test
index 1609aa9..dcdcbb3 100755
--- a/tests/repeated-options.test
+++ b/tests/repeated-options.test
@@ -58,7 +58,7 @@ int main (void)
 }
 END
 
-cp "$top_testsrcdir"/lib/compile "$top_testsrcdir"/lib/test-driver .
+cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver .
 
 $ACLOCAL
 $AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; Exit 1; }
diff --git a/tests/suffix5.test b/tests/suffix5.test
index 6bdaea4..3061497 100755
--- a/tests/suffix5.test
+++ b/tests/suffix5.test
@@ -45,7 +45,7 @@ END
 
 : > ltmain.sh
 
-cp "$top_testsrcdir"/lib/config.guess "$top_testsrcdir"/lib/config.sub .
+cp "$am_scriptdir/config.guess" "$am_scriptdir/config.sub" .
 
 $ACLOCAL
 $AUTOMAKE
diff --git a/tests/tap-doc2.test b/tests/tap-doc2.test
index 468bb1c..dc69654 100755
--- a/tests/tap-doc2.test
+++ b/tests/tap-doc2.test
@@ -70,7 +70,7 @@ END
 chmod a+x *.test
 
 mkdir build-aux
-cp "$top_testsrcdir"/lib/tap-driver.pl build-aux \
+cp "$am_scriptdir"/tap-driver.pl build-aux \
   || framework_failure_ "fetching the perl TAP driver"
 
 (export AUTOMAKE ACLOCAL AUTOCONF && $AUTORECONF -vi) || Exit 1
diff --git a/tests/txinfo22.test b/tests/txinfo22.test
index 06819fd..07f0573 100755
--- a/tests/txinfo22.test
+++ b/tests/txinfo22.test
@@ -50,7 +50,7 @@ END
 
 mkdir aux1
 mkdir tex
-cp "$top_testsrcdir/lib/texinfo.tex" tex
+cp "$am_pkgvdatadir/texinfo.tex" tex
 
 $ACLOCAL
 $AUTOMAKE --add-missing
diff --git a/tests/vtexi3.test b/tests/vtexi3.test
index 8829068..b474ef6 100755
--- a/tests/vtexi3.test
+++ b/tests/vtexi3.test
@@ -65,7 +65,7 @@ END
 
 # Required when using Texinfo.
 : > texinfo.tex
-cp "$top_testsrcdir"/lib/mdate-sh .
+cp "$am_scriptdir"/mdate-sh .
 
 $ACLOCAL
 $AUTOCONF
diff --git a/tests/warnings-unknown.test b/tests/warnings-unknown.test
index 77ed589..db803a5 100755
--- a/tests/warnings-unknown.test
+++ b/tests/warnings-unknown.test
@@ -34,9 +34,13 @@ END
 $ACLOCAL
 
 AUTOMAKE_fails -Wbazquux
+# FIXME: we could get rid of this once we improve our wrapper scripts.
+sed "s/^automake:/automake-$APIVERSION:/" stderr > t
+mv -f t stderr
+cat stderr >&2
 grep '^configure\.in:2:.* unknown warning category.*zardoz' stderr
 grep '^Makefile\.am:1:.* unknown warning category.*foobar' stderr
-grep '^automake:.* unknown warning category.*bazquux' stderr
+grep "^automake-$APIVERSION:.* unknown warning category.*bazquux" stderr
 
 # Check that we can override warnings about unknown warning categories.
 $AUTOMAKE -Wno-unsupported -Wbazquux
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]