[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR.
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH 2/2] Extended tests on AC_CONFIG_AUX_DIR. |
Date: |
Wed, 15 Dec 2010 21:49:55 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Tuesday 14 December 2010, Ralf Wildenhues wrote:
> Hi Stefano,
>
> * Stefano Lattarini wrote on Sat, Dec 11, 2010 at 03:00:34PM CET:
> > * 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.
>
> Can you update this patch to not require the previous 1/2?
>
Yes, the updated patch is attached. I will push it in 72 hours, but I'd
like to have it reviewed anew if possible.
> I have a couple more nits below. The patch is OK after addressing
> the issues.
>
> Thanks,
> Ralf
>
> > --- 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.
>
> (This comment should be retained, along with the usage below.)
>
Why? Isn't such a relying on automake internals a Bad Thig?
That said, I've restored the original auxdir.test (with minor
improvements, see the attached patch) to retain such an usage.
What was the previous `auxdir.test' resulting from the application
of my original patch has been moved in a new test `auxdir8.test'
> > -$ACLOCAL || Exit 1
> > -$AUTOMAKE ././Makefile || Exit 1
> > +$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
> > +$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
> >
> > -grep '/\./\./mkinstalldirs' Makefile.in
> > +:
>
> > --- a/tests/auxdir2.test
> > +++ b/tests/auxdir2.test
> > @@ -25,4 +25,6 @@ set -e
> > : > Makefile.am
> >
> > $ACLOCAL
> > -$AUTOMAKE
> > +$AUTOMAKE -a
>
> This changes the code paths exercised (i.e., potentially removes
> coverage);
>
Not really IMHO; the test is expected to fail anyway, and the
`-a' just help to ensure that it fails "for the right reason"
(i.e. use of computed AC_CONFIG_AUX_DIR, not missing auxiliary
file). That said ...
> please use either
> $AUTOMAKE -a
> $AUTOMAKE
>
> so that both are covered, or have one test with and one without -a.
> The former is more efficient.
>
... I've done this (the "former").
> > --- 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
>
> What happens with this command on w32? I checked:
> MinGW mkdir fails
> DJGPP mkdir fails
> Cygwin mkdir passes
>
> It seems that none of the systems actually cause harmful problems.
>
Good, because they shouldn't; this second, conditional check...
> > + AUTOMAKE_fails
> > + grep '^configure\.in:2:.*aux.*W32' stderr
> >
... serves just to ensure that Automake fails with a "correct" error
(i.e. about portability) even on platforms where the use of `aux' is
valid, and even when an `aux' directory actually exist.
> > +fi
> > +
> > +:
>
> > index 0000000..61b2720
> > --- /dev/null
> > +++ b/tests/auxdir5.test
> > @@ -0,0 +1,30 @@
>
> > +# Make sure we diagnose dangerous non-existent AC_CONFIG_AUX_DIR names.
>
> Why dangerous?
>
Copy&paste blunder.
> s/dangerous// ?
>
Yes.
> > +config_auxdir=nonesuch
> > +. ./defs || Exit 1
> > +
> > +set -e
> > +
> > +: > Makefile.am
> > +
> > +$ACLOCAL
> > +AUTOMAKE_fails
> > +grep '^configure\.in:2:.*nonesuch.* not exist' stderr
>
> I wonder whether we had a PR before suggesting to just create the
> directory. I guess I agree though that not creating it is safer,
> if a bit less convenient for the user.
>
Anyway, since this check was already present somehow (in older
auxdir4.test), I'd rather not remove it for now.
> > --- /dev/null
> > +++ b/tests/auxdir8.test
> > @@ -0,0 +1,132 @@
>
> > +# Make sure that, if AC_CONFIG_AUX_DIR is not specified, Automake tries
> > +# to use `.', `..' and `../..', in precisely that order.
>
> Hmm. This is an Autoconf feature actually, rather than an Automake one.
> But we also document it in automake.texi. Thus it is ok to have a test,
> but it would not really be necessary to test the Autoconf part of this.
> Hmm, but it seems you need to use/rely on both to do a full test. OK.
>
Well, you answered for me here :-)
> > +config_auxdir=NONE
> > +. ./defs || Exit 1
> > +
> > +set -e
> > +
> > +nil=__no_such_program
> > +unset NONESUCH || : # just to be sure
>
> "just to be sure" is a fairly meaningless comment. It actually made me
> wonder whether you meant the "|| :" or the "unset" part with it.
>
I meant the "unset" part.
> I'm not sure what you want to be sure of with the unset here.
>
That no `NONESUCH' variable is in the environment.
I've gone with this now:
# Make sure that we don't have a NONESUCH variable set
# in the environment.
unset NONESUCH || :
> > +# ------------------------------------------- #
> > +: We must end up with AC_CONFIG_AUX_DIR = . #
> > +# ------------------------------------------- #
> > +
> > +: > install-sh
> > +$AUTOMAKE
> > +./configure
> > +out=out0 $MAKE test
>
> I'd write
> env out=out0 ...
>
> here (and below), but only to make it clearer what is happening. No big
> deal either way, so use whatever you prefer. (It makes a difference
> when the command is a shell special one.)
>
Well, not using `env' means one less fork ;-)
And I'm pretty confident that `make' is not going to become a shell
builtin ;-)
Thanks,
Stefano
From b67bf44082d979660431a11fe168eb89d7dcd068 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sat, 8 May 2010 00:32:22 +0200
Subject: [PATCH] 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 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/auxdir9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
ChangeLog | 22 +++++++++
tests/Makefile.am | 5 ++
tests/Makefile.in | 5 ++
tests/auxdir.test | 17 ++++--
tests/auxdir2.test | 15 ++++--
tests/auxdir3.test | 4 +-
tests/auxdir4.test | 16 ++++--
tests/auxdir5.test | 36 ++++++++++++++
tests/auxdir6.test | 52 ++++++++++++++++++++
tests/auxdir7.test | 51 ++++++++++++++++++++
tests/auxdir8.test | 50 +++++++++++++++++++
tests/auxdir9.test | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 389 insertions(+), 17 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
create mode 100755 tests/auxdir9.test
diff --git a/ChangeLog b/ChangeLog
index 5afdc53..60c80ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2010-12-15 Stefano Lattarini <address@hidden>
+
+ 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 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/auxdir9.test: Likewise.
+ * tests/Makefile.am (TESTS): Updated.
+
2010-12-10 Ralf Wildenhues <address@hidden>
Avoid running installed automake from 'libtool --help'.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..9c27b8b 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 de21f43..fda0863 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 95a7a20..bb50d6f 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 <<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
+
+:
diff --git a/tests/auxdir2.test b/tests/auxdir2.test
index 590a5df..7936a2b 100755
--- a/tests/auxdir2.test
+++ b/tests/auxdir2.test
@@ -19,15 +19,20 @@
. ./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.
+$AUTOMAKE -a
$AUTOMAKE
+
+:
diff --git a/tests/auxdir3.test b/tests/auxdir3.test
index c828051..64fbd6a 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 0447809..38bf28f 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 <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
index 0000000..e44b8fb
--- /dev/null
+++ b/tests/auxdir5.test
@@ -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
index 0000000..4b3565a
--- /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 <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
index 0000000..67710b6
--- /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 <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
index 0000000..7d0c1ae
--- /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 <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
index 0000000..3ee1dbc
--- /dev/null
+++ b/tests/auxdir9.test
@@ -0,0 +1,133 @@
+#! /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
+# Make sure that we don't have a NONESUCH variable set
+# in the environment.
+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
+
+:
--
1.7.1
Re: [PATCH 0/2] Tests initialization: put default definition of AC_CONFIG_AUX_DIR in the pre-populated configure.in., Ralf Wildenhues, 2010/12/13