From 040471bbc9a23f57b06443417c558493c09ce3b5 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 28 Dec 2011 15:10:01 +0100 Subject: tests: reorganize and extend tests on aclocal search path(s) * tests/aclocal-search-path.tap: New test, supersedes and subsumes ... * tests/aclocal9.test: ... this test ... * tests/acloca11.test: ... and this one ... * tests/acloca12.test: ... and this one ... * tests/aclocal-acdir.test: ... and this one ... * tests/aclocal-path-nonexistent.test: ... and this one ... * tests/aclocal-path-precedence.test:: ... and this one ... * tests/aclocal-path.test: ... and this one ... * tests/dirlist-abspath.test: ... and this one ... * tests/dirlist.test: ... and this one ... * tests/dirlist2.test: ... and this one, all of which have accordingly been removed. * tests/list-of-tests.mk: Update. --- tests/acloca11.test | 45 --- tests/acloca12.test | 46 --- tests/aclocal-acdir.test | 95 ----- tests/aclocal-path-nonexistent.test | 34 -- tests/aclocal-path-precedence.test | 91 ----- tests/aclocal-path.test | 56 --- tests/aclocal-search-path.tap | 768 ++++++++++++++++++++++++++++++++++++ tests/aclocal9.test | 51 --- tests/dirlist-abspath.test | 42 -- tests/dirlist.test | 57 --- tests/dirlist2.test | 61 --- tests/list-of-tests.mk | 13 +- 12 files changed, 770 insertions(+), 589 deletions(-) delete mode 100755 tests/acloca11.test delete mode 100755 tests/acloca12.test delete mode 100755 tests/aclocal-acdir.test delete mode 100755 tests/aclocal-path-nonexistent.test delete mode 100755 tests/aclocal-path-precedence.test delete mode 100755 tests/aclocal-path.test create mode 100644 tests/aclocal-search-path.tap delete mode 100755 tests/aclocal9.test delete mode 100755 tests/dirlist-abspath.test delete mode 100755 tests/dirlist.test delete mode 100755 tests/dirlist2.test diff --git a/tests/acloca11.test b/tests/acloca11.test deleted file mode 100755 index 7ce0a4dd3..000000000 --- a/tests/acloca11.test +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -# Copyright (C) 2003, 2011 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 when two files define the same macro in the same -# directory, the macro from the lexically greatest file is used. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in << 'END' -AC_INIT -MACRO2 -MACRO1 -END - -mkdir m4 - -cat >m4/version1.m4 <m4/version2.m4 <. - -# Make sure that when two files define the same macro in the same -# directory, the macro from the lexically greatest file is used. -# Same as acloca11.test, but without calling MACRO2. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in <m4/version1.m4 <m4/version2.m4 <. - -# Test aclocal's `--acdir', `--automake-acdir' and `--system-acdir' -# options. Also check that stuff in the automake acdir takes precedence -# over stuff in the system acdir. - -. ./defs || Exit 1 - -mkdir am sys - -cat >> configure.in <<'END' -MY_MACRO -END - -cat > am/foo.m4 <<'END' -AC_DEFUN([AM_INIT_AUTOMAKE], [fake--init--automake]) -END - -cat > sys/foo.m4 <<'END' -AC_DEFUN([MY_MACRO], [my--macro]) -END - -$ACLOCAL --automake-acdir am -$AUTOCONF --force -$FGREP 'fake--init--automake' configure -$FGREP 'MY_MACRO' configure - -rm -rf autom4te*.cache - -$ACLOCAL --system-acdir sys -$AUTOCONF --force -$FGREP 'am__api_version' configure -$FGREP 'my--macro' configure - -rm -rf autom4te*.cache - -$ACLOCAL --automake-acdir am --system-acdir sys -$AUTOCONF --force -$FGREP 'fake--init--automake' configure -$FGREP 'my--macro' configure - -rm -rf autom4te*.cache - -$ACLOCAL --system-acdir sys --automake-acdir am -$AUTOCONF --force -$FGREP 'fake--init--automake' configure -$FGREP 'my--macro' configure - -rm -rf autom4te*.cache - -# Stuff in automake acdir takes precedence over stuff in system acdir. -cat > am/bar.m4 <<'END' -AC_DEFUN([MY_MACRO], [am--macro]) -END -$ACLOCAL --automake-acdir am --system-acdir sys -$AUTOCONF --force -$FGREP 'fake--init--automake' configure -$FGREP 'am--macro' configure -$FGREP 'my--macro' configure && Exit 1 # Just to be sure. - -rm -rf autom4te*.cache - -# Obsolescent `--acdir' option. -$ACLOCAL -Wobsolete --acdir am 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep '.*--acdir.*deprecated' stderr - -rm -rf autom4te*.cache - -$ACLOCAL -Wno-obsolete --acdir am -$AUTOCONF --force -$FGREP 'fake--init--automake' configure -$FGREP 'am--macro' configure - -rm -rf autom4te*.cache - -$ACLOCAL -Wno-obsolete --acdir sys 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep 'macro .*AM_INIT_AUTOMAKE.* not found' stderr - -: diff --git a/tests/aclocal-path-nonexistent.test b/tests/aclocal-path-nonexistent.test deleted file mode 100755 index 0be9938d3..000000000 --- a/tests/aclocal-path-nonexistent.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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 . - -# Non-existent directories in ACLOCAL_PATH are ok. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in << 'END' -AC_INIT -AM_FOO -END - -mkdir mdir -echo 'AC_DEFUN([AM_FOO], [am--foo])' > mdir/foo.m4 - -ACLOCAL_PATH=./nonesuch:./mdir:`pwd`/nonesuch2:nonesuch3 $ACLOCAL -$AUTOCONF -$FGREP 'am--foo' configure - -: diff --git a/tests/aclocal-path-precedence.test b/tests/aclocal-path-precedence.test deleted file mode 100755 index a9c864b46..000000000 --- a/tests/aclocal-path-precedence.test +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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 . - -# Check precedence rules for ACLOCAL_PATH. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in << 'END' -AC_INIT([foo], [1.0]) -AM_INIT_AUTOMAKE([parallel-tests]) -FOO_MACRO -BAR_MACRO -AC_PROG_LIBTOOL -AM_GNU_GETTEXT -END - -mkdir mdir1 mdir2 mdir3 sysdir extradir - -cat > mdir1/foo1.m4 << 'END' -AC_DEFUN([FOO_MACRO], [::pass-foo::]) -END - -cat > mdir2/foo2.m4 << 'END' -AC_DEFUN([FOO_MACRO], [::fail-foo::]) -END - -cat > mdir1/baz.m4 << 'END' -AC_DEFUN([BAR_MACRO], [::fail-bar::]) -END - -cat > mdir3/bar.m4 << 'END' -AC_DEFUN([BAR_MACRO], [::pass-bar::]) -END - -cat > mdir2/quux.m4 << 'END' -AC_DEFUN([AM_INIT_AUTOMAKE], [::fail-init::]) -AC_DEFUN([AC_PROG_LIBTOOL], [::pass-libtool::]) -AC_DEFUN([AM_GNU_GETTEXT], [::pass-gettext::]) -END - -cat > sysdir/libtool.m4 << 'END' -AC_DEFUN([AC_PROG_LIBTOOL], [::fail-libtool::]) -END - -cat > extradir/gettext.m4 << 'END' -AC_DEFUN([AM_GNU_GETTEXT], [::fail-gettext::]) -END - -echo ./extradir > sysdir/dirlist - -ACLOCAL_PATH=mdir1:mdir2 $ACLOCAL -I mdir3 --system-acdir sysdir -$AUTOCONF - -$FGREP '::' configure # For debugging. - -# Directories coming first in ACLOCAL_PATH should take precedence -# over those coming later. -$FGREP '::pass-foo::' configure - -# Directories from `-I' options should take precedence over directories -# in ACLOCAL_PATH. -$FGREP '::pass-bar::' configure - -# Directories in ACLOCAL_PATH should take precedence over system acdir -# (typically `${prefix}/share/aclocal'), and any directory added through -# the `dirlist' special file. -$FGREP '::pass-gettext::' configure -$FGREP '::pass-libtool::' configure - -# Directories in ACLOCAL_PATH shouldn't take precedence over the internal -# automake acdir (typically `${prefix}/share/aclocal-${APIVERSION}'). -$FGREP 'am__api_version' configure - -# A final sanity check. -$FGREP '::fail' configure && Exit 1 - -: diff --git a/tests/aclocal-path.test b/tests/aclocal-path.test deleted file mode 100755 index 42c682014..000000000 --- a/tests/aclocal-path.test +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011 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 . - -# Check basic ACLOCAL_PATH support. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in << 'END' -AC_INIT -AM_FOO_MACRO -AM_BAR_MACRO -AM_BAZ_MACRO -END - -mkdir mdir1 mdir2 mdir3 - -cat > mdir1/foo.m4 << 'END' -AC_DEFUN([AM_FOO_MACRO], [am--foo]) -END - -cat > mdir2/bar.m4 << 'END' -AC_DEFUN([AM_BAR_MACRO], [am--bar]) -END - -cat > mdir3/baz.m4 << 'END' -AC_DEFUN([AM_BAZ_MACRO], [am--baz]) -END - -ACLOCAL_PATH=mdir1:./mdir2:`pwd`/mdir3 $ACLOCAL -$AUTOCONF - -# there should be no m4_include in aclocal.m4, even though ACLOCAL_PATH -# contains `mdir1' and `./mdir2' as relative directories. Only -I -# directories should be subject to file inclusion. -$FGREP m4_include aclocal.m4 && Exit 1 - -$EGREP 'AM_(FOO|BAR|BAZ)_MACRO' configure && Exit 1 -$FGREP 'am--foo' configure -$FGREP 'am--bar' configure -$FGREP 'am--baz' configure - -: diff --git a/tests/aclocal-search-path.tap b/tests/aclocal-search-path.tap new file mode 100644 index 000000000..894a1ad52 --- /dev/null +++ b/tests/aclocal-search-path.tap @@ -0,0 +1,768 @@ +#! /bin/sh +# Copyright (C) 2011 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 . + +# Check the various ways to extend/influence aclocal search path, and +# the interactions and precedences among them. +# This test does not cover the `--install' option. +# FIXME: add proper reference to the test(s) covering it. + +am_create_testdir=empty +. ./defs || Exit 1 + +plan_ 51 + +## ----------------------------------------------- ## +## Shared initialization and common subroutines. ## +## ----------------------------------------------- ## + +unset ACLOCAL_PATH || : + +ocwd=`pwd` || fatal_ "cannot get current working directory" + +start_testgroup () +{ + cd "$ocwd" \ + || fatal_ "failed to chdir back to $ocwd" + mkdir "$1.d" && cd "$1.d" \ + || framework_failure_ "setting up directory $1.d" +} + +end_testgroup () +{ + cd "$ocwd" || fatal_ "failed to chdir back to $ocwd" +} + +# Usage: check_expanded --description TEXT [--output LIST-OF-STRINGS] +# [--not-output LIST-OF-STRINGS] [--] ACLOCAL-CMD +check_expanded () +{ + # `ce__' prefix to avoid conflicts with global or other subroutine's + # variables; this has already happened in practice. + ce__description= + ce__output= + ce__no_output= + ce__r=ok + while test $# -gt 0; do + case $1 in + --output) ce__output="$ce__output $2"; shift;; + --no-output) ce__no_output="$ce__no_output $2"; shift;; + --desc*) ce__description=$2; shift;; + --) shift; break;; + -*) fatal_ "check_expanded: invalid option \`$1'";; + *) break;; + esac + shift + done + if "$@" && test -f aclocal.m4 && $AUTOCONF; then + for str in $ce__output; do + $FGREP "$str" configure || ce__r='not ok' + done + for str in $ce__no_output; do + $FGREP "$str" configure && ce__r='not ok' + done + else + ce__r='not ok' + fi + result_ "$ce__r" "$ce__description" +} + + +## -------------------------------------------------------------------- ## +## Setup H0: for options used to override system and automake acdirs. ## +## -------------------------------------------------------------------- ## + +mkdir H0 H0/am H0/sys + +cat > H0/configure.in <<'END' +AC_INIT([foo], [1.0]) +AM_INIT_AUTOMAKE +MY_MACRO +END + +cat > H0/am/foo.m4 <<'END' +AC_DEFUN([AM_INIT_AUTOMAKE], [fake--init--automake]) +END + +cat > H0/sys/foo.m4 <<'END' +AC_DEFUN([MY_MACRO], [my--macro]) +END + +## -------------------------- ## +## Option --automake-acdir. ## +## -------------------------- ## + +start_testgroup automake-acdir +cp ../H0/configure.in . +command_ok_ "option --automake-acdir" eval ' + $ACLOCAL --automake-acdir "$ocwd"/H0/am \ + && $AUTOCONF \ + && $FGREP "fake--init--automake" configure \ + && $FGREP "MY_MACRO" configure' +end_testgroup + +## ------------------------ ## +## Option --system-acdir. ## +## ------------------------ ## + +start_testgroup system-acdir +cp ../H0/configure.in . +command_ok_ "option --system-acdir" eval ' + $ACLOCAL --system-acdir "$ocwd"/H0/sys \ + && $AUTOCONF \ + && $FGREP "am__api_version" configure \ + && $FGREP "my--macro" configure' +end_testgroup + +## ------------------------------------------------------------------- ## +## Options --automake-acdir and --system-acdir can be used together. ## +## ------------------------------------------------------------------- ## + +start_testgroup both-system-automake-acdir +cp -fR ../H0/* . +command_ok_ "options --system-acdir and --automake-acdir together" eval ' + $ACLOCAL --automake-acdir am --system-acdir sys \ + && $AUTOCONF \ + && $FGREP "fake--init--automake" configure \ + && $FGREP "my--macro" configure' +end_testgroup + +## ------------------------------------------------------------------ ## +## Option --acdir option is diagnosed as obsolete, but still works. ## +## ------------------------------------------------------------------ ## + +start_testgroup obsolete-acdir +cp ../H0/configure.in . +st=0; $ACLOCAL -Wobsolete --acdir ../H0/am 2>stderr || st=$? +cat stderr >&2 +command_ok_ "option --acdir is diagnosed as obsolete" \ + eval 'test $st -gt 0 && grep ".*--acdir.*deprecated" stderr' +end_testgroup + +start_testgroup option-acdir-1 +cp -fR ../H0/* . +echo 'AC_DEFUN([MY_MACRO], [am--macro])' > am/bar.m4 +command_ok_ "option --acdir works (1)" eval ' + $ACLOCAL -Wno-obsolete --acdir am \ + && $AUTOCONF \ + && $FGREP "fake--init--automake" configure \ + && $FGREP "am--macro" configure' +end_testgroup + +start_testgroup option-acdir-2 +cp -fR ../H0/* . +command_ok_ "option --acdir works (2)" eval ' + not $ACLOCAL -Wno-obsolete --acdir sys 2>stderr \ + && cat stderr >&2 \ + && grep "macro .*AM_INIT_AUTOMAKE.* not found" stderr' +end_testgroup + + +## --------------------------------------------------------------------- ## +## Setup H1: for tests on basic ACLOCAL_PATH, dirlist, and `-I' usage. ## +## --------------------------------------------------------------------- ## + +mkdir H1 H1/foodir H1/bardir H1/bazdir + +cat > H1/foodir/a.m4 < H1/bardir/b.m4 < H1/bazdir/c.m4 < H1/configure.in < acdir/dirlist < acdir/dirlist < H2/foodir/blah.m4 < H2/configure.in < configure.in + st=0; $ACLOCAL -Wnone -Wno-error -I "$dirpath" 2>stderr || st=$? + cat stderr >&2 + r=ok + test $st -eq 1 \ + && test ! -f aclocal.m4 \ + && grep "open.*directory.*$dirpath" stderr \ + || r='not ok' + result_ "$r" "aclocal complains if -I $dirname is non-existent" +} + +start_testgroup I-nonexistent +check_nosuchdir_err nonesuch +end_testgroup + +start_testgroup I-nonexistent-abspath +check_nosuchdir_err "`pwd`/nonesuch" +end_testgroup + +## --------------------------------------------- ## +## Non-existent directories in dirlist are OK. ## +## --------------------------------------------- ## + +start_testgroup dirlist-nonexistent + +mkdir acdir +cat > acdir/dirlist < H3/dir1/foo.m4 <<'END' +AC_DEFUN([AM_FOO], [::foo-1::]) +END + +cat > H3/dir2/bar.m4 <<'END' +AC_DEFUN([AM_FOO], [::foo-2::]) +END + +cat > H3/configure.in << 'END' +AC_INIT +AM_FOO +END + +# Usage: check_precedence DESC WINNER-NUMBER ACLOCAL-COMMAND [ARGS..] +check_precedence () +{ + desc=$1 winnum=$2; shift; shift; + cp -fR "$ocwd"/H3/* . + check_expanded \ + --description "earlier $desc take precedence (simple usage, $winnum)" \ + --output "::foo-$winnum::" "$@" +} + +## ----------------------------------- ## +## Precedences between several `-I'. ## +## ----------------------------------- ## + +start_testgroup precedence-basic-local + +mkdir a && cd a || Exit 99 +check_precedence "-I dirs" 1 $ACLOCAL -I dir1 -I dir2 +cd .. + +mkdir b && cd b || Exit 99 +check_precedence "-I dirs" 2 $ACLOCAL -I dir2 -I dir1 +cd .. + +end_testgroup + +## ------------------------------------------- ## +## Precedences between ACLOCAL_PATH entries. ## +## ------------------------------------------- ## + +start_testgroup precedence-aclocal-path + +mkdir a && cd a || Exit 99 +check_precedence "ACLOCAL_PATH entries" 1 env ACLOCAL_PATH=dir1:dir2 $ACLOCAL +cd .. + +mkdir b && cd b || Exit 99 +check_precedence "ACLOCAL_PATH entries" 2 env ACLOCAL_PATH=dir2:dir1 $ACLOCAL +cd .. + +end_testgroup + +## -------------------------------------- ## +## Precedences between dirlist entries. ## +## -------------------------------------- ## + +start_testgroup precedence-dirlist + +mkdir a && cd a || Exit 99 +mkdir sdir +(echo dir1 && echo dir2) > sdir/dirlist +check_precedence "dirlist entries" 1 $ACLOCAL --system-acdir sdir +cd .. + +mkdir b && cd b || Exit 99 +mkdir sdir +(echo dir2 && echo dir1) > sdir/dirlist +check_precedence "dirlist entries" 2 $ACLOCAL --system-acdir sdir +cd .. + +end_testgroup + + +## ------------------------------------------------------------- ## +## Setup H4: for trickier tests on precedence in ACLOCAL_PATH, ## +## dirlist and `-I' options. ## +## ------------------------------------------------------------- ## + +mkdir H4 H4/adir H4/zdir + +cat > H4/zdir/foo.m4 <<'END' +AC_DEFUN([AM_FOO], [::foo-z::]) +END + +cat > H4/adir/foo.m4 <<'END' +AC_DEFUN([AM_FOO], [::foo-a::]) +AC_DEFUN([AM_BAR], [::bar-a::]) +END + +cat > H4/configure.1 << 'END' +AC_INIT +AM_FOO +AM_BAR +END + +# Try also with the macro calls reversed (it did make a difference). +cat > H4/configure.2 << 'END' +AC_INIT +AM_BAR +AM_FOO +END + +# Usage: check_precedence_trickier DESCRIPTION ACLOCAL-COMMAND [ARGS..] +check_precedence_trickier () +{ + desc=$1; shift + for i in 1 2; do + mkdir $i.d + cd $i.d + cp -fR "$ocwd"/H4/* . + mv -f configure.$i configure.in + check_expanded \ + --description "$desc (trickier usage, $i)" \ + --output "::foo-z:: ::bar-a::" --no-output "::foo-a::" \ + "$@" + cd .. + done +} + +## ------------------------------------------------------ ## +## Precedences between `-I' options, trickier scenario. ## +## ------------------------------------------------------ ## + +start_testgroup precedence-trickier-local +check_precedence_trickier "earlier -I dirs take precedence" \ + $ACLOCAL -I zdir -I adir +end_testgroup + +## --------------------------------------------------------- ## +## Precedences between dirlist entries, trickier scenario. ## +## --------------------------------------------------------- ## + +start_testgroup precedence-trickier-dirlist +mkdir sdir +cat > sdir/dirlist < H5/configure.in << 'END' +AC_INIT([mu], [1.0]) +AM_INIT_AUTOMAKE +AM_SILENT_RULES +FOO_MACRO +BAR_MACRO +AC_PROG_LIBTOOL +END + +cat > H5/local-dir/a.m4 << 'END' +AC_DEFUN([FOO_MACRO], [::foo-local::]) +END +cat > H5/local-dir/silent.m4 << 'END' +AC_DEFUN([AM_SILENT_RULES], [::silent-rules-local::]) +END + +cat > H5/acpath-dir/a.m4 << 'END' +AC_DEFUN([FOO_MACRO], [::foo-acpath::]) +END +cat > H5/acpath-dir/b.m4 << 'END' +AC_DEFUN([BAR_MACRO], [::bar-acpath::]) +END +cat > H5/acpath-dir/init.m4 << 'END' +AC_DEFUN([AM_INIT_AUTOMAKE], [::am-acpath::]) +END + +cat > H5/dirlist-dir/a.m4 << 'END' +AC_DEFUN([FOO_MACRO], [::foo-dirlist::]) +END +cat > H5/dirlist-dir/b.m4 << 'END' +AC_DEFUN([BAR_MACRO], [::bar-dirlist::]) +END +cat > H5/dirlist-dir/x.m4 << 'END' +AC_DEFUN([AC_PROG_LIBTOOL], [::libtool-dirlist::]) +END +cat > H5/dirlist-dir/init.m4 << 'END' +AC_DEFUN([AM_INIT_AUTOMAKE], [::am-dirlist::]) +END + +cat > H5/acsys-dir/a.m4 << 'END' +AC_DEFUN([FOO_MACRO], [::foo-acsys::]) +END +cat > H5/acsys-dir/b.m4 << 'END' +AC_DEFUN([BAR_MACRO], [::bar-acsys::]) +END +cat > H5/acsys-dir/c.m4 << 'END' +AC_DEFUN([AC_PROG_LIBTOOL], [::libtool-acsys::]) +END +cat > H5/acsys-dir/init.m4 << 'END' +AC_DEFUN([AM_INIT_AUTOMAKE], [::am-acsys::]) +END + +echo ./dirlist-dir > H5/acsys-dir/dirlist + +check_precedence_hodgepodge () +{ + moredesc=${1+"[$1]"} + + check_expanded \ + --description "many aclocal search paths at the same time $moredesc" \ + env ACLOCAL_PATH=acpath-dir $ACLOCAL -I local-dir --system-acdir acsys-dir + + $FGREP :: configure # For debugging. + + command_ok_ \ + "-I takes precedence over automake private macros $moredesc" \ + $FGREP '::silent-rules-local::' configure + + command_ok_ \ + "-I takes precedence over everything else $moredesc" \ + $FGREP '::foo-local::' configure + + # Files in automake's "private" acdir-APIVERSION takes precedence over + # everything else *but* stuff in -I dirs. + # FIXME: this might be changed in future automake versions. + command_ok_ \ + "acdir-APIVERSION take precedence over everything but -I $moredesc" \ + eval ' not $FGREP ::am- configure && $FGREP "am__api_version" configure' + + command_ok_ \ + "ACLOCAL_PATH take precedence over dirlist and acdir $moredesc" \ + $FGREP '::bar-acpath::' configure + + # FIXME: this might be changed in future automake versions. + command_ok_ \ + "acdir takes precedence over dirlist $moredesc" \ + $FGREP '::libtool-acsys::' configure +} + +## ------------------------------------------------------------------ ## +## Precedences between different components of the aclocal search ## +## path: -I option, ACLOCAL_PATH environment variable, dirlist file ## +## and system acdir. ## +## ------------------------------------------------------------------ ## + +start_testgroup precedence-hodgepodge +cp -fR ../H5/* . +check_precedence_hodgepodge +end_testgroup + +## -------------------------------------------------------------------- ## +## The same as above, but with serial number (which should be ignored ## +## when `--install' is not used) and different names for the `.m4' ## +## files (which shouldn't make any difference). ## +## -------------------------------------------------------------------- ## + +start_testgroup precedence-hodgepodge-serial + +cp -fR ../H5/* . + +i=0 +for d in local-dir acpath-dir dirlist-dir acsys-dir; do + i=`expr $i + 1` + cd $d + for f in *.m4; do + echo "# serial $i" > t + cat $f >> t + mv -f t $i$f + rm -f $f + cat $i$f # For debugging. + done + pwd && ls -l # For debugging. + cd .. +done + +check_precedence_hodgepodge "varied names and serials" + +end_testgroup + + +## -------------------------------------------------------------------- ## +## Setup H6: for tests checking that, when two files define the same ## +## macro in the same directory, the macro from the lexically greatest ## +## file is used. ## +## -------------------------------------------------------------------- ## + +mkdir H6 + +mkdir H6/1 H6/1/m4 +cat > H6/1/configure.in < H6/1/m4/version1.m4 < H6/1/m4/version2.m4 <> H6/2/configure.in + +check_lexicographic_precedence_1 () +{ + desc=$1; shift + check_expanded \ + --description "in the same $desc, lexicographic order is used (1)" \ + --output "::macro12::" --no-output "::macro11 ::macro21::" \ + "$@" +} + +check_lexicographic_precedence_2 () +{ + desc=$1; shift + check_expanded \ + --description "in the same $desc, lexicographic order is used (2)" \ + --output "::macro12:: ::macro21::" --no-output "::macro11::" \ + "$@" +} + + +for i in 1 2; do + + ## ---------------------------------------------------------------- ## + ## Lexicographic precedence for files in the same `-I' directory. ## + ## ---------------------------------------------------------------- ## + + start_testgroup lexical-precedence-local-$i + cp -fR ../H6/$i/* . + check_lexicographic_precedence_$i "'-I' directory" $ACLOCAL -I m4 + end_testgroup + + ## ------------------------------------------------------------- ## + ## Lexicographic precedence for files in the same ACLOCAL_PATH ## + ## directory. ## + ## ------------------------------------------------------------- ## + + start_testgroup lexical-precedence-aclocal-path-$i + cp -fR ../H6/$i/* . + check_lexicographic_precedence_$i "ACLOCAL_PATH entry" \ + env ACLOCAL_PATH=m4 $ACLOCAL + end_testgroup + + ## ------------------------------------------------------------------- ## + ## Lexicographic precedence for files in the same dirlist directory. ## + ## ------------------------------------------------------------------- ## + + start_testgroup lexical-precedence-dirlist-$i + cp -fR ../H6/$i/* . + mkdir acdir + echo ./m4 > acdir/dirlist + check_lexicographic_precedence_$i "dirlist entry" \ + $ACLOCAL --system-acdir acdir + end_testgroup + + ## ----------------------------------------------------------------- ## + ## Lexicographic precedence for files in the same acdir directory. ## + ## ----------------------------------------------------------------- ## + + start_testgroup lexical-precedence-acdir-$i + cp -fR ../H6/$i/* . + mv -f m4 acdir + check_lexicographic_precedence_$i "system-wide acdir" \ + $ACLOCAL --system-acdir acdir + end_testgroup + +done + +: diff --git a/tests/aclocal9.test b/tests/aclocal9.test deleted file mode 100755 index 16cdecd11..000000000 --- a/tests/aclocal9.test +++ /dev/null @@ -1,51 +0,0 @@ -#! /bin/sh -# Copyright (C) 2003, 2010, 2011 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 aclocal define macros in the same order as -I's. - -am_create_testdir=empty -. ./defs || Exit 1 - -cat > configure.in << 'END' -AC_INIT -MACRO1 -MACRO2 -END - -mkdir m4_1 m4_2 - -cat >m4_1/somedefs.m4 <m4_2/somedefs.m4 <. - -# Check use of absolute paths in dirlist. - -am_create_testdir=empty -. ./defs || Exit 1 - -mkdir acdir-more sub sub/acdir -echo "`pwd`/acdir-more" > sub/acdir/dirlist - -echo 'AC_DEFUN([AM_FOO], [foo-foo--foo])' > acdir-more/foo.m4 - -cd sub - -cat > configure.in <. - -# Check dirlist support. - -. ./defs || Exit 1 - -cat > configure.in < acdir/dirlist - -cat >dirlist-test/dirlist-check.m4 <<'END' -AC_DEFUN([AM_INIT_GUILE_MODULE],[ -. $srcdir/../GUILE-VERSION -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) -AC_CONFIG_AUX_DIR(..) -module=[$1] -AC_SUBST(module)]) -END - -cat >dirlist-test/init.m4 <. - -# Check dirlist globbing support. - -. ./defs || Exit 1 - -cat > configure.in <dirlist21-test/dirlist21-check.m4 <<'END' -AC_DEFUN([AM_INIT_GUILE_MODULE],[ -. $srcdir/../GUILE-VERSION -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) -AC_CONFIG_AUX_DIR(..) -module=[$1] -AC_SUBST(module)]) -END - -cat >dirlist22-test/dirlist22-check.m4 <<'END' -AC_DEFUN([AM_FOO_BAR],[ -: foo bar baz -]) -END - -mkdir my-acdir -cat > my-acdir/dirlist <<'END' -dirlist2*-test -END - -$ACLOCAL --system-acdir my-acdir -$AUTOCONF - -# There should be no m4_include in aclocal.m4, even though m4/dirlist -# contains `./dirlist-test' as a relative directory. Only -I directories -# are subject to file inclusion. -grep m4_include aclocal.m4 && Exit 1 - -grep 'GUILE-VERSION' configure -grep 'foo bar baz' configure - -: diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index 6ccca5dc3..daf420abf 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -32,10 +32,7 @@ aclocal5.test \ aclocal6.test \ aclocal7.test \ aclocal8.test \ -aclocal9.test \ acloca10.test \ -acloca11.test \ -acloca12.test \ acloca13.test \ acloca14.test \ acloca15.test \ @@ -47,14 +44,11 @@ acloca20.test \ acloca21.test \ acloca22.test \ acloca23.test \ -aclocal-acdir.test \ -aclocal-install-absdir.test \ +aclocal-search-path.tap \ aclocal-print-acdir.test \ -aclocal-path.test \ +aclocal-install-absdir.test \ aclocal-path-install.test \ aclocal-path-install-serial.test \ -aclocal-path-nonexistent.test \ -aclocal-path-precedence.test \ ac-output-old.tap \ acsilent.test \ acsubst.test \ @@ -324,9 +318,6 @@ depend5.test \ depend6.test \ deprecated-acinit.test \ destdir.test \ -dirlist.test \ -dirlist2.test \ -dirlist-abspath.test \ discover.test \ dist-auxdir-many-subdirs.test \ dist-auxfile-2.test \ -- cgit v1.2.1