Extended tests on AC_CONFIG_AUX_DIR. * tests/auxdir4.test: Restricted to checks for unportable auxdir names (and extended in this respect). Checks for non-existent auxdirs moved out to ... * tests/auxdir5.test: .. this new test. * tests/auxdir.test: Reafactored and made less hackish. * tests/auxdir6.test: New test. * tests/auxdir7.test: Likewise. * tests/auxdir8.test: Likewise. * tests/Makefile.am (TESTS): Extended accordingly.
From dd9075bba2513c4d6abe847f97d8ff1bea40105c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sat, 8 May 2010 00:32:22 +0200 Subject: [PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR.
* tests/auxdir4.test: Restricted to checks for unportable auxdir names (and extended in this respect). Checks for non-existent auxdirs moved out to ... * tests/auxdir5.test: .. this new test. * tests/auxdir.test: Reafactored and made less hackish. * tests/auxdir6.test: New test. * tests/auxdir7.test: Likewise. * tests/auxdir8.test: Likewise. --- ChangeLog | 11 +++++ tests/Makefile.am | 4 ++ tests/Makefile.in | 4 ++ tests/auxdir.test | 27 ++++++++--- tests/auxdir4.test | 10 +++- tests/auxdir5.test | 28 ++++++++++++ tests/auxdir6.test | 45 +++++++++++++++++++ tests/auxdir7.test | 45 +++++++++++++++++++ tests/auxdir8.test | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 286 insertions(+), 10 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 c59ad57..e7e39d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2010-05-08 Stefano Lattarini <stefano.lattar...@gmail.com> + Extended tests on AC_CONFIG_AUX_DIR. + * tests/auxdir4.test: Restricted to checks for unportable auxdir + names (and extended in this respect). Checks for non-existent + auxdirs moved out to ... + * tests/auxdir5.test: .. this new test. + * tests/auxdir.test: Reafactored and made less hackish. + * tests/auxdir6.test: New test. + * tests/auxdir7.test: Likewise. + * tests/auxdir8.test: Likewise. + * tests/Makefile.am (TESTS): Extended accordingly. + Tests initialization: put default definition of AC_CONFIG_AUX_DIR in the pre-populated configure.in. * tests/defs.in: Do that, through the (overridable) shell variable diff --git a/tests/Makefile.am b/tests/Makefile.am index cff34c5..88bc8f3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -106,6 +106,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 3ff9012..76ba584 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -347,6 +347,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..ca9c0ec 100755 --- a/tests/auxdir.test +++ b/tests/auxdir.test @@ -16,20 +16,31 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Test to make sure AC_CONFIG_AUX_DIR works correctly. +# 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 -# 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 -grep '/\./\./mkinstalldirs' Makefile.in +$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in +$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in diff --git a/tests/auxdir4.test b/tests/auxdir4.test index 6a0ea0f..1b3eea4 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 + +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..72c5f75 --- /dev/null +++ b/tests/auxdir5.test @@ -0,0 +1,28 @@ +#! /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..e5fc32e --- /dev/null +++ b/tests/auxdir6.test @@ -0,0 +1,45 @@ +#! /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. +# 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..771a301 --- /dev/null +++ b/tests/auxdir7.test @@ -0,0 +1,45 @@ +#! /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. +# 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..454af07 --- /dev/null +++ b/tests/auxdir8.test @@ -0,0 +1,122 @@ +#! /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 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 + +# AC_CONFIG_AUX_DIR = . + +: > install-sh + +$AUTOMAKE +./configure +$MAKE test out=out0 +cat out0 +grep "%%d0%%.*$nil" out0 +grep '%%d[123]' out0 && Exit 1 + +rm -f missing install-sh + +# 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 + +: > ../install-sh +$AUTOMAKE +./configure +$MAKE test out=out1 +cat out1 +grep "%%d1%%.*$nil" out1 +grep '%%d[023]' out1 && Exit 1 + +rm -f ../missing ../install-sh + +# 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 + +: > ../../install-sh +$AUTOMAKE +./configure +$MAKE test out=out2 +cat out2 +grep "%%d2%%.*$nil" out2 +grep '%%d[013]' out2 && Exit 1 + +rm -f ../../missing ../../install-sh + +# AC_CONFIG_AUX_DIR not found +AUTOMAKE_fails +grep 'required file.*missing.*not found' stderr + +: -- 1.6.5