automake-patches
[Top][All Lists]
Advanced

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

[PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR.


From: Stefano Lattarini
Subject: [PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR.
Date: Sat, 11 Dec 2010 15:00:34 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

* tests/auxdir.test: Refactored and made less hackish.  Improved
heading comments.
* tests/auxdir2.test: Call automake with the `-a' option, so
that automake won't fail for spurious reasons.  Add trailing
`:' command.
* tests/auxdir3.test: Add an explanatory comment and a trailing
`:' command.
* tests/auxdir4.test: Make grepping of automake stderr slightly
stricter.  Also, now this just checks for unportable auxdir
names (and it has been extended in this respect).  Checks for
non-existent auxdirs has been moved out to ...
* tests/auxdir5.test: .. this new test.
* tests/auxdir6.test: New test.
* tests/auxdir7.test: Likewise.
* tests/auxdir8.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog          |   18 +++++++
 tests/Makefile.am  |    4 ++
 tests/Makefile.in  |    4 ++
 tests/auxdir.test  |   33 ++++++++++---
 tests/auxdir2.test |    4 +-
 tests/auxdir3.test |    4 +-
 tests/auxdir4.test |   12 ++++-
 tests/auxdir5.test |   30 ++++++++++++
 tests/auxdir6.test |   50 ++++++++++++++++++++
 tests/auxdir7.test |   49 +++++++++++++++++++
 tests/auxdir8.test |  132 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 327 insertions(+), 13 deletions(-)
 create mode 100755 tests/auxdir5.test
 create mode 100755 tests/auxdir6.test
 create mode 100755 tests/auxdir7.test
 create mode 100755 tests/auxdir8.test
From acd835f144d3f73af60edc4affdfe66e6e3034b4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 8 May 2010 00:32:22 +0200
Subject: [PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR.

* tests/auxdir.test: Refactored and made less hackish.  Improved
heading comments.
* tests/auxdir2.test: Call automake with the `-a' option, so
that automake won't fail for spurious reasons.  Add trailing
`:' command.
* tests/auxdir3.test: Add an explanatory comment and a trailing
`:' command.
* tests/auxdir4.test: Make grepping of automake stderr slightly
stricter.  Also, now this just checks for unportable auxdir
names (and it has been extended in this respect).  Checks for
non-existent auxdirs has been moved out to ...
* tests/auxdir5.test: .. this new test.
* tests/auxdir6.test: New test.
* tests/auxdir7.test: Likewise.
* tests/auxdir8.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog          |   18 +++++++
 tests/Makefile.am  |    4 ++
 tests/Makefile.in  |    4 ++
 tests/auxdir.test  |   33 ++++++++++---
 tests/auxdir2.test |    4 +-
 tests/auxdir3.test |    4 +-
 tests/auxdir4.test |   12 ++++-
 tests/auxdir5.test |   30 ++++++++++++
 tests/auxdir6.test |   50 ++++++++++++++++++++
 tests/auxdir7.test |   49 +++++++++++++++++++
 tests/auxdir8.test |  132 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 327 insertions(+), 13 deletions(-)
 create mode 100755 tests/auxdir5.test
 create mode 100755 tests/auxdir6.test
 create mode 100755 tests/auxdir7.test
 create mode 100755 tests/auxdir8.test

diff --git a/ChangeLog b/ChangeLog
index caf1183..457a0c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2010-12-11  Stefano Lattarini  <address@hidden>
 
+       Extended tests on AC_CONFIG_AUX_DIR.
+       * tests/auxdir.test: Refactored and made less hackish.  Improved
+       heading comments.
+       * tests/auxdir2.test: Call automake with the `-a' option, so
+       that automake won't fail for spurious reasons.  Add trailing
+       `:' command.
+       * tests/auxdir3.test: Add an explanatory comment and a trailing
+       `:' command.
+       * tests/auxdir4.test: Make grepping of automake stderr slightly
+       stricter.  Also, now this just checks for unportable auxdir
+       names (and it has been extended in this respect).  Checks for
+       non-existent auxdirs has been moved out to ...
+       * tests/auxdir5.test: .. this new test.
+       * tests/auxdir6.test: New test.
+       * tests/auxdir7.test: Likewise.
+       * tests/auxdir8.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
        Tests initialization: put default definition of AC_CONFIG_AUX_DIR
        in the pre-populated configure.in.
        * tests/defs.in (configure.in): Add a call to AC_CONFIG_AUX_DIR,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..79a3d71 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -104,6 +104,10 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+auxdir5.test \
+auxdir6.test \
+auxdir7.test \
+auxdir8.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..3aea359 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -371,6 +371,10 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+auxdir5.test \
+auxdir6.test \
+auxdir7.test \
+auxdir8.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
diff --git a/tests/auxdir.test b/tests/auxdir.test
index 15efc9e..1cddbfc 100755
--- a/tests/auxdir.test
+++ b/tests/auxdir.test
@@ -16,20 +16,37 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test tries without an explicit call to AC_CONFIG_AUX_DIR;
+# the config auxdir should be implicitly defined to `.' since
+# the install-sh, mkinstalldirs, etc., scripts are in the top-level
+# directory.
+# Keep this in sync with sister tests auxdir6.test and auxdir7.test.
 
-# The "./." is here so we don't have to mess with subdirs.
-config_auxdir=./.
+config_auxdir=NONE
 . ./defs || Exit 1
 
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+END
+
+mkdir subdir
+
 cat > Makefile.am << 'END'
 pkgdata_DATA =
 END
 
-cp "$testsrcdir/../lib/mkinstalldirs" .
+cp Makefile.am subdir/Makefile.am
+
+: > mkinstalldirs
+: > install-sh
+: > missing
+
+$ACLOCAL
+$AUTOMAKE
 
-# The "././" prefix confuses Automake into thinking it is doing a
-# subdir build.  Yes, this is hacky.
-$ACLOCAL || Exit 1
-$AUTOMAKE ././Makefile || Exit 1
+$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
 
-grep '/\./\./mkinstalldirs' Makefile.in
+:
diff --git a/tests/auxdir2.test b/tests/auxdir2.test
index fac3c17..e1129d6 100755
--- a/tests/auxdir2.test
+++ b/tests/auxdir2.test
@@ -25,4 +25,6 @@ set -e
 : > Makefile.am
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -a
+
+:
diff --git a/tests/auxdir3.test b/tests/auxdir3.test
index 9cd4678..c3c39d7 100755
--- a/tests/auxdir3.test
+++ b/tests/auxdir3.test
@@ -22,7 +22,7 @@ config_auxdir=NONE
 set -e
 
 cat >> configure.in << END
-AC_CONFIG_AUX_DIR([.])
+AC_CONFIG_AUX_DIR([.]) dnl this will appear after AM_INIT_AUTOMAKE
 END
 
 : > Makefile.am
@@ -30,3 +30,5 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 grep 'AC_CONFIG_AUX_DIR.*AM_INIT_AUTOMAKE' stderr
+
+:
diff --git a/tests/auxdir4.test b/tests/auxdir4.test
index 6a0ea0f..0223c45 100755
--- a/tests/auxdir4.test
+++ b/tests/auxdir4.test
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure we diagnose dangerous AC_CONFIG_AUX_DIR names.
+# Make sure we diagnose unportable AC_CONFIG_AUX_DIR names.
 
 config_auxdir=aux
 . ./defs || Exit 1
@@ -25,5 +25,11 @@ set -e
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'configure.in:2:.*aux.*does not exist' stderr
-grep 'configure.in:2:.*aux.*W32' stderr
+grep '^configure\.in:2:.*aux.*W32' stderr
+
+if mkdir aux; then
+  AUTOMAKE_fails
+  grep '^configure\.in:2:.*aux.*W32' stderr
+fi
+
+:
diff --git a/tests/auxdir5.test b/tests/auxdir5.test
new file mode 100755
index 0000000..61b2720
--- /dev/null
+++ b/tests/auxdir5.test
@@ -0,0 +1,30 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Make sure we diagnose dangerous non-existent AC_CONFIG_AUX_DIR names.
+
+config_auxdir=nonesuch
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails
+grep '^configure\.in:2:.*nonesuch.* not exist' stderr
+
+:
diff --git a/tests/auxdir6.test b/tests/auxdir6.test
new file mode 100755
index 0000000..400ccea
--- /dev/null
+++ b/tests/auxdir6.test
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test calls AC_CONFIG_AUX_DIR with an explicit literal argument,
+# thus explicitly making the directory named by that argument the
+# config auxdir.
+# Keep this in sync with sister tests auxdir.test and auxdir7.test.
+
+config_auxdir=auxdir
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+END
+
+mkdir subdir $config_auxdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > $config_auxdir/mkinstalldirs
+: > $config_auxdir/install-sh
+: > $config_auxdir/missing
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/auxdir/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/auxdir/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/auxdir7.test b/tests/auxdir7.test
new file mode 100755
index 0000000..3f9ab98
--- /dev/null
+++ b/tests/auxdir7.test
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test calls AC_CONFIG_AUX_DIR with a `.' argument, thus explicitly
+# making the top-level directory the config auxdir.
+# Keep this in sync with sister tests auxdir.test and auxdir6.test.
+
+config_auxdir=.
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+END
+
+mkdir subdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > $config_auxdir/mkinstalldirs
+: > $config_auxdir/install-sh
+: > $config_auxdir/missing
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/auxdir8.test b/tests/auxdir8.test
new file mode 100755
index 0000000..c38d722
--- /dev/null
+++ b/tests/auxdir8.test
@@ -0,0 +1,132 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Make sure that, if AC_CONFIG_AUX_DIR is not specified, Automake tries
+# to use `.', `..' and `../..', in precisely that order.
+
+config_auxdir=NONE
+. ./defs || Exit 1
+
+set -e
+
+nil=__no_such_program
+unset NONESUCH || : # just to be sure
+
+cat >>configure.in << END
+AM_MISSING_PROG([NONESUCH],[$nil])
+AC_OUTPUT
+END
+
+mkdir d3
+mkdir d3/d2
+mkdir d3/d2/d1
+mkdir d3/d2/d1/d0
+
+echo 'echo %%d3%% $*' > d3/missing
+chmod +x d3/missing
+echo 'echo %%d2%% $*' > d3/d2/missing
+chmod +x d3/d2/missing
+echo 'echo %%d1%% $*' > d3/d2/d1/missing
+chmod +x d3/d2/d1/missing
+echo 'echo %%d0%% $*' > d3/d2/d1/d0/missing
+chmod +x d3/d2/d1/d0/missing
+
+mv configure.in d3/d2/d1/d0/
+
+cd d3/d2/d1/d0
+
+cat > Makefile.am << 'EOF'
+.PHONY: test
+test:
+       $(NONESUCH) >$(out)
+EOF
+
+$ACLOCAL
+$AUTOCONF
+
+# ------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = .  #
+# ------------------------------------------- #
+
+: > install-sh
+$AUTOMAKE
+./configure
+out=out0 $MAKE test
+cat out0
+grep "%%d0%%.*$nil" out0
+grep '%%d[123]' out0 && Exit 1
+
+rm -f missing install-sh
+
+# -------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = ..  #
+# -------------------------------------------- #
+
+# Automake finds `install-sh' in `.', so it assumes that auxdir is `.';
+# but it won't find `missing' in `.', so it will fail.
+: > install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\./missing.*not found' stderr
+rm -f install-sh
+
+# Now things should work.
+: > ../install-sh
+$AUTOMAKE
+./configure
+out=out1 $MAKE test
+cat out1
+grep "%%d1%%.*$nil" out1
+grep '%%d[023]' out1 && Exit 1
+
+rm -f ../missing ../install-sh
+
+# ----------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = ../..  #
+# ----------------------------------------------- #
+
+# Automake finds `install-sh' in `.', so it assumes that auxdir is `.';
+# but it won't find `missing' in `.', so it will fail.
+: > install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\./missing.*not found' stderr
+rm -f install-sh
+
+# Automake finds `install-sh' in `..', so it assumes that auxdir is `..';
+# but it won't find `missing' in `.', so it will fail.
+: > ../install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\.\./missing.*not found' stderr
+rm -f ../install-sh
+
+# Now things should work.
+: > ../../install-sh
+$AUTOMAKE
+./configure
+out=out2 $MAKE test
+cat out2
+grep "%%d2%%.*$nil" out2
+grep '%%d[013]' out2 && Exit 1
+
+rm -f ../../missing ../../install-sh
+
+# --------------------------------------------------------- #
+:  AC_CONFIG_AUX_DIR will not be found: automake must fail  #
+# --------------------------------------------------------- #
+
+AUTOMAKE_fails
+grep 'required file.*missing.*not found' stderr
+
+:
-- 
1.7.1


reply via email to

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