From: Stefano Lattarini Date: Fri, 7 May 2010 22:32:22 +0000 (+0200) Subject: Extended tests on AC_CONFIG_AUX_DIR. X-Git-Tag: ng-0.5a~303^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49ac3def6a658c77b113cca89925ed91700c61c9;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 5afdc53e6..f18c0ff25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2010-12-15 Stefano Lattarini + + 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 Avoid running installed automake from 'libtool --help'. diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e393..9c27b8bde 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f4334..fda08631e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 \ diff --git a/tests/auxdir.test b/tests/auxdir.test index 95a7a20d9..bb50d6fbb 100755 --- a/tests/auxdir.test +++ b/tests/auxdir.test @@ -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 @@ -18,10 +19,12 @@ . ./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 < configure.in << 'END' -AC_INIT([auxdir2], [1.0]) -AC_CONFIG_AUX_DIR($foo) +set -e + +cat > configure.in < Makefile.am -$ACLOCAL || Exit 1 +$ACLOCAL +# Both these two invocations are meant. +# They exercise both code paths concerning auxiliary files. +$AUTOMAKE -a $AUTOMAKE + +: diff --git a/tests/auxdir3.test b/tests/auxdir3.test index c828051bb..64fbd6a7c 100755 --- a/tests/auxdir3.test +++ b/tests/auxdir3.test @@ -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 + +: diff --git a/tests/auxdir4.test b/tests/auxdir4.test index 0447809e4..38bf28fc0 100755 --- a/tests/auxdir4.test +++ b/tests/auxdir4.test @@ -14,14 +14,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# 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 <. + +# Make sure we diagnose non-existent AC_CONFIG_AUX_DIR names. + +. ./defs || Exit 1 + +set -e + +cat > configure.in < 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 000000000..4b3565aac --- /dev/null +++ b/tests/auxdir6.test @@ -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 . + +# 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 < 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 index 000000000..67710b618 --- /dev/null +++ b/tests/auxdir7.test @@ -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 . + +# 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 < 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 index 000000000..7d0c1ae40 --- /dev/null +++ b/tests/auxdir8.test @@ -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 . + +# 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 index 000000000..db85ac129 --- /dev/null +++ b/tests/auxdir9.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 . + +# 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 + +: