]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Extended tests on AC_CONFIG_AUX_DIR.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 7 May 2010 22:32:22 +0000 (00:32 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 15 Dec 2010 23:30:34 +0000 (00:30 +0100)
* tests/auxdir.test: Enable `errexit' shell flag.  Prefer `$me'
over hard-coded test name.  Use proper m4 quoting.  Add trailing
`:' command.
* tests/auxdir2.test: Likewise.  Try to call automake also with
the `-a' option, so that it will not fail for spurious reasons.
* tests/auxdir3.test: Add an explanatory comment and a trailing
`:' command.
* tests/auxdir4.test: Prefer `$me' over hard-coded test name.
Make grepping of automake stderr slightly stricter.  Also, now
this test just checks about Automake's reaction to unportable
auxiliary directory names (and it has been extended in this
respect).  Moved the checks about non-existent auxiliary
directories to ...
* tests/auxdir5.test: ... this new test.
* tests/auxdir6.test: New test.
* tests/auxdir7.test: Likewise.
* tests/auxdir8.test: Likewise.
* tests/auxdir9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.

12 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/auxdir.test
tests/auxdir2.test
tests/auxdir3.test
tests/auxdir4.test
tests/auxdir5.test [new file with mode: 0755]
tests/auxdir6.test [new file with mode: 0755]
tests/auxdir7.test [new file with mode: 0755]
tests/auxdir8.test [new file with mode: 0755]
tests/auxdir9.test [new file with mode: 0755]

index 5afdc53e64ad6c2d572ee187fc019a0f2db38854..f18c0ff25f671fe50ed5cdb2e0c1139305acd9b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Extended tests on AC_CONFIG_AUX_DIR.
+       * tests/auxdir.test: Enable `errexit' shell flag.  Prefer `$me'
+       over hard-coded test name.  Use proper m4 quoting.  Add trailing
+       `:' command.
+       * tests/auxdir2.test: Likewise.  Try to call automake also with
+       the `-a' option, so that it will not fail for spurious reasons.
+       * tests/auxdir3.test: Add an explanatory comment and a trailing
+       `:' command.
+       * tests/auxdir4.test: Prefer `$me' over hard-coded test name.
+       Make grepping of automake stderr slightly stricter.  Also, now
+       this test just checks about Automake's reaction to unportable
+       auxiliary directory names (and it has been extended in this
+       respect).  Moved the checks about non-existent auxiliary
+       directories to ...
+       * tests/auxdir5.test: ... this new test.
+       * tests/auxdir6.test: New test.
+       * tests/auxdir7.test: Likewise.
+       * tests/auxdir8.test: Likewise.
+       * tests/auxdir9.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-12-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Avoid running installed automake from 'libtool --help'.
index dab04e39336af6e94f6758b401366ee90e341e4b..9c27b8bde9b7937f240ea8c3480b62660a79c31e 100644 (file)
@@ -104,6 +104,11 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+auxdir5.test \
+auxdir6.test \
+auxdir7.test \
+auxdir8.test \
+auxdir9.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
index de21f4334e83da8adf72837774285defe8cbafe1..fda08631e8702f55501e59aa40b38d6cbd78a027 100644 (file)
@@ -371,6 +371,11 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+auxdir5.test \
+auxdir6.test \
+auxdir7.test \
+auxdir8.test \
+auxdir9.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
index 95a7a20d970dbcab3e79c858decff67e7eb46d56..bb50d6fbb72e4270837a8da901574d227155cbfb 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007, 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
 
 . ./defs || Exit 1
 
+set -e
+
 # The "./." is here so we don't have to mess with subdirs.
-cat > configure.in << 'END'
-AC_INIT([auxdir], [1.0])
-AC_CONFIG_AUX_DIR(./.)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([./.])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
@@ -34,7 +37,9 @@ cp "$testsrcdir/../lib/mkinstalldirs" .
 
 # The "././" prefix confuses Automake into thinking it is doing a
 # subdir build.  Yes, this is hacky.
-$ACLOCAL || Exit 1
-$AUTOMAKE ././Makefile || Exit 1
+$ACLOCAL
+$AUTOMAKE ././Makefile
 
 grep '/\./\./mkinstalldirs' Makefile.in
+
+:
index 590a5df72e75eaebd54a944b6429b4e3d6679c20..430abadb41f04b13c8441600602509c67cebfb4c 100755 (executable)
 
 . ./defs || Exit 1
 
-# The "./." is here so we don't have to mess with subdirs.
-cat > configure.in << 'END'
-AC_INIT([auxdir2], [1.0])
-AC_CONFIG_AUX_DIR($foo)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([\$foo)
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
 
 : > Makefile.am
 
-$ACLOCAL || Exit 1
+$ACLOCAL
+# Both these two invocations are meant.
+# They exercise both code paths concerning auxiliary files.
+$AUTOMAKE -a
 $AUTOMAKE
+
+:
index c828051bb3419fe096e8c00df16e9df04e37113c..64fbd6a7c386fe383a6747132623ffd695b4c78b 100755 (executable)
@@ -21,7 +21,7 @@
 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
@@ -29,3 +29,5 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 grep 'AC_CONFIG_AUX_DIR.*AM_INIT_AUTOMAKE' stderr
+
+:
index 0447809e4d9bd45acc41259b9dd38407daa1cc11..38bf28fc039c369d6b10e910964925a469f3055a 100755 (executable)
 # 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.
 
 . ./defs || Exit 1
 
 set -e
 
-cat >configure.in <<'END'
-AC_INIT([auxdir4], [1.0])
+cat >configure.in <<END
+AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([aux])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
@@ -31,5 +31,11 @@ END
 
 $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 (executable)
index 0000000..e44b8fb
--- /dev/null
@@ -0,0 +1,36 @@
+#! /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 non-existent AC_CONFIG_AUX_DIR names.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([nonesuch])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+
+: > 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 (executable)
index 0000000..4b3565a
--- /dev/null
@@ -0,0 +1,52 @@
+#! /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 auxdir7.test and auxdir8.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile subdir/Makefile])
+END
+
+mkdir subdir auxdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > auxdir/mkinstalldirs
+: > auxdir/install-sh
+: > 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 (executable)
index 0000000..67710b6
--- /dev/null
@@ -0,0 +1,51 @@
+#! /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 auxdir6.test and auxdir8.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile subdir/Makefile])
+END
+
+mkdir subdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > mkinstalldirs
+: > install-sh
+: > 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 (executable)
index 0000000..7d0c1ae
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007  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 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.
+
+. ./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
+
+: > mkinstalldirs
+: > install-sh
+: > missing
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/auxdir9.test b/tests/auxdir9.test
new file mode 100755 (executable)
index 0000000..db85ac1
--- /dev/null
@@ -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.
+
+. ./defs || Exit 1
+
+set -e
+
+nil=__no_such_program
+
+unset NONESUCH || :
+
+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
+
+: