From: Stefano Lattarini Date: Thu, 28 Jun 2012 13:57:28 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7721f22a2c0f5b286d04427d011351602341de02;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: cosmetics: remove trailing whitespace in some files coverage: enhance tests in 'missing' script a little coverage: tests AM_MISSING_PROG usage docs: document AM_MISSING_PROG tests: fix a spurious failure with Solaris make tests: simpler workaround for shells losing the exit status in exit trap tests: avoid several spurious failures on Solaris tests: avoid a spurious failure on NetBSD + Extra non-trivial edits: * Several tests: Adjusted to use 'exit' rather than 'Exit'. Signed-off-by: Stefano Lattarini --- 7721f22a2c0f5b286d04427d011351602341de02 diff --cc gen-testsuite-part index 460ec6357,002136263..28fb3d28f --- a/gen-testsuite-part +++ b/gen-testsuite-part @@@ -89,19 -89,18 +89,16 @@@ sub write_wrapper_script ($$$ print $file_handle unindent <&2 + w="\$am_top_srcdir/$wrapped_test" + if test -f "\$w"; then + echo "\$0: will source '\$w'" + . "\$w" - exit "\$?" - else - echo "\$0: cannot find wrapped test '\$w'" >&2 - exit '99' ++ exit \$? + fi ++ echo "\$0: cannot find wrapped test '\$w'" >&2 + exit 99 EOF } diff --cc t/all-prog-libs.sh index 1857a45e2,000000000..60da56c2d mode 100755,000000..100755 --- a/t/all-prog-libs.sh +++ b/t/all-prog-libs.sh @@@ -1,85 -1,0 +1,85 @@@ +#! /bin/sh +# Copyright (C) 2007-2012 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 internal automake variables: +# - $(am__all_progs). +# - $(am__all_libs). +# - $(am__all_ltlibs). + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_SUBST([CC], [who-cares]) +m4_define([AM_PROG_AR], [AC_SUBST([AR], [who-cares])]) +AM_PROG_AR +AC_SUBST([RANLIB], [who-cares]) +AC_SUBST([LIBTOOL], [who-cares]) +AC_SUBST([EXEEXT], ['']) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = no-dependencies + +check_PROGRAMS = p1 +check_LIBRARIES = lib01.a +check_LTLIBRARIES = lib1.la +check_SCRIPTS = x1 + +EXTRA_PROGRAMS = p2 +EXTRA_LIBRARIES = lib02.a +EXTRA_LTLIBRARIES = lib2.la +EXTRA_SCRIPTS = x2 + +bin_PROGRAMS = p3 +lib_LIBRARIES = lib03.a +lib_LTLIBRARIES = lib3.la +bin_SCRIPTS = x3 + +noinst_PROGRAMS = p4 +noinst_LIBRARIES = lib04.a +noinst_LTLIBRARIES = lib4.la +noinst_SCRIPTS = x4 + +mydir = $(prefix) +my_PROGRAMS = p5 +my_LIBRARIES = lib05.a +my_LTLIBRARIES = lib5.la +my_SCRIPTS = x5 + +.PHONY: debug test +debug: + @echo PROGS-BEG: $(am__all_progs) :PROGS-END + @echo LIBS-BEG: $(am__all_libs) :LIBS-END + @echo LTLIBS-BEG: $(am__all_ltlibs) :LTLIBS-END +test: debug + test '$(am__all_progs)' = 'p1 p2 p3 p4 p5' + test '$(am__all_libs)' = 'lib01.a lib02.a lib03.a lib04.a lib05.a' + test '$(am__all_ltlibs)' = 'lib1.la lib2.la lib3.la lib4.la lib5.la' +END + +: > ltmain.sh + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure +$MAKE test +$MAKE test EXEEXT=.exe +$MAKE test EXEEXT=.bin + +: diff --cc t/am-dir.sh index f3026598b,000000000..373fa4ff3 mode 100755,000000..100755 --- a/t/am-dir.sh +++ b/t/am-dir.sh @@@ -1,92 -1,0 +1,92 @@@ +#! /bin/sh +# Copyright (C) 2012 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 support for private automake working directory in builddir: +# +# * internal variables: +# $(am__dir) +# $(am__abs_dir) +# $(am__top_dir) +# $(am__abs_top_dir) +# +# * cleaning rules and "make distcheck" interaction. +# + - . ./defs || Exit 1 ++. ./defs || exit 1 + +d=.am + +cat >> configure.ac <<'END' +AC_CONFIG_FILES([xsrc/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +SUBDIRS = . xsrc +all-local: | $(am__dir) +END + +mkdir xsrc +cat >> xsrc/Makefile.am <<'END' +subdir: + mkdir $@ +all-local: | $(am__dir) subdir + : > $(am__dir)/sub + : > $(am__top_dir)/top + (cd ./subdir && : > $(am__abs_dir)/abs-sub) + rmdir subdir + (cd /tmp && : > $(am__abs_top_dir)/abs-top) +END + +sort > exp < got + cat $srcdir/exp + cat got + diff $srcdir/exp got +} + +mkdir build +cd build +do_check .. + +cd .. +do_check . + +$MAKE distcheck +$MAKE clean +test -d $d +$MAKE distclean +test ! -e $d + +: diff --cc t/amopts-variable-expansion.sh index 1c085b224,bc0daea28..830373a59 --- a/t/amopts-variable-expansion.sh +++ b/t/amopts-variable-expansion.sh @@@ -16,8 -16,7 +16,8 @@@ # Check that AUTOMAKE_OPTIONS support variable expansion. +am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 # We want complete control over automake options. AUTOMAKE=$am_original_AUTOMAKE @@@ -47,16 -43,10 +47,16 @@@ foo_SOURCES = sub/foo. install: END +: > compile +: > missing +: > depcomp +: > install-sh + $ACLOCAL AUTOMAKE_run -grep '^Makefile\.am:.*:=.*not portable' stderr +grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr - grep README stderr && Exit 1 - $EGREP '(install|override)' stderr && Exit 1 - $EGREP 'distdir|\.tar' Makefile.in && Exit 1 + grep README stderr && exit 1 + $EGREP '(install|override)' stderr && exit 1 ++$EGREP 'distdir|\.tar' Makefile.in && exit 1 : diff --cc t/autodist-configure-no-subdir.sh index 93e7f5f13,a48a0a76c..458142c5d --- a/t/autodist-configure-no-subdir.sh +++ b/t/autodist-configure-no-subdir.sh @@@ -14,11 -14,11 +14,11 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check that 'configure', 'configure.ac' and 'configure.in' are *not* -# automatically distributed when placed in a subdirectory. +# Check that 'configure' and 'configure.ac' are *not* automatically +# distributed when placed in a subdirectory. # Related to automake bug#7819. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <. + +# Dependency tracking in the face of added/removed/renamed files. +# This is meant to be sourced by other the tests, after they've +# set the variables '$xdir' and '$vpath' appropriately. + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +test x${xdir+"set"} = x"set" || fatal_ "\$xdir is unset" +test x${vpath+"set"} = x"set" || fatal_ "\$vpath is unset" + +if test $vpath = no; then + srcdir=. +elif test $vpath = yes; then + srcdir=.. +else + fatal_ "invalid value for \$vpath: '$vpath'" +fi + +if test -z "$xdir"; then + thedir=$srcdir +else + thedir=$srcdir/$xdir + xdir=$xdir/ +fi + + +finalize_edit () +{ - diff "$1" t && Exit 1 ++ diff "$1" t && exit 1 + mv -f t "$2" +} + +func_subst () +{ + subst=$1; shift + for file + do + sed "$subst" "$file" > t + finalize_edit "$subst" "$file" + done +} + +prepend () +{ + cat "$1" "$2" > t + finalize_edit "$@" +} + +if cross_compiling; then + grep_prog_out () { :; } +else - grep_prog_out () { ./prg && ./prg | grep "$1" || Exit 1; } ++ grep_prog_out () { ./prg && ./prg | grep "$1" || exit 1; } +fi + +echo AC_PROG_CC >> configure.ac +echo AM_PROG_AR >> configure.ac +echo AC_PROG_RANLIB >> configure.ac +test -z "$xdir" || echo AM_PROG_CC_C_O >> configure.ac +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am < ${xdir}foo.h + +cat > ${xdir}main.c << 'END' +#include "foo.h" +#include +int main (void) +{ + printf ("%s\n", THE_STRING); + return 0; +} +END + +sed 's/main/niam/' ${xdir}main.c > ${xdir}niam.c + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + - test $vpath = no || { mkdir build && cd build; } || Exit 99 ++test $vpath = no || { mkdir build && cd build; } || exit 99 + +$srcdir/configure --enable-dependency-tracking +$MAKE +grep_prog_out foofoofoo # Sanity check. + +EXEEXT=`$MAKE -s --no-print-directory get-exeext` \ + || fatal_ "cannot get \$EXEEXT" + +# Modify an header file. +$sleep +echo '#define THE_STRING "oofoofoof"' > $thedir/foo.h +$MAKE +is_newest prg$EXEEXT $thedir/foo.h +is_newest liber.a $thedir/foo.h +grep_prog_out oofoofoof + +# Rename an header file. +$sleep +mv $thedir/foo.h $thedir/foo2.h +func_subst 's|foo\.h|foo2.h|' $thedir/main.c $thedir/niam.c +$MAKE +is_newest prg$EXEEXT $thedir/main.c +is_newest liber.a $thedir/niam.c +grep_prog_out oofoofoof + +# Add an header file, modify another one. +$sleep +mv $thedir/foo2.h $thedir/bar.h +echo '#include "bar.h"' > $thedir/foo2.h +$MAKE +grep_prog_out oofoofoof +is_newest prg$EXEEXT $thedir/foo2.h +is_newest liber.a $thedir/foo2.h + +# Remove an header file, modify another one. +$sleep +echo '#define THE_STRING "bazbazbaz"' > $thedir/foo2.h +rm -f $thedir/bar.h +$MAKE +is_newest prg$EXEEXT $thedir/foo2.h +is_newest liber.a $thedir/foo2.h +grep_prog_out bazbazbaz + +# Add two header files, rename another file. +$sleep +echo '#define S_ONE "zar"' > $thedir/1.h +echo '#define S_TWO "doz"' > $thedir/2.h +cat > $thedir/baz.h <<'END' +#include "1.h" +#include "2.h" +#define THE_STRING S_ONE S_TWO +END +func_subst 's|foo2\.h|baz.h|' $thedir/main.c $thedir/niam.c +rm -f $thedir/foo2.h +$MAKE +is_newest prg$EXEEXT $thedir/*.[ch] +is_newest liber.a $thedir/*.[ch] +grep_prog_out zardoz + +# Check the distribution. +$sleep +echo prg_SOURCES += ${xdir}baz.h ${xdir}1.h ${xdir}2.h >> $srcdir/Makefile.am +$MAKE distcheck + +: diff --cc t/ax/test-init.sh index ba3c1e6ce,d9f472996..c8b6c32e5 --- a/t/ax/test-init.sh +++ b/t/ax/test-init.sh @@@ -319,14 -323,124 +321,14 @@@ extract_configure_help ( grep_configure_help () { ./configure --help > am--all-help \ - || { cat am--all-help; Exit 1; } + || { cat am--all-help; exit 1; } cat am--all-help extract_configure_help "$1" am--all-help > am--our-help \ - || { cat am--our-help; Exit 1; } + || { cat am--our-help; exit 1; } cat am--our-help - $EGREP "$2" am--our-help || Exit 1 + $EGREP "$2" am--our-help || exit 1 } -# using_gmake -# ----------- -# Return success if $MAKE is GNU make, return failure otherwise. -# Caches the result for speed reasons. -using_gmake () -{ - case $am__using_gmake in - yes) - return 0;; - no) - return 1;; - '') - # Use --version AND -v, because SGI Make doesn't fail on --version. - # Also grep for GNU because newer versions of FreeBSD make do - # not complain about --version (they seem to silently ignore it). - if $MAKE --version -v | grep GNU; then - am__using_gmake=yes - return 0 - else - am__using_gmake=no - return 1 - fi;; - *) - fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";; - esac -} -am__using_gmake="" # Avoid interferences from the environment. - -# make_can_chain_suffix_rules -# --------------------------- -# Return 0 if $MAKE is a make implementation that can chain suffix rules -# automatically, return 1 otherwise. Caches the result for speed reasons. -make_can_chain_suffix_rules () -{ - if test -z "$am__can_chain_suffix_rules"; then - if using_gmake; then - am__can_chain_suffix_rules=yes - return 0 - else - mkdir am__chain.dir$$ - cd am__chain.dir$$ - unindent > Makefile << 'END' - .SUFFIXES: .u .v .w - .u.v: ; cp $< $@ - .v.w: ; cp $< $@ -END - echo make can chain suffix rules > foo.u - if $MAKE foo.w && diff foo.u foo.w; then - am__can_chain_suffix_rules=yes - else - am__can_chain_suffix_rules=no - fi - cd .. - rm -rf am__chain.dir$$ - fi - fi - case $am__can_chain_suffix_rules in - yes) return 0;; - no) return 1;; - *) fatal_ "make_can_chain_suffix_rules: internal error";; - esac -} -am__can_chain_suffix_rules="" # Avoid interferences from the environment. - -# useless_vpath_rebuild -# --------------------- -# Tell whether $MAKE suffers of the bug triggering automake bug#7884. -# For example, this happens with FreeBSD make, since in a VPATH build -# it tends to rebuilt files for which there is an explicit or even just -# a suffix rule, even if said files are already available in the VPATH -# directory. -useless_vpath_rebuild () -{ - if test -z "$am__useless_vpath_rebuild"; then - if using_gmake; then - am__useless_vpath_rebuild=no - return 1 - fi - mkdir am__vpath.dir$$ - cd am__vpath.dir$$ - touch foo.a foo.b bar baz - mkdir build - cd build - unindent > Makefile << 'END' - .SUFFIXES: .a .b - VPATH = .. - all: foo.b baz - .PHONY: all - .a.b: ; cp $< $@ - baz: bar ; cp ../baz bar -END - if $MAKE all && test ! -f foo.b && test ! -f bar; then - am__useless_vpath_rebuild=no - else - am__useless_vpath_rebuild=yes - fi - cd ../.. - rm -rf am__vpath.dir$$ - fi - case $am__useless_vpath_rebuild in - yes) return 0;; - no) return 1;; - "") ;; - *) fatal_ "no_useless_builddir_remake: internal error";; - esac -} -am__useless_vpath_rebuild="" - -yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; } - # seq_ - print a sequence of numbers # ---------------------------------- # This function simulates GNU seq(1) portably. Valid usages: diff --cc t/ax/testsuite-summary-checks.sh index 2419718ff,9137c22a4..d31a94c87 --- a/t/ax/testsuite-summary-checks.sh +++ b/t/ax/testsuite-summary-checks.sh @@@ -75,14 -76,14 +75,14 @@@ do_check ( case $t in fail*|xpass*|error*) expect_failure=:;; esac case $t in xfail*|xpass*) xfail_tests="$xfail_tests $t";; esac done - test -z "$xfail_tests" || xfail_tests="XFAIL_TESTS='$xfail_tests'" - st=0 - eval "env $tests $xfail_tests \$MAKE -e check > stdout || st=\$?" + set "TESTS=$tests" + test -z "$xfail_tests" || set "$@" XFAIL_TESTS="$xfail_tests" + st=0; $MAKE "$@" check >stdout || st=$? cat stdout if $expect_failure; then - test $st -gt 0 || Exit 1 + test $st -gt 0 || exit 1 else - test $st -eq 0 || Exit 1 + test $st -eq 0 || exit 1 fi $PERL "$am_testauxdir"/extract-testsuite-summary.pl stdout >summary.got \ || fatal_ "cannot extract testsuite summary" diff --cc t/backslash-tricks.sh index e236183fd,000000000..d00576579 mode 100755,000000..100755 --- a/t/backslash-tricks.sh +++ b/t/backslash-tricks.sh @@@ -1,78 -1,0 +1,78 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# +# - Automake should handle trailing backslashes in comments the way GNU +# make does, i.e., considering the next line as a continuation of the +# comment. +# +# - Automake should allow backslash-escaped '#' characters at the end +# of a line (in variable definitions as well as well as in recipes), +# because GNU make allows that. +# +# - GNU make handles comments following trailing backslashes gracefully, +# so Automake should do the same. +# +# - Automake should not complain if the Makefile ands with a backslash +# and newline sequence, because GNU make handles that gracefully. +# + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +# Avoid possible interferences from the environment. +var1= var2=; unset var1 var2 + +cat > Makefile.am << 'END' +# a comment with backslash \ +var1 = foo +var2 = bar + +var3 = \# +var4 = $(var3) + +var5 = ok \ +# ko + +var6 = \# \ +\#\\\\\# seen # not seen + +var6 += \# \# # again not seen + +.PHONY: test +test: + test -z '$(var1)' + test '$(var2)' = bar + test '$(var3)' = '#' + test '$(var4)' = \# + # Use '[', not 'test', here, so that spurious comments + # are ensured to cause syntax errors. + [ $(var5) = ok ] + test '$(var6)' = '# #\\# seen # #' + +# Yes, this file ends with a backslash-newline. So what? +\ +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE test + +: diff --cc t/bsource.sh index 0ab31f7b8,d16b58060..e3e481d4b --- a/t/bsource.sh +++ b/t/bsource.sh @@@ -27,14 -27,6 +27,14 @@@ EN $ACLOCAL $AUTOMAKE -grep 'install-recursive' Makefile.in && exit 1 +$AUTOCONF + +./configure + +for t in all check install; do - $MAKE -n $t-recursive 2>stderr && { cat stderr >&2; Exit 1; } ++ $MAKE -n $t-recursive 2>stderr && { cat stderr >&2; exit 1; } + cat stderr >&2 + grep " [Nn]o rule to make target.*[\`\"']$t-recursive" stderr +done : diff --cc t/built-sources-check.sh index 28fa21fbb,a00e37a49..d4d3c51e2 --- a/t/built-sources-check.sh +++ b/t/built-sources-check.sh @@@ -58,11 -58,23 +58,11 @@@ $AUTOCON $AUTOMAKE -a ./configure --prefix "$(pwd)/inst" - $MAKE check >stdout || { cat stdout; Exit 1; } + $MAKE check >stdout || { cat stdout; exit 1; } cat stdout grep '^PASS: subrun\.sh *$' stdout - grep 'PASS.*echo\.sh' stdout && Exit 1 + grep 'PASS.*echo\.sh' stdout && exit 1 -# check should depend directly on $(BUILT_SOURCES) (similar tests -# are in check.test and check2.test). -$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' Makefile.in -$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' dir/Makefile.in - -$MAKE clean -# Sanity checks -test ! -f command1.inc -test ! -f dir/command2.inc -# Now make sure these two files are rebuilt during make install. -$MAKE install -test -f command1.inc -test -f dir/command2.inc +$MAKE distcheck : diff --cc t/built-sources-cond.sh index d74ababac,000000000..ac78a9756 mode 100755,000000..100755 --- a/t/built-sources-cond.sh +++ b/t/built-sources-cond.sh @@@ -1,91 -1,0 +1,91 @@@ +#! /bin/sh +# Copyright (C) 2003-2012 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 . + +# Interaction of BUILT_SOURCES with conditionals. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AM_CONDITIONAL([COND1], [test $cond1 = yes]) +AM_CONDITIONAL([COND2], [test $cond2 = yes]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +if COND1 +BUILT_SOURCES = a +else +BUILT_SOURCES = b +endif +if COND2 +BUILT_SOURCES += c +endif + +a b c: + echo who cares > $@ +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +cleanup () +{ + # Files in $(BUILT_SOURCES) should be automatically removed + # upon maintainer-clean. + $MAKE maintainer-clean + test ! -f a + test ! -f b + test ! -f c +} + +./configure cond1=yes cond2=yes + +$MAKE +test -f a +test ! -f b +test -f c + +cleanup + +./configure cond1=no cond2=yes + +$MAKE +test ! -f a +test -f b +test -f c + +cleanup + +./configure cond1=yes cond2=no + +$MAKE +test -f a +test ! -f b +test ! -f c + +cleanup + +./configure cond1=no cond2=no + +$MAKE +test ! -f a +test -f b +test ! -f c + +cleanup + +: diff --cc t/built-sources-install.sh index 307864c34,000000000..7234e7a3f mode 100755,000000..100755 --- a/t/built-sources-install.sh +++ b/t/built-sources-install.sh @@@ -1,69 -1,0 +1,69 @@@ +#! /bin/sh +# Copyright (C) 2002-2012 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 'install:' honors $(BUILT_SOURCES). +# PR/359. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_CONFIG_FILES([dir/Makefile]) +AC_OUTPUT +END + +mkdir dir + +cat > Makefile.am << 'END' +BUILT_SOURCES = built1 +SUBDIRS = dir +built1: + echo ok > $@ +CLEANFILES = built1 +install-data-hook: + $(MKDIR_P) $(DESTDIR)$(prefix)/dir2 + cp built1 $(DESTDIR)$(prefix)/built1 + cp dir/built2 $(DESTDIR)$(prefix)/dir2/built3 +uninstall-hook: + rm -f $(DESTDIR)$(prefix)/built1 + rm -f $(DESTDIR)$(prefix)/dir2/built3 + rmdir $(DESTDIR)$(prefix)/dir2 +installcheck-local: + test -f $(prefix)/built1 + test -f $(prefix)/dir2/built3 +END + +cat > dir/Makefile.am << 'END' +BUILT_SOURCES = built2 +built2: +## The next line ensures that command1.inc has been built before +## recurring into the subdir. + cp ../built1 $@ +CLEANFILES = built2 +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure --prefix "`pwd`/inst" + +# Now make sure these two files are rebuilt during make install. +$MAKE install +test -f built1 +test -f dir/built2 +$MAKE installcheck +$MAKE distcheck + +: diff --cc t/built-sources.sh index b60a637cc,7c848144c..902cee10d --- a/t/built-sources.sh +++ b/t/built-sources.sh @@@ -14,13 -14,15 +14,13 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure a sensible default source for libraries is used. +# Basic test on BUILT_SOURCES. -required='cc libtool' +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' +cat >> configure.ac <<'END' AC_PROG_CC -AM_PROG_AR -AC_PROG_LIBTOOL AC_OUTPUT END diff --cc t/ccnoco2.sh index 6d4bf9cb9,dcb6fa70d..e97558b86 --- a/t/ccnoco2.sh +++ b/t/ccnoco2.sh @@@ -15,12 -15,11 +15,12 @@@ # along with this program. If not, see . # Make sure Automake requires AM_PROG_CC_C_O when either per-targets -# flags or subdir-objects are used. +# flags or subdir objects are used. - . ./defs || Exit 1 + . ./defs || exit 1 cat >>configure.ac <. -# Look for a bug where FreeBSD make in concurrent mode reported success -# even when the Automake-generated parallel testsuite harness failed. +# Look for a bug where make in concurrent mode reported success even +# when the Automake-generated parallel testsuite harness failed. +# This issue was originally present only with FreeBSD make, but we +# keep the test anyway, for extra safety. # See automake bug#9245. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT @@@ -44,14 -42,17 +44,14 @@@ $AUTOMAKE - ./configure -# Some make implementations don't grok the '-j' option. -$MAKE -j1 || exit 77 - for j in '' -j1 -j2; do - $MAKE $j check && Exit 1 - $MAKE $j TESTS=foo.test check && Exit 1 - $MAKE $j recheck && Exit 1 - $MAKE $j TESTS=foo check && Exit 1 - $MAKE $j check && exit 1 - TESTS=foo.test $MAKE $j -e check && exit 1 - $MAKE $j recheck && exit 1 - TEST_LOGS=foo.log $MAKE $j -e check && exit 1 ++ $MAKE $j check && exit 1 ++ $MAKE $j TESTS=foo.test check && exit 1 ++ $MAKE $j recheck && exit 1 ++ $MAKE $j TESTS=foo check && exit 1 rm -f test-suite.log - $MAKE $j test-suite.log && Exit 1 - test -f test-suite.log || Exit 1 - $MAKE $j test-suite.log && exit 1 - test -f test-suite.log || exit 1 ++ $MAKE $j test-suite.log && exit 1 ++ test -f test-suite.log || exit 1 done : diff --cc t/check10.sh index d108335eb,e76773c16..ce04e3d2a --- a/t/check10.sh +++ b/t/check10.sh @@@ -58,28 -58,28 +58,28 @@@ $AUTOMAKE - ( # Do not check for failure in this subshell set +e - env TESTS=pass $MAKE -e check - env TESTS=fail $MAKE -e check - env TESTS=skip $MAKE -e check - env TESTS=xfail $MAKE -e check - env TESTS=xpass $MAKE -e check - env TESTS="pass pass2" $MAKE -e check - env TESTS="fail fail2" $MAKE -e check - env TESTS="skip skip2" $MAKE -e check - env TESTS="xfail xfail2" $MAKE -e check - env TESTS="xpass xpass2" $MAKE -e check - env TESTS='pass skip xfail' $MAKE -e check + $MAKE check TESTS="pass" + $MAKE check TESTS="fail" + $MAKE check TESTS="skip" + $MAKE check TESTS="xfail" + $MAKE check TESTS="xpass" + $MAKE check TESTS="pass pass2" + $MAKE check TESTS="fail fail2" + $MAKE check TESTS="skip skip2" + $MAKE check TESTS="xfail xfail2" + $MAKE check TESTS="xpass xpass2" + $MAKE check TESTS="pass skip xfail" $MAKE check : - ) >stdout || { cat stdout; Exit 1; } + ) >stdout || { cat stdout; exit 1; } cat stdout - grep '1 [tT]ests' stdout && Exit 1 - grep '[02-9] [tT]est ' stdout && Exit 1 - grep '1 .* were ' stdout && Exit 1 - grep '[02-9].* was .*run' stdout && Exit 1 - grep 'All 1 ' stdout && Exit 1 - $EGREP '1 (un)?expected (failures|passes)' stdout && Exit 1 - $EGREP '[^1] (un)?expected (failure|pass)\)' stdout && Exit 1 + grep '1 [tT]ests' stdout && exit 1 + grep '[02-9] [tT]est ' stdout && exit 1 + grep '1 .* were ' stdout && exit 1 + grep '[02-9].* was .*run' stdout && exit 1 + grep 'All 1 ' stdout && exit 1 + $EGREP '1 (un)?expected (failures|passes)' stdout && exit 1 + $EGREP '[^1] (un)?expected (failure|pass)\)' stdout && exit 1 : diff --cc t/check11.sh index 9d56a7c02,2fa489a44..1c764873c --- a/t/check11.sh +++ b/t/check11.sh @@@ -40,19 -40,19 +40,19 @@@ $AUTOMAKE - ./configure - $MAKE check TESTS=skip >stdout || { cat stdout; Exit 1; } -env TESTS=skip $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE check TESTS=skip >stdout || { cat stdout; exit 1; } cat stdout if test x"$am_serial_tests" = x"yes"; then - grep '1.*passed' stdout && Exit 1 + grep '1.*passed' stdout && exit 1 : For shells with buggy 'set -e'. else count_test_results total=1 pass=0 fail=0 skip=1 xfail=0 xpass=0 error=0 fi - $MAKE check TESTS="skip skip2" >stdout || { cat stdout; Exit 1; } -env TESTS="skip skip2" $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE check TESTS="skip skip2" >stdout || { cat stdout; exit 1; } cat stdout if test x"$am_serial_tests" = x"yes"; then - grep '2.*passed' stdout && Exit 1 + grep '2.*passed' stdout && exit 1 : For shells with buggy 'set -e'. else count_test_results total=2 pass=0 fail=0 skip=2 xfail=0 xpass=0 error=0 diff --cc t/check12.sh index 79a45e517,69dac885c..025089645 --- a/t/check12.sh +++ b/t/check12.sh @@@ -179,11 -179,11 +179,11 @@@ for vpath in : false; d : For shells with busted 'set -e'. fi - CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1 + CHECKLOCAL_EXIT_STATUS=1 $MAKE check && exit 1 grep 'check-local failed :-(' local.log - # Do not trust the exit status of 'make -k'. - NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || : + env NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 \ - $MAKE -k check && Exit 1 ++ $MAKE -k check && exit 1 test -f hammer.log test -f hammer.sum test -f spanner.log diff --cc t/check2.sh index 439f04bf5,05dcacb0b..9a1124ad2 --- a/t/check2.sh +++ b/t/check2.sh @@@ -51,16 -51,19 +51,16 @@@ $AUTOCON $AUTOMAKE ./configure - $MAKE check >stdout || { cat stdout; Exit 1; } + $MAKE check >stdout || { cat stdout; exit 1; } cat stdout grep '^PASS: subrun\.sh *$' stdout - grep 'PASS.*echo\.sh' stdout && Exit 1 + grep 'PASS.*echo\.sh' stdout && exit 1 -# 'check' should depend directly on 'check-am' (similar tests are -# in check.test and check3.test). -$EGREP '^check:.* check-recursive( |$)' Makefile.in -$EGREP '^check:.* check-am( |$)' dir/Makefile.in +$EGREP '^check:.*check-recursive' Makefile.in +$EGREP '^check:.*check-am' dir/Makefile.in # Make sure subrun.sh is still on its line as above. This means Automake -# hasn't rewritten the TESTS line unnecessarily (we can tell, because all -# Automake variables are reformatted by VAR_PRETTY). +# hasn't rewritten the TESTS line unnecessarily. grep '^ subrun\.sh$' Makefile.in : diff --cc t/check4.sh index 0e2554c02,946290f34..d7c9fac4a --- a/t/check4.sh +++ b/t/check4.sh @@@ -51,28 -51,34 +51,28 @@@ $AUTOMAKE --add-missin ./configure --prefix "$(pwd)/inst" - $MAKE check >stdout && { cat stdout; Exit 1; } + $MAKE check >stdout && { cat stdout; exit 1; } cat stdout grep '^FAIL: fail\.sh *$' stdout - grep '^PASS: ok\.sh *$' stdout && Exit 1 + grep '^PASS: ok\.sh *$' stdout && exit 1 - $MAKE -k check >stdout && { cat stdout; Exit 1; } -# The exit status of 'make -k' can be anything -# (depending on the Make implementation) -$MAKE -k check >stdout || : ++$MAKE -k check >stdout && { cat stdout; exit 1; } cat stdout grep '^FAIL: fail\.sh *$' stdout grep '^PASS: ok\.sh *$' stdout # Should also works when -k is not in first position. - $MAKE -s -k check >stdout && { cat stdout; Exit 1; } -$MAKE -s -k check >stdout || : ++$MAKE -s -k check >stdout && { cat stdout; exit 1; } cat stdout grep '^FAIL: fail\.sh *' stdout grep '^PASS: ok\.sh *' stdout -# The rest of the test is for GNU Make. - -if using_gmake; then - # Try with a long-option that do not have a short option equivalent - # (here, --no-print-directory). That should cause all options to - # appear verbatim in MAKEFLAGS. - $MAKE --no-print-directory -k check >stdout || : - cat stdout - grep '^FAIL: fail\.sh *$' stdout - grep '^PASS: ok\.sh *$' stdout -fi +# Try with a long-option that do not have a short option equivalent +# (here, --no-print-directory). That should cause all options to +# appear verbatim in MAKEFLAGS. - $MAKE --no-print-directory -k check >stdout && { cat stdout; Exit 1; } ++$MAKE --no-print-directory -k check >stdout && { cat stdout; exit 1; } +cat stdout +grep '^FAIL: fail\.sh *$' stdout +grep '^PASS: ok\.sh *$' stdout : diff --cc t/check8.sh index b50a5124b,6fcd30ae2..24eab72ba --- a/t/check8.sh +++ b/t/check8.sh @@@ -64,8 -65,8 +64,8 @@@ $AUTOCON $AUTOMAKE -a ./configure -AM_COLOR_TESTS=always $MAKE check >stdout 2>stderr && - { cat stdout; cat stderr >&2; exit 1; } +AM_COLOR_TESTS=always $MAKE check >stdout 2>stderr \ - && { cat stdout; cat stderr >&2; Exit 1; } ++ && { cat stdout; cat stderr >&2; exit 1; } cat stdout cat stderr >&2 grep 'XPASS.* foo$' stdout diff --cc t/cleanvars.sh index 2f14e176a,000000000..a5d050621 mode 100755,000000..100755 --- a/t/cleanvars.sh +++ b/t/cleanvars.sh @@@ -1,100 -1,0 +1,100 @@@ +#! /bin/sh +# Copyright (C) 2001-2012 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 support for: +# - MOSTLYCLEANFILES +# - CLEANFILES +# - DISTCLEANFILES +# - MAINTAINERCLEANFILES +# Especially checks that it is possible to extend them also from a +# "wrapper" makefile never processed nor seen by Automake. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +setup () { touch mostly plain dist maint mostly2 plain2 dist2 maint2; } + +cat > Makefile.am << 'END' +MOSTLYCLEANFILES = mostly +CLEANFILES = plain +DISTCLEANFILES = dist +MAINTAINERCLEANFILES = maint +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +cat > GNUmakefile << 'END' +include Makefile +MOSTLYCLEANFILES += mostly2 +CLEANFILES += plain2 +DISTCLEANFILES += dist2 +MAINTAINERCLEANFILES += maint2 +END + +./configure +cp config.status config.sav # Save for later. + +setup +$MAKE mostlyclean +test ! -f mostly +test ! -f mostly2 +test -f plain +test -f plain2 +test -f dist +test -f dist2 +test -f maint +test -f maint2 + +setup +$MAKE clean +test ! -f mostly +test ! -f mostly2 +test ! -f plain +test ! -f plain2 +test -f dist +test -f dist2 +test -f maint +test -f maint2 + +setup +$MAKE distclean +test ! -f mostly +test ! -f mostly2 +test ! -f plain +test ! -f plain2 +test ! -f dist +test ! -f dist2 +test -f maint +test -f maint2 + +setup +# The "make distclean" before has removed Makefile and config.status. +mv config.sav config.status +./config.status Makefile +$MAKE maintainer-clean +test ! -f mostly +test ! -f mostly2 +test ! -f plain +test ! -f plain2 +test ! -f dist +test ! -f dist2 +test ! -f maint +test ! -f maint2 + +: diff --cc t/colon6.sh index bf2dacd7d,1e93a8f99..48b4f07af --- a/t/colon6.sh +++ b/t/colon6.sh @@@ -82,10 -87,10 +82,10 @@@ for vpath in : false; d # version.good should depend on version.gin. rm -f version.good - $MAKE version.good 2>stderr && { cat stderr >&2; Exit 1; } - $MAKE version.good >output 2>&1 && { cat output; exit 1; } - cat output ++ $MAKE version.good 2>stderr && { cat stderr >&2; exit 1; } + cat stderr >&2 # Try to verify that we errored out for the right reason. - $FGREP version.gin output + $FGREP version.gin stderr cd .. # Back in top builddir. cd $srcdir diff --cc t/color.sh index 9e4ac04fb,61158b17a..9b3b3bc4f --- a/t/color.sh +++ b/t/color.sh @@@ -89,10 -89,36 +89,10 @@@ test_color ( test_no_color () { - # With make implementations that, like Solaris make, in case of errors - # print the whole failing recipe on standard output, we should content - # ourselves with a laxer check, to avoid false positives. - # Keep this in sync with lib/am/check.am:$(am__color_tests). - if $FGREP '= Xalways; then' stdout; then - # Extra verbose make, resort to laxer checks. - # Note that we also want to check that the testsuite summary is - # not unduly colorized. - ( - set +e # In case some grepped regex below isn't matched. - # Not a useless use of cat; see above comments "grep-nonprinting" - # requirement in 'test-init.sh'. - cat stdout | grep "TOTAL.*:" - cat stdout | grep "PASS.*:" - cat stdout | grep "FAIL.*:" - cat stdout | grep "SKIP.*:" - cat stdout | grep "XFAIL.*:" - cat stdout | grep "XPASS.*:" - cat stdout | grep "ERROR.*:" - cat stdout | grep 'test.*expected' - cat stdout | grep 'test.*not run' - cat stdout | grep '====' - cat stdout | grep '[Ss]ee .*test-suite\.log' - cat stdout | grep '[Tt]estsuite summary' - ) | grep "$esc" && exit 1 - : For shells with broken 'set -e' - else - cat stdout | grep "$esc" && exit 1 - : For shells with broken 'set -e' - fi + # Not a useless use of cat; see above comments "grep-nonprinting" + # requirement in 'test-init.sh'. - cat stdout | grep "$esc" && Exit 1 ++ cat stdout | grep "$esc" && exit 1 + : } for vpath in false :; do @@@ -109,12 -135,12 +109,12 @@@ # Forced colorization should take place also with non-ANSI terminals; # hence the "TERM=dumb" definition. - TERM=dumb AM_COLOR_TESTS=always $MAKE -e check >stdout \ + $MAKE check AM_COLOR_TESTS=always TERM=dumb >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout test_color - $MAKE check TERM=ansi >stdout && { cat stdout; Exit 1; } - TERM=ansi $MAKE -e check >stdout && { cat stdout; exit 1; } ++ $MAKE check TERM=ansi >stdout && { cat stdout; exit 1; } cat stdout test_no_color diff --cc t/color2.sh index 841c585d4,e79ab277b..18734c96d --- a/t/color2.sh +++ b/t/color2.sh @@@ -30,10 -30,32 +30,9 @@@ mgn="$esc\[0;35m std="$esc\[m" # This test requires a working a working 'expect' program. - # Creative quoting required to avoid spurious maintainer-check failure. - (set +e; expect -c 'exit ''77'; test $? -eq 77) \ + (set +e; expect -c 'exit 77'; test $? -eq 77) \ || skip_ "requires a working expect program" -# Also, if the $MAKE program fails to consider the standard output as a -# tty (this happens with e.g., BSD make and Solaris dmake when they're -# run in parallel mode; see the autoconf manual), there is little point -# in proceeding. -cat > Makefile <<'END' -all: -## Creative quoting in the 'echo' below to avoid risk of spurious output -## matches by 'expect', below. - @test -t 1 && echo "stdout" "is" "a" "tty" -END - -cat > expect-check <<'END' -eval spawn $env(MAKE) -expect { - "stdout is a tty" { exit 0 } - default { exit 1 } -} -exit 1 -END -MAKE=$MAKE expect -f expect-check \ - || skip_ "make spawned by expect should have a tty stdout" -rm -f expect-check Makefile - # Do the tests. cat >>configure.ac <expect-make <<'END' diff --cc t/comment6.sh index 19fc43b76,496dfdd32..e0c37cf4e --- a/t/comment6.sh +++ b/t/comment6.sh @@@ -37,20 -35,11 +37,20 @@@ cat > Makefile.am << 'EOF file2 \ file3 -all-local: - @echo Good - +.PHONY: test +test: + test -z '$(SOME_FILES)' EOF +do_check () +{ + $MAKE test + grep '^# SOME_FILES =' Makefile + # No useless munging please. - grep '#.*file[123]' Makefile && Exit 1 ++ grep '#.*file[123]' Makefile && exit 1 + : +} + $ACLOCAL $AUTOCONF $AUTOMAKE diff --cc t/cond30.sh index 495842c95,cf505d924..da954ed6d --- a/t/cond30.sh +++ b/t/cond30.sh @@@ -14,16 -14,13 +14,16 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# For PR/352: make sure we support bin_PROGRAMS being defined conditionally. +# For PR/352: make sure we support bin_PROGRAMS, lib_LIBRARIES and +# lib_LTLIBRARIES being defined conditionally. - . ./defs || Exit 1 + . ./defs || exit 1 cat >>configure.ac <<'EOF' -AM_CONDITIONAL([C1], [test -z "$two"]) -AM_CONDITIONAL([C2], [test -n "$two"]) +m4_define([AM_PROG_AR], [:]) +AM_PROG_AR +AM_CONDITIONAL([C1], [test x"$two" != x"yes"]) +AM_CONDITIONAL([C2], [test x"$two" = x"yes"]) AC_OUTPUT EOF diff --cc t/conffile-leading-dot.sh index 3c5ba9753,3eed30bb4..2146183f9 --- a/t/conffile-leading-dot.sh +++ b/t/conffile-leading-dot.sh @@@ -18,7 -18,8 +18,7 @@@ # with a dot (like "./Makefile"), since the remake rules might be subtly # broken in that case. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 cat > configure.ac << END AC_INIT([$me], [1.0]) diff --cc t/confh4.sh index ddcbebab2,06ae96fbb..9331fcb16 --- a/t/confh4.sh +++ b/t/confh4.sh @@@ -21,60 -21,27 +21,60 @@@ # > How-To-Repeat: # Use AM_CONFIG_HEADER(subdir/config.h) to place configuration # header in subdirectory and observe that it is not included. +# Also check that our preprocessing code is smart enough not to pass +# repeated '-I' options on the compiler command line. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' -AC_CONFIG_FILES([include/Makefile]) +AC_CONFIG_FILES([include/Makefile sub/Makefile]) AC_CONFIG_HEADERS([include/config.h]) -AC_PROG_CC +AC_PROG_FGREP +AC_OUTPUT END -cat > Makefile.am << 'END' +mkdir include sub +: > include/config.h.in + +cat > c-defs.am << 'END' +## To bring in the definition of AM_DEFAULT_INCLUDES +CC = who-cares +AUTOMAKE_OPTIONS = no-dependencies bin_PROGRAMS = foo -foo_SOURCES = foo.c END -mkdir include -: > include/Makefile.am -: > include/config.h.in +cat > Makefile.am << 'END' +include $(top_srcdir)/c-defs.am +.PHONY: test-default-includes +test-default-includes: + echo ' ' $(AM_DEFAULT_INCLUDES) ' ' \ + | $(FGREP) ' -I$(top_builddir)/include ' +END + +cp Makefile.am sub + +cat > include/Makefile.am << 'END' +include $(top_srcdir)/c-defs.am +.PHONY: test-default-includes +test-default-includes: + echo ' ' $(AM_DEFAULT_INCLUDES) ' ' | $(FGREP) ' -I. ' + case ' $(AM_DEFAULT_INCLUDES) ' in \ + *'$(top_builddir)'*) exit 1;; \ + *include*) exit 1;; \ + *-I.*-I.*) exit 1;; \ + *' -I. ') exit 0;; \ + *) exit 1;; \ + esac +END $ACLOCAL +$AUTOCONF $AUTOMAKE -grep '^ *DEFAULT_INCLUDES *=.* -I\$(top_builddir)/include' Makefile.in +./configure + +$MAKE test-default-includes +$MAKE -C sub test-default-includes +$MAKE -C include test-default-includes : diff --cc t/cxx-fortran.sh index b2138db85,000000000..7b7e9cb1f mode 100755,000000..100755 --- a/t/cxx-fortran.sh +++ b/t/cxx-fortran.sh @@@ -1,69 -1,0 +1,69 @@@ +#! /bin/sh +# Copyright (C) 2006-2012 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 mixing Fortran 77 and C++. + +# For now, require the GNU compilers, to avoid possible spurious failure. +required='gfortran g++' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CXX +AC_PROG_F77 +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_PROGRAMS = foo +foo_SOURCES = new.cc old.f +END + +cat > new.cc << 'END' +#include +using namespace std; +extern "C" { int cube_ (int *); } +int main (void) +{ + int n = 3; + cout << "The Cube of " << n << " is " << cube_ (&n) << endl; + return 0; +} +END + +cat > old.f << 'END' + INTEGER FUNCTION CUBE(N) +C COMPUTES AND RETURN THE CUBE OF THE INTEGER N + CUBE=N*N*N + RETURN + END +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a +# The C++ linker should be preferred. - grep '\$(FCLINK)' Makefile.in && Exit 1 ++grep '\$(FCLINK)' Makefile.in && exit 1 +grep '.\$(CXXLINK)' Makefile.in + +./configure +$MAKE + +if cross_compiling; then :; else + ./foo + test "$(./foo)" = "The Cube of 3 is 27" +fi + +$MAKE distcheck diff --cc t/deleted-am.sh index e3612a339,9dc015a64..d3d2616ae --- a/t/deleted-am.sh +++ b/t/deleted-am.sh @@@ -35,12 -35,13 +35,12 @@@ $AUTOMAK $MAKE rm -f zardoz.am - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } -$sleep # Required to avoid racy failures with FreeBSD make. -$MAKE >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 # This error will come from automake, not make, so we can be stricter # in our grepping of it. -grep 'cannot open.*zardoz\.am' output -grep 'foobar\.am' output && exit 1 # No spurious error, please. +grep 'cannot open.*zardoz\.am' stderr - grep 'foobar\.am' stderr && Exit 1 # No spurious error, please. ++grep 'foobar\.am' stderr && exit 1 # No spurious error, please. # Try with one less indirection. : > foobar.am @@@ -48,10 -49,11 +48,10 @@@ $AUTOMAKE Makefil ./config.status Makefile $MAKE # Sanity check. rm -f foobar.am - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } -$sleep # Required to avoid racy failures with FreeBSD make. -$MAKE >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 # This error will come from automake, not make, so we can be stricter # in our grepping of it. -grep 'cannot open.*foobar\.am' output +grep 'cannot open.*foobar\.am' stderr : diff --cc t/deleted-m4.sh index 328657e18,296f453cf..a5fb0e89e --- a/t/deleted-m4.sh +++ b/t/deleted-m4.sh @@@ -39,13 -39,13 +39,13 @@@ $AUTOMAK $MAKE rm -f zardoz.m4 - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 # This error will come from aclocal, not make, so we can be stricter # in our grepping of it. -grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' output +grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' stderr # No spurious errors, please. - $FGREP -v ' foobar.m4:1:' stderr | $FGREP 'foobar.m4' && Exit 1 -$FGREP -v ' foobar.m4:1:' output | $FGREP 'foobar.m4' && exit 1 ++$FGREP -v ' foobar.m4:1:' stderr | $FGREP 'foobar.m4' && exit 1 # Try with one less indirection. : > foobar.m4 @@@ -54,12 -54,12 +54,12 @@@ $AUTOCON ./configure $MAKE # Sanity check. rm -f foobar.m4 - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 # This error will come from aclocal, not make, so we can be stricter # in our grepping of it. -grep 'foobar\.m4.*does not exist' output +grep 'foobar\.m4.*does not exist' stderr # No spurious errors, please (ok, this is really paranoid). - $FGREP 'zardoz.m4' stderr && Exit 1 -$FGREP 'zardoz.m4' output && exit 1 ++$FGREP 'zardoz.m4' stderr && exit 1 : diff --cc t/depcomp-recover.sh index a93319cb8,000000000..7d3e7df30 mode 100755,000000..100755 --- a/t/depcomp-recover.sh +++ b/t/depcomp-recover.sh @@@ -1,111 -1,0 +1,111 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Dependency tracking: +# - we can recover if any .Po file in $(DEPDIR) gets removed; +# - in fact, we can recover if the whole $(DEPDIR) directory gets +# removed. + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AC_PROG_CC +AM_PROG_CC_C_O +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +SUBDIRS = . sub +noinst_PROGRAMS = foo +foo_SOURCES = main.c foo.c foo.h +get-depdir: + @echo '$(DEPDIR)' +END + +cat > main.c <<'END' +#include "foo.h" +int main (void) +{ + return foo (); +} +END +cat > foo.c <<'END' +#include "foo.h" +int foo (void) +{ + return 0; +} +END +echo 'int foo (void);' > foo.h + +mkdir sub sub/src +cat > sub/Makefile.am <<'END' +noinst_PROGRAMS = foo +foo_SOURCES = src/main.c src/foo.c src/foo.h +END +cp main.c foo.c foo.h sub/src + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +for vpath in : false; do + + if $vpath; then + srcdir=.. + mkdir build + cd build + else + srcdir=. + fi + + $srcdir/configure --enable-dependency-tracking + $MAKE + depdir=`$MAKE -s --no-print-directory get-depdir` \ + && test -n "$depdir" \ + && test -d $depdir \ + && test -d sub/src/$depdir \ + || fatal_ "cannot find the depdir" + + for remove_stuff in \ + "rm -f $depdir/main.Po" \ + "rm -f sub/src/$depdir/foo.Po" \ + "rm -rf $depdir" \ + "rm -rf $depdir sub/src/$depdir" \ + ; do + $remove_stuff + # We can still use make and order a build, even if we have probably + # lost the dependency information registered in removed the .Po files. + # TODO: maybe we should detect such a situation and force a clean + # TODO: rebuild? + $MAKE + # But if we force a rebuild by hand by cleaning out the existing + # objects, everything works out as expected. + $MAKE clean + $MAKE + test -f $depdir/main.Po + test -f $depdir/foo.Po + test -f sub/src/$depdir/main.Po + test -f sub/src/$depdir/foo.Po + done + + cd $srcdir + +done + +: diff --cc t/depcomp-shuffle-sub-vpath.sh index 223008f04,f77f4396a..18fde7e29 --- a/t/depcomp-shuffle-sub-vpath.sh +++ b/t/depcomp-shuffle-sub-vpath.sh @@@ -1,5 -1,5 +1,5 @@@ #! /bin/sh - # Copyright (C) 1996-2012 Free Software Foundation, Inc. -# Copyright (C) 1999-2012 Free Software Foundation, Inc. ++# Copyright (C) 2012 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 diff --cc t/depcomp-shuffle-sub.sh index 57abf0ce7,e2404ba6f..21f703baa --- a/t/depcomp-shuffle-sub.sh +++ b/t/depcomp-shuffle-sub.sh @@@ -1,5 -1,5 +1,5 @@@ #! /bin/sh - # Copyright (C) 2002-2012 Free Software Foundation, Inc. -# Copyright (C) 1998-2012 Free Software Foundation, Inc. ++# Copyright (C) 2012 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 @@@ -14,10 -14,18 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test for error for bad syntax. +# Dependency tracking in the face of added/removed/renamed files. +# - in-tree build +# - use of subdir objects - . ./defs-static || exit '99' -. ./defs || exit 1 - -cat > Makefile.am << 'END' -foo = q \ - -bin_SCRIPTS = foo.sh -END - -$ACLOCAL -AUTOMAKE_fails -Wnone -grep '^Makefile\.am:2:.*blank line following trailing backslash' stderr - -: ++. ./defs-static || exit 99 +xdir='sub' vpath='no' +. "$am_testauxdir"/depcomp-shuffle.sh diff --cc t/depcomp-shuffle-vpath.sh index ea8cbda5a,1bc60f008..4baf20fa6 --- a/t/depcomp-shuffle-vpath.sh +++ b/t/depcomp-shuffle-vpath.sh @@@ -1,5 -1,5 +1,5 @@@ #! /bin/sh - # Copyright (C) 2010-2012 Free Software Foundation, Inc. -# Copyright (C) 2005-2012 Free Software Foundation, Inc. ++# Copyright (C) 2012 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 @@@ -14,10 -14,19 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure comments following trailing backslashes are diagnosed. -# Report from Harald Dunkel. +# Dependency tracking in the face of added/removed/renamed files. +# - VPATH build +# - no use of subdir objects - . ./defs-static || exit '99' -. ./defs || exit 1 - -cat > Makefile.am << 'END' -SUBDIRS = foo \ -# bar - -END - -mkdir foo - -$ACLOCAL -AUTOMAKE_fails -grep backslash stderr ++. ./defs-static || exit 99 +xdir='' vpath='yes' +. "$am_testauxdir"/depcomp-shuffle.sh diff --cc t/depcomp-shuffle.sh index 3a284db92,000000000..23ce20c64 mode 100755,000000..100755 --- a/t/depcomp-shuffle.sh +++ b/t/depcomp-shuffle.sh @@@ -1,23 -1,0 +1,23 @@@ +#! /bin/sh - # Copyright (C) 2002-2012 Free Software Foundation, Inc. ++# Copyright (C) 2012 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 . + +# Dependency tracking in the face of added/removed/renamed files. +# - in-tree build +# - no use of subdir objects + - . ./defs-static || exit '99' ++. ./defs-static || exit 99 +xdir='' vpath='no' +. "$am_testauxdir"/depcomp-shuffle.sh diff --cc t/dist-missing-am.sh index 5bef889ee,80254c49a..df5801a1c --- a/t/dist-missing-am.sh +++ b/t/dist-missing-am.sh @@@ -54,12 -54,12 +54,12 @@@ for vpath in false :; d cd $distdir ./configure fi - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } - $MAKE >output 2>&1 && { cat output; exit 1; } - cat output ++ $MAKE 2>stderr && { cat stderr >&2; exit 1; } + cat stderr >&2 # This error comes from automake, not make, so we can be stricter # in our grepping of it. - grep 'cannot open.*zardoz\.am' output - grep 'foobar\.am' output && exit 1 # No spurious error, please. + grep 'cannot open.*zardoz\.am' stderr - grep 'foobar\.am' stderr && Exit 1 # No spurious error, please. ++ grep 'foobar\.am' stderr && exit 1 # No spurious error, please. cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" done diff --cc t/dist-missing-included-m4.sh index ab491bce7,6a2a57de9..08b91fa9a --- a/t/dist-missing-included-m4.sh +++ b/t/dist-missing-included-m4.sh @@@ -56,12 -56,12 +56,12 @@@ for vpath in false :; d cd $distdir ./configure fi - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } - $MAKE >output 2>&1 && { cat output; exit 1; } - cat output ++ $MAKE 2>stderr && { cat stderr >&2; exit 1; } + cat stderr # This error will come from automake, not make, so we can be stricter # in our grepping of it. - grep 'zardoz\.m4.*does not exist' output - grep 'foobar\.m4' output && exit 1 # No spurious error, please. + grep 'zardoz\.m4.*does not exist' stderr - grep 'foobar\.m4' stderr && Exit 1 # No spurious error, please. ++ grep 'foobar\.m4' stderr && exit 1 # No spurious error, please. cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" done diff --cc t/dist-missing-m4.sh index b0e1de239,4e002e4dd..79473b033 --- a/t/dist-missing-m4.sh +++ b/t/dist-missing-m4.sh @@@ -58,12 -58,12 +58,12 @@@ for vpath in false :; d cd $distdir ./configure fi - $MAKE 2>stderr && { cat stderr; Exit 1; } - $MAKE >output 2>&1 && { cat output; exit 1; } - cat output ++ $MAKE 2>stderr && { cat stderr; exit 1; } + cat stderr # This error will come from autoconf, not make, so we can be stricter # in our grepping of it. - grep 'possibly undefined .*MY_ZARDOZ' output - grep 'MY_FOOBAR' output && exit 1 # No spurious error, please. + grep 'possibly undefined .*MY_ZARDOZ' stderr - grep 'MY_FOOBAR' stderr && Exit 1 # No spurious error, please. ++ grep 'MY_FOOBAR' stderr && exit 1 # No spurious error, please. cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" done diff --cc t/dist-srcdir.sh index 88d8d4a7e,000000000..1f6cbb0a2 mode 100755,000000..100755 --- a/t/dist-srcdir.sh +++ b/t/dist-srcdir.sh @@@ -1,92 -1,0 +1,92 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# We use EXTRA_DIST to distribute stuff *explicitly* from the srcdir. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +ocwd=`pwd` || fatal_ "cannot get current working directory" + +mkdir src +cd src + +cat >> configure.ac < Makefile.am <<'END' +SUBDIRS = sub + +EXTRA_DIST = \ + $(srcdir)/one \ + @srcdir@/two \ + $(top_srcdir)/three \ + @top_srcdir@/four + +.PHONY: test +check-local: test +test: distdir + find $(distdir) # For debugging. + test -f $(distdir)/one + test -f $(distdir)/two + test -f $(distdir)/three + test -f $(distdir)/four + test -f $(distdir)/sub/five + test -f $(distdir)/sub/six + test ! -f $(distdir)/five + test ! -f $(distdir)/six + test -f $(distdir)/seven + test -f $(distdir)/eight + test ! -f $(distdir)/sub/seven + test ! -f $(distdir)/sub/eight +END + +mkdir sub +cat > sub/Makefile.am <<'END' +EXTRA_DIST = $(srcdir)/five @srcdir@/six +EXTRA_DIST += $(top_srcdir)/seven @top_srcdir@/eight +END + +touch one two three four sub/five sub/six seven eight + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +mkdir build +cd build +../configure +$MAKE test +$MAKE distcheck +cd "$ocwd" + +mkdir a a/b a/b/c +cd a/b/c +../../../src/configure +$MAKE test +cd "$ocwd" + +mkdir build2 +cd build2 +"$ocwd"/src/configure +$MAKE test +cd "$ocwd" + +: diff --cc t/dist-srcdir2.sh index e64d412fa,000000000..5a105234b mode 100755,000000..100755 --- a/t/dist-srcdir2.sh +++ b/t/dist-srcdir2.sh @@@ -1,49 -1,0 +1,49 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# If we distribute a file whose name that starts with $(srcdir), +# then the distribution rules should not try to instead distribute +# a file with the same name from the builddir. +# Currently, this doesn't work (the reasons and details for this +# limitation should be explained in depth in comments in file +# 'lib/am/distdir.am'). + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +EXTRA_DIST = $(srcdir)/filename-that-is-easy-to-grep +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +mkdir build +cd build +../configure + +echo bad > filename-that-is-easy-to-grep - $MAKE distdir 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE distdir 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep 'filename-that-is-easy-to-grep' stderr + +echo good > ../filename-that-is-easy-to-grep +$MAKE distdir +test "`cat $distdir/filename-that-is-easy-to-grep`" = good + +: diff --cc t/distcheck-configure-flags-am.sh index be214ffcb,11c992c14..828199ec7 --- a/t/distcheck-configure-flags-am.sh +++ b/t/distcheck-configure-flags-am.sh @@@ -59,9 -59,9 +59,9 @@@ EN $AUTOMAKE Makefile ./config.status Makefile - $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 && { cat output; exit 1; } -cat output -grep "^configure:.* success='no', sentence='it works :-)'" output ++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep "^configure:.* success='no', sentence='it works :-)'" stderr $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes" diff --cc t/distcheck-configure-flags-subpkg.sh index 17dfc9cbb,f5bc15d26..567dd58c2 --- a/t/distcheck-configure-flags-subpkg.sh +++ b/t/distcheck-configure-flags-subpkg.sh @@@ -74,8 -74,8 +74,8 @@@ $MAKE distchec # ... but not when "make distcheck" is run from the subpackage. cd subpkg - $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 && { cat output; exit 1; } -cat output -grep '^configure:.* dc=KO am_dc=KO' output ++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep '^configure:.* dc=KO am_dc=KO' stderr : diff --cc t/distcheck-configure-flags.sh index bb6f840a5,e10b2bafe..fdec9a5c4 --- a/t/distcheck-configure-flags.sh +++ b/t/distcheck-configure-flags.sh @@@ -48,8 -47,8 +48,8 @@@ $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes sentence='it works :-)'" # Sanity check. - $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 && { cat output; exit 1; } -cat output -grep "^configure:.* success='no', sentence=''" output ++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +grep "^configure:.* success='no', sentence=''" stderr : diff --cc t/distcheck-hook2.sh index 3eccc4f47,ee177ee8d..7c7352bbb --- a/t/distcheck-hook2.sh +++ b/t/distcheck-hook2.sh @@@ -63,8 -63,8 +63,8 @@@ cd . # For debugging. $FGREP 'distcheck-hook' Makefile.in subpkg/Makefile.in - $FGREP 'distcheck-hook' subpkg/Makefile.in && Exit 1 + $FGREP 'distcheck-hook' subpkg/Makefile.in && exit 1 -$FGREP '$(MAKE) $(AM_MAKEFLAGS) distcheck-hook' Makefile.in +$FGREP '$(MAKE) distcheck-hook' Makefile.in grep '^distcheck-hook:' Makefile.in ./configure diff --cc t/distcheck-missing-m4.sh index 6366455d0,1eef8720d..b2669184a --- a/t/distcheck-missing-m4.sh +++ b/t/distcheck-missing-m4.sh @@@ -65,9 -65,11 +65,9 @@@ $AUTOMAK check_no_spurious_error () { - $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1 - grep -i 'autom4te.*\.cache' output && Exit 1 - : # To placate 'set -e'. + $EGREP -i 'mkdir:|:.*(permission|denied)' output && exit 1 - # On failure, some make implementations (such as Solaris make) print the - # whole failed recipe on stdout. The first grep works around this. - grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && exit 1 ++ grep -i 'autom4te.*\.cache' output && exit 1 + : To placate 'set -e'. } ./configure diff --cc t/distcheck-outdated-m4.sh index 34084df22,50e1057e2..3c3336c0c --- a/t/distcheck-outdated-m4.sh +++ b/t/distcheck-outdated-m4.sh @@@ -59,9 -59,11 +59,9 @@@ $MAKE distcheck # Sanity check check_no_spurious_error () { - $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1 - grep -i 'autom4te.*\.cache' output && Exit 1 - : # To placate 'set -e'. + $EGREP -i 'mkdir:|:.*(permission|denied)' output && exit 1 - # On failure, some make implementations (such as Solaris make) print the - # whole failed recipe on stdout. The first grep works around this. - grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && exit 1 ++ grep -i 'autom4te.*\.cache' output && exit 1 + : To placate 'set -e'. } # We start to use a new "third-party" macro in a new version diff --cc t/distcheck-override-infodir.sh index e3bff0915,f7a5640f9..8ebcd95ba --- a/t/distcheck-override-infodir.sh +++ b/t/distcheck-override-infodir.sh @@@ -55,7 -55,7 +55,7 @@@ $AUTOCON $MAKE $MAKE distcheck -infodir="$(pwd)/_info" $MAKE -e distcheck +$MAKE distcheck infodir="$(pwd)"/_info - test -f _info/dir || Exit 99 # Sanity check. + test -f _info/dir || exit 99 # Sanity check. : diff --cc t/distcheck-pr10470.sh index de8a98468,d888a9972..a030f90da --- a/t/distcheck-pr10470.sh +++ b/t/distcheck-pr10470.sh @@@ -49,10 -49,10 +49,10 @@@ $AUTOMAK ./configure # We can build the distribution. - $MAKE distcheck 2>stderr || { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 || { cat output; exit 1; } -cat output ++$MAKE distcheck 2>stderr || { cat stderr >&2; exit 1; } +cat stderr >&2 # Sanity check: verify that our code has hit a problem removing # the distdir, but has recovered from it. -grep "rm:.*$destdir" output || fatal_ "expected code path not covered" +grep "rm:.*$destdir" stderr || fatal_ "expected code path not covered" : diff --cc t/distcheck-pr9579.sh index 09fd1900d,ae1da2b92..58c9b6e76 --- a/t/distcheck-pr9579.sh +++ b/t/distcheck-pr9579.sh @@@ -54,11 -54,11 +54,11 @@@ $MAKE uninstal test -f inst/share/dir rm -rf inst - $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 -$FGREP 'ERROR: files left after uninstall:' output -grep '/share/dir *$' output +grep 'ERROR: files left after uninstall:' stderr +grep '/share/dir *$' stderr # A few trickier corner cases. @@@ -86,11 -86,11 +86,11 @@@ test -f inst/mu/share/info/di test -f inst/share/info/more/dir rm -rf inst - $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE distcheck >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 -$FGREP 'ERROR: files left after uninstall:' output -grep '/mu/share/info/dir *$' output -grep '/share/info/more/dir *$' output +grep 'ERROR: files left after uninstall:' stderr +grep '/mu/share/info/dir *$' stderr +grep '/share/info/more/dir *$' stderr : diff --cc t/distcom-subdir.sh index ac1420fdd,7def7bf25..15693311e --- a/t/distcom-subdir.sh +++ b/t/distcom-subdir.sh @@@ -17,8 -17,7 +17,8 @@@ # Test to make sure that if an auxfile (here depcomp) is required # by a subdir Makefile.am, it is distributed by that Makefile.am. +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_FILES([subdir/Makefile]) diff --cc t/distcom3.sh index 8ed0809a4,a2ffe0b0c..d83409efb --- a/t/distcom3.sh +++ b/t/distcom3.sh @@@ -32,11 -32,11 +32,11 @@@ EN $ACLOCAL # Should not warn about missing README, since it is a target. - $AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; Exit 1; } + $AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; exit 1; } cat output - grep README output && Exit 1 + grep README output && exit 1 -sed -n -e '/^DIST_COMMON =.*\\$/ { +sed -n -e '/^am__dist_common =.*\\$/ { :loop p n diff --cc t/distcom5.sh index 744039758,0ee2946cc..4d3789d67 --- a/t/distcom5.sh +++ b/t/distcom5.sh @@@ -19,8 -19,23 +19,8 @@@ # a Makefile in that directory. distcom4.test performs the same # test without Makefile in the directory. - . ./defs || Exit 1 + . ./defs || exit 1 -extract_distcommon () -{ - sed -n -e '/^DIST_COMMON =.*\\$/ { - :loop - p - n - t clear - :clear - s/\\$/\\/ - t loop - p - n - }' -e '/^DIST_COMMON =/ p' ${1+"$@"} -} - cat >> configure.ac << 'END' AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in], [chmod +x tests/autoconf]) diff --cc t/distdir.sh index 9f365b736,9600746b2..9d0d6ee91 --- a/t/distdir.sh +++ b/t/distdir.sh @@@ -18,10 -18,10 +18,10 @@@ # sure *srcdir is properly handled. Note that using './', as in # EXTRA_DIST = ./joe # does not work portably: it fails with HP-UX and Tru64 make. -# Also test DISTFILES containing a directory and a file in it, -# and repeated directories. +# Also test the situation when the lsit of distributed files contains +# a directory and a file in it, and repeated directories. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT diff --cc t/distlinksbrk.sh index 04c6b7f35,9f537681f..72c7cf3a3 --- a/t/distlinksbrk.sh +++ b/t/distlinksbrk.sh @@@ -59,15 -53,16 +59,15 @@@ $AUTOMAK ls -l # For debugging. -# Don't try to use "make -k", because some botched make implementations -# (HP-UX, IRIX) might still exit on the first error in this situations. -for lnk in $lnk1 $lnk2 $lnka $lnkb; do - echo "EXTRA_DIST = $lnk" > Makefile.am - $AUTOMAKE - ./configure - # Distribution must fail, with a decent error message. - $MAKE distdir >out 2>&1 && { cat out; exit 1; } - cat out - $FGREP $lnk out -done +# Distribution must fail. - $MAKE distdir && Exit 1 ++$MAKE distdir && exit 1 + +# Names of distributed broken symlinks should be reported in make output. - $MAKE -k distdir 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE -k distdir 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +$FGREP $lnk1 stderr +$FGREP $lnk2 stderr +$FGREP $lnka stderr +$FGREP $lnkb stderr : diff --cc t/dollar.sh index 7f8de16b1,e62f42b32..214345b96 --- a/t/dollar.sh +++ b/t/dollar.sh @@@ -18,7 -18,10 +18,7 @@@ # Java people need this. # PR/317, reported by Eric Siegerman and Philip Fong. - . ./defs || Exit 1 -# Require GNU make for this test. SunOS Make does not support -# '$$' in a target or a dependency (it outputs the empty string instead). -required=GNUmake + . ./defs || exit 1 echo AC_OUTPUT >> configure.ac diff --cc t/double-colon-rules.sh index ef7c45a2a,000000000..b6803cc55 mode 100755,000000..100755 --- a/t/double-colon-rules.sh +++ b/t/double-colon-rules.sh @@@ -1,112 -1,0 +1,112 @@@ +#! /bin/sh +# Copyright (C) 2003-2012 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 that double colon rules work. +# This test not only checks that Automake do not mangle double-colon rules +# seen in input Makefile.am, but also that GNU make support of double-colon +# rules is as reliable and well-working as we expect and need. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +all-local: + @echo Please select an explicit target; exit 1 + +# No space after 'a'. +a:: b + echo rule1 >> $@ +# Deliberate space after 'a'. +a :: c + echo rule2 >> $@ + +# Overlapping rules should work as well +a2 :: b2 + echo rule21 >> $@ +a2 :: c2 + echo rule22 >> $@ +a2:: b2 c2 + echo rule23 >> $@ +b2 c2: + touch $@ +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +grep '::' Makefile.in # For debugging. +test $(grep -c '^a *:: *b *$' Makefile.in) -eq 1 +test $(grep -c '^a *:: *c *$' Makefile.in) -eq 1 +test $(grep -c '^a2 *:: *b2 *$' Makefile.in) -eq 1 +test $(grep -c '^a2 *:: *c2 *$' Makefile.in) -eq 1 +test $(grep -c '^a2 *:: *b2 *c2 *$' Makefile.in) -eq 1 + +./configure + +# Non-overlapping double-colon rules. + +touch b c +$sleep +: > a +$MAKE a +test ! -s a +$sleep +touch b +$MAKE a +test "$(cat a)" = rule1 +: > a +$sleep +touch c +$MAKE a +test "$(cat a)" = rule2 + +: > a +$sleep +touch b c +$MAKE a +test "$(sort a)" = "rule1${nl}rule2" + +rm -f a b c + +# Overlapping double-colon rules. + +$MAKE a2 +test -f a2 +test -f b2 +test -f c2 + +: > a2 +$MAKE a2 +test ! -s a2 +$sleep +touch b2 +$MAKE a2 +test "$(sort a2)" = "rule21${nl}rule23" +: > a2 +$sleep +touch c2 +$MAKE a2 +test "$(sort a2)" = "rule22${nl}rule23" + +: > a2 +$sleep +touch b2 c2 +$MAKE a2 +test "$(sort a2)" = "rule21${nl}rule22${nl}rule23" + +: diff --cc t/empty-sources-primary.tap index 87f534848,1233f4097..3e5b3f400 --- a/t/empty-sources-primary.tap +++ b/t/empty-sources-primary.tap @@@ -14,16 -14,14 +14,16 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure empty _SOURCES works. -# From Paul Berrevoets. +# A test for missing _SOURCES variable. Also test to make sure empty +# _SOURCES suppresses assumption about default name. - . ./defs || Exit 1 + . ./defs || exit 1 +plan_ 5 + cat >> configure.ac << 'END' AC_PROG_CC -AC_SUBST(ZOO_OBJ) +AC_SUBST([zoo_obj]) END cat > Makefile.am << 'END' diff --cc t/ensure-dir-exists.sh index d47d22fb3,000000000..bc396b6d7 mode 100755,000000..100755 --- a/t/ensure-dir-exists.sh +++ b/t/ensure-dir-exists.sh @@@ -1,70 -1,0 +1,70 @@@ +#! /bin/sh +# Copyright (C) 2012 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 Automake-provided internal macro 'am__ensure_dir_exists'. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +cp "$am_amdir"/header-vars.am . \ + || fatal_ "fetching makefile fragment headers-vars.am" + +# Filter out Automake comments and things that would need configure +# substitutions. +LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk +rm -f header-vars.am + +cat > Makefile << 'END' +include ./defn.mk + +files = x/1 x/2 x/3 + +all: $(files) +.PHONY: all + +sanity-check: + $(warning $(call am__ensure_dir_exists,x)) + $(if $(filter $(call am__ensure_dir_exists,x),:MKDIR_P:),, \ + $(error am__ensure_dir_exists does not contain $$(MKDIR_P))) +.PHONY: sanity-check + +$(files): + $(call am__ensure_dir_exists,x) + echo dummy > $@ +END + +# Sanity check. +$MAKE sanity-check MKDIR_P=:MKDIR_P: + +# Basic usage. +$MAKE MKDIR_P='mkdir -p' +test -f x/1 +test -f x/2 +test -f x/3 + +# Mkdir is not called uselessly. +rm -rf x +mkdir x +$MAKE MKDIR_P=false + +# Mkdir is not called too many times. +rm -rf x +$MAKE MKDIR_P=mkdir +test -f x/1 +test -f x/2 +test -f x/3 + +: diff --cc t/exeext.sh index 5f4395739,1eb42564c..409ac755b --- a/t/exeext.sh +++ b/t/exeext.sh @@@ -69,7 -69,7 +69,7 @@@ grep 'maude3__EXEEXT__OBJECTS' Makefile ./configure - $MAKE EXEEXT=.foo print > stdout || { cat stdout; Exit 1; } -EXEEXT=.foo $MAKE -e print > stdout ++$MAKE EXEEXT=.foo print > stdout || { cat stdout; exit 1; } cat stdout grep '1BEG: maude.foo mt.foo :END1' stdout @@@ -79,7 -79,7 +79,7 @@@ grep '4BEG: rmt.foo :END4' stdou ./configure revert=yes - $MAKE EXEEXT=.foo print > stdout || { cat stdout; Exit 1; } -EXEEXT=.foo $MAKE -e print > stdout ++$MAKE EXEEXT=.foo print > stdout || { cat stdout; exit 1; } cat stdout grep '1BEG: maude.foo :END1' stdout diff --cc t/exeext4.sh index c69f656e1,6d8bc88ea..acb16cc23 --- a/t/exeext4.sh +++ b/t/exeext4.sh @@@ -17,8 -17,8 +17,8 @@@ # Make sure $(EXEEXT) is appended to programs and to tests that are # programs, but not to @substitutions@. -# For gen-testsuite-part: ==> try-with-serial-tests <== +am_serial_tests=yes - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AM_CONDITIONAL([COND], [test -n "$cond"]) diff --cc t/ext.sh index 72ff211e8,a69fe8b4a..1a198c12d --- a/t/ext.sh +++ b/t/ext.sh @@@ -34,11 -34,10 +34,11 @@@ EN $ACLOCAL $AUTOMAKE +$FGREP '%.$(OBJEXT)' Makefile.in # For debugging. + for ext in f for f90 f95 F F90 F95 r m mm upc; do - grep "%.*: %$ext" Makefile.in && Exit 1 - grep "^\.$ext\.o:" Makefile.in - grep "^$ext\.o:" Makefile.in && exit 1 - : For shells with busted 'set -e'. ++ grep "%.*: %$ext" Makefile.in && exit 1 + grep "^%\.\$(OBJEXT): %\.$ext$" Makefile.in done : diff --cc t/extra10.sh index 27eb1ed7c,de8242258..808d3dda2 --- a/t/extra10.sh +++ b/t/extra10.sh @@@ -19,7 -19,8 +19,7 @@@ # See also sister test 'extra11.test', that check a similar usage # with the involvement of the $(wildcard) GNU make builtin. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 echo AC_OUTPUT >> configure.ac diff --cc t/extra11.sh index b97000d43,f5319c61b..3f97e6bd6 --- a/t/extra11.sh +++ b/t/extra11.sh @@@ -17,7 -17,8 +17,7 @@@ # Check for more complex usage of wildcards in EXTRA_DIST. # Suggested by observations from Braden McDaniel. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 echo AC_OUTPUT >> configure.ac diff --cc t/extra12.sh index 0745850d8,a2a797b0d..67fa1fe4e --- a/t/extra12.sh +++ b/t/extra12.sh @@@ -18,7 -18,8 +18,7 @@@ # $srcdir != $builddir, if properly declared. # Suggested by observations from Braden McDaniel. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 echo AC_OUTPUT >> configure.ac diff --cc t/fort2.sh index d7348ed55,cb93e7947..510938ca1 --- a/t/fort2.sh +++ b/t/fort2.sh @@@ -19,8 -19,7 +19,8 @@@ # Cf. fort1.test and link_f90_only.test. +required=gfortran # Required only in order to run ./configure. - . ./defs || Exit 1 + . ./defs || exit 1 mkdir sub @@@ -44,49 -41,22 +44,49 @@@ EN $ACLOCAL $AUTOMAKE - grep '.\$(LINK)' Makefile.in && Exit 1 -# The following tests aren't fool-proof, but they don't -# need a Fortran compiler. + grep '.\$(LINK)' Makefile.in && exit 1 grep '.\$(FCLINK)' Makefile.in grep '.\$(FCCOMPILE)' Makefile.in > stdout cat stdout - grep -v '\$(FCFLAGS_f' stdout && Exit 1 - grep '.\$(FC.*\$(FCFLAGS_blabla' Makefile.in && Exit 1 + grep -v '\$(FCFLAGS_f' stdout && exit 1 + grep '.\$(FC.*\$(FCFLAGS_blabla' Makefile.in && exit 1 -# Notice the TAB: -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f90' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f95' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f03).*\.f03' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f08' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f95' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f90' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f03' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f90' Makefile.in && exit 1 + +sed '/^AC_FC_SRCEXT.*blabla/d' configure.ac >t +mv -f t configure.ac + +rm -rf autom4te*.cache +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +touch hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 \ + sub/bonjour.f08 bye.f95 sub/baz.f90 + +$MAKE -n FC=fake-fc \ + FCFLAGS_f90=--@90 FCFLAGS_f95=--@95 FCFLAGS_f03=--@03 FCFLAGS_f08=--@08 \ - > stdout || { cat stdout; Exit 1; } ++ > stdout || { cat stdout; exit 1; } +cat stdout +# To make it easier to have stricter grepping below. +sed -e 's/[ ][ ]*/ /g' -e 's/^/ /' -e 's/$/ /' stdout > out +cat out + +grep ' fake-fc .* --@90 .* hello\.f90 ' out +grep ' fake-fc .* --@95 .* foo\.f95 ' out +grep ' fake-fc .* --@95 .* sub/bar\.f95 ' out +grep ' fake-fc .* --@03 .* hi\.f03 ' out +grep ' fake-fc .* --@03 .* sub/howdy\.f03 ' out +grep ' fake-fc .* --@08 .* greets\.f08 ' out +grep ' fake-fc .* --@08 .* sub/bonjour\.f08 ' out +grep ' fake-fc .* --gby .* --@95 .* bye\.f95 ' out +grep ' fake-fc .* --gby .* --@90 .* sub/baz\.f90 ' out + +test `grep -c '.*--gby.*\.f' out` -eq 2 + - $EGREP 'fake-fc.*--@(95|03|08).*\.f90' out && Exit 1 - $EGREP 'fake-fc.*--@(90|03|08).*\.f95' out && Exit 1 - $EGREP 'fake-fc.*--@(90|95|08).*\.f03' out && Exit 1 - $EGREP 'fake-fc.*--@(95|95|03).*\.f08' out && Exit 1 ++$EGREP 'fake-fc.*--@(95|03|08).*\.f90' out && exit 1 ++$EGREP 'fake-fc.*--@(90|03|08).*\.f95' out && exit 1 ++$EGREP 'fake-fc.*--@(90|95|08).*\.f03' out && exit 1 ++$EGREP 'fake-fc.*--@(95|95|03).*\.f08' out && exit 1 : diff --cc t/gcj.sh index cad90b737,d069ec761..849302413 --- a/t/gcj.sh +++ b/t/gcj.sh @@@ -16,15 -16,11 +16,15 @@@ # Test of compiled java. +required='gcc gcj' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' -_AM_DEPENDENCIES([GCJ]) -AC_SUBST([GCJ]) +# FIXME: AM_PROG_GCJ should cause OBJEXT and EXEEXT to be set, but +# FIXME: it currently does not. See also xfailing test 'gcj6.sh'. +AC_PROG_CC +AM_PROG_GCJ +AC_OUTPUT END cat > Makefile.am << 'END' diff --cc t/gmake-vars.sh index 0c4012b7d,000000000..0691ae07e mode 100755,000000..100755 --- a/t/gmake-vars.sh +++ b/t/gmake-vars.sh @@@ -1,85 -1,0 +1,85 @@@ +#! /bin/sh +# Copyright (C) 2002-2012 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 that Automake does not warns about nested variables expansion, +# variables with non-POSIX names, or GNU make function calls. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat > Makefile.am <<'END' +define get-libname +$(addprefix lib, $(1)) +endef + +v0 = $(shell LC_ALL=C && export LC_ALL && echo foo* bar*) +v1 = $(sort $(wildcard foo* bar*)) +v2 = $(call get-libname, foo) +v3 = sub/$(addsuffix .a, ${v2}) +v4 = $(v3) +v4 += $(notdir ${v3}) + +x = 1 +mu1 = okey-dokey +bla = $(mu$x) +bli = $(mu$(x)) +blo = $(mu${x}) +blu = $(mu1) + +bar$(x) = 6 +baz${x} = 7 +zap$x = 8 + +.a^very-weird!var@name%accepted;by,gnu/make = wow + +.PHONY: do/test my/prereq +my/prereq: + @: Do nothing. +do/test: my/prereq + : \ + && test '$(v0)' = 'foo.sh bar.sh bar.txt' \ + && test '$(v1)' = 'bar.sh bar.txt foo.sh' \ + && test $(v3) = sub/libfoo.a \ + && test '$(v4)' = 'sub/libfoo.a libfoo.a' \ + && test $(bla) = okey-dokey \ + && test $(bli) = okey-dokey \ + && test $(blo) = okey-dokey \ + && test $(blu) = okey-dokey \ + && test $(bar1) = 6 \ + && test $(baz1) = 7 \ + && test $(zap1) = 8 \ + && test $(.a^very-weird!var@name%accepted;by,gnu/make) = wow \ +## See automake bug#9587 . + && test '$(@F)' = 'test' \ + && test '$(@D)' = 'do' \ + && test '$(> configure.ac + +$ACLOCAL +AUTOMAKE_run +test ! -s stderr + +: > foo.sh +: > bar.sh +: > bar.txt + +$AUTOCONF +./configure +$MAKE 'do/test' + +: diff --cc t/gnits2.sh index e27a87e71,bf8ec34b4..6e4e1a4b3 --- a/t/gnits2.sh +++ b/t/gnits2.sh @@@ -107,7 -107,7 +107,7 @@@ cd buil ../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p $MAKE all $MAKE test-install - $MAKE -k installcheck 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k. ++$MAKE -k installcheck 2>stderr && { cat stderr >&2; exit 1; } cat stderr >&2 $MAKE grep-stderr diff --cc t/gnits3.sh index 544331d7a,0b67253ef..b3a885e42 --- a/t/gnits3.sh +++ b/t/gnits3.sh @@@ -86,8 -86,8 +86,8 @@@ cd buil ../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p $MAKE $MAKE install - $MAKE installcheck && Exit 1 - $MAKE -k installcheck 2>stderr && { cat stderr >&2; Exit 1; } + $MAKE installcheck && exit 1 -$MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k. ++$MAKE -k installcheck 2>stderr && { cat stderr >&2; exit 1; } cat stderr >&2 $MAKE grep-stderr diff --cc t/gnumake.sh index dd2fe378f,ed660a2ff..7b1fbfe57 --- a/t/gnumake.sh +++ b/t/gnumake.sh @@@ -17,7 -17,8 +17,7 @@@ # Automake should not assume that make files are called Makefile. # Report from Braden McDaniel. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_FILES([sub/GNUmakefile]) diff --cc t/instdir-java.sh index f39b3c18b,f9c651c18..5d2d77685 --- a/t/instdir-java.sh +++ b/t/instdir-java.sh @@@ -45,16 -45,16 +45,16 @@@ cd buil ../configure --prefix="$instdir" $MAKE -javadir= -export javadir -$MAKE -e install +xMAKE() { $MAKE javadir= "$@"; } + +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/instdir-lisp.sh index b7f04bf1d,0c2fa1ebe..0bcf58428 --- a/t/instdir-lisp.sh +++ b/t/instdir-lisp.sh @@@ -42,16 -42,17 +42,16 @@@ cd buil ../configure --prefix="$instdir" $MAKE -lispdir= -export lispdir +xMAKE () { $MAKE lispdir= "$@"; } -$MAKE -e install +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/instdir-ltlib.sh index 13615905b,dcd03624e..430fb74e0 --- a/t/instdir-ltlib.sh +++ b/t/instdir-ltlib.sh @@@ -68,20 -69,20 +68,20 @@@ cd buil am_cv_python_pyexecdir="$instdir/pyexec" $MAKE -bindir= libdir= pyexecdir= -export bindir libdir pyexecdir -$MAKE -e install +xMAKE() { $MAKE bindir= libdir= pyexecdir= "$@"; } + +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. - grep 'rm'' ' stdout && Exit 1 - xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; } + grep 'rm'' ' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } ++xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. - grep 'rm'' ' stdout && Exit 1 + grep 'rm'' ' stdout && exit 1 : diff --cc t/instdir-no-empty.sh index 45b341c33,53572644b..136e1e37c --- a/t/instdir-no-empty.sh +++ b/t/instdir-no-empty.sh @@@ -106,16 -106,16 +106,16 @@@ doinst ( ./configure --prefix="$cwd/inst" doinst - test ! -d inst || { find inst; Exit 1; } + test ! -d inst || { find inst; exit 1; } $MAKE uninstall -doinst bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh' +doinst bin_SCRIPTS=foo.sh test -f inst/bin/foo.sh ./configure doinst DESTDIR="$cwd/dest" - test ! -d dest || { find dest; Exit 1; } + test ! -d dest || { find dest; exit 1; } $MAKE uninstall -doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh' +doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh test -f dest/usr/local/bin/foo.sh : diff --cc t/instdir-prog.sh index 6523c34a5,7306c5c94..4eb1f695c --- a/t/instdir-prog.sh +++ b/t/instdir-prog.sh @@@ -67,21 -68,20 +67,21 @@@ cd buil am_cv_python_pyexecdir="$instdir/pyexec" $MAKE -bindir= libdir= pyexecdir= +xMAKE () { $MAKE bindir= libdir= pyexecdir= "$@"; } + export bindir libdir pyexecdir -$MAKE -e install +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. - grep 'rm'' ' stdout && Exit 1 - xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; } + grep 'rm'' ' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } ++xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. - grep 'rm'' ' stdout && Exit 1 + grep 'rm'' ' stdout && exit 1 : diff --cc t/instdir-python.sh index 55e23c253,3d39bd8e0..4fed80474 --- a/t/instdir-python.sh +++ b/t/instdir-python.sh @@@ -46,16 -46,17 +46,16 @@@ cd buil ../configure --prefix="$instdir" $MAKE -pythondir= -export pythondir +xMAKE () { $MAKE pythondir= "$@"; } -$MAKE -e install +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/instdir-texi.sh index 214e330f7,b15ecaac8..146fa5238 --- a/t/instdir-texi.sh +++ b/t/instdir-texi.sh @@@ -56,16 -56,17 +56,16 @@@ cd buil $MAKE all dvi ps pdf html ls -l -infodir= htmldir= dvidir= psdir= pdfdir= -export infodir htmldir dvidir psdir pdfdir +xMAKE () { $MAKE infodir= htmldir= dvidir= psdir= pdfdir= "$@"; } -$MAKE -e install install-html install-dvi install-ps install-pdf +xMAKE install install-html install-dvi install-ps install-pdf test ! -d "$instdir" -$MAKE -e install install-html install-dvi install-ps install-pdf DESTDIR="$destdir" +xMAKE install install-html install-dvi install-ps install-pdf DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/instdir.sh index c30ce92d3,f9d8e641d..f35dcbf44 --- a/t/instdir.sh +++ b/t/instdir.sh @@@ -55,19 -55,17 +55,19 @@@ cd buil ../configure --prefix="$instdir" $MAKE -bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= -export bindir datadir includedir foodir bardir man1dir man2dir +xMAKE () +{ + $MAKE bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= "$@" +} -$MAKE -e install +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/instdir2.sh index c84d256fb,27314814d..2393026bc --- a/t/instdir2.sh +++ b/t/instdir2.sh @@@ -77,19 -77,17 +77,19 @@@ cd buil ../configure --prefix="$instdir" $MAKE -bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= -export bindir datadir includedir foodir bardir man1dir man2dir +xMAKE () +{ + $MAKE bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= "$@" +} -$MAKE -e install +xMAKE install test ! -d "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -d "$instdir" test ! -d "$destdir" - xMAKE uninstall > stdout || { cat stdout; Exit 1; } -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } ++xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout - grep 'rm -f' stdout && Exit 1 + grep 'rm -f' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" +xMAKE uninstall DESTDIR="$destdir" : diff --cc t/internals.tap index 2c2fccda6,000000000..aaf6b9399 mode 100755,000000..100755 --- a/t/internals.tap +++ b/t/internals.tap @@@ -1,182 -1,0 +1,182 @@@ +#! /bin/sh +# Copyright (C) 2012 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 some generic Automake-provided internal macros and make functions. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +plan_ 8 + +cp "$am_amdir"/header-vars.am . \ + || fatal_ "fetching makefile fragment headers-vars.am" + +# Filter out Automake comments and things that would need configure +# substitutions. +LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk +rm -f header-vars.am + +# WARNING: there are a lot of embedded tabs in this makefile. +# DO NOT "NORMALIZE" THEM TO SPACES! +cat > Makefile << 'END' +include ./defn.mk + +lower = abcdefghijklmnopqrstuvwxyz +upper = ABCDEFGHIJKLMNOPQRSTUVWXYZ +digits = 0123456789 +comma = , +dollar = $$ +bslash = \\ + +default: + @echo Please select an explicit test; exit 1 +.PHONY: default + +.PHONY: test-strip-firstword +test-strip-firstword: + test '$(call am__strip_firstword,)' = '' + test '$(call am__strip_firstword,1)' = '' + test '$(call am__strip_firstword,1 1)' = '1' + test '$(call am__strip_firstword,1 2)' = '2' + test '$(call am__strip_firstword,1 2 3 4 5 6 7 8)' = '2 3 4 5 6 7 8' + test '$(call am__strip_firstword, 1 2 )' = '2' + +.PHONY: test-strip-lastword +test-strip-lastword: + test '$(call am__strip_lastword,)' = '' + test '$(call am__strip_lastword,1)' = '' + test '$(call am__strip_lastword,1 1)' = '1' + test '$(call am__strip_lastword,1 2)' = '1' + test '$(call am__strip_lastword,1 2 3 4 5 6 7 8)' = '1 2 3 4 5 6 7' + test '$(call am__strip_lastword, 1 2 )' = '1' + +.PHONY: test-uniq +test-uniq: + test '$(call am__uniq,)' = '' + test '$(call am__uniq,1)' = '1' + test '$(call am__uniq,1 1)' = '1' + test '$(call am__uniq,1 2)' = '1 2' + test '$(call am__uniq,2 1)' = '2 1' + test '$(call am__uniq,1 2 3)' = '1 2 3' + test '$(call am__uniq,2 3 1)' = '2 3 1' + test '$(call am__uniq,1 1 1)' = '1' + test '$(call am__uniq,1 2 1)' = '1 2' + test '$(call am__uniq,2 1 1)' = '2 1' + test '$(call am__uniq,2 1 1)' = '2 1' + test '$(call am__uniq,2 2 1)' = '2 1' + test '$(call am__uniq,1 1 1 3 1 1 1)' = '1 3' + test '$(call am__uniq,3 1 1 4 1 4 1 1)' = '3 1 4' + test '$(call am__uniq, 1 3 1 )' = '1 3' + +.PHONY: test-strip-suffixes +test-strip-suffixes: + test '$(call am__strip_suffixes,,)' = '' + test '$(call am__strip_suffixes, ,)' = '' + test '$(call am__strip_suffixes,, )' = '' + test '$(call am__strip_suffixes, , )' = '' + test '$(call am__strip_suffixes,x,)' = '' + test '$(call am__strip_suffixes,x y, )' = '' + test '$(call am__strip_suffixes,,x y)' = 'x y' + test '$(call am__strip_suffixes, ,x y)' = 'x y' + test '$(call am__strip_suffixes,.c,foo.c)' = 'foo' + test '$(call am__strip_suffixes,.foo,a.foo b.foo)' = 'a b' + test '$(call am__strip_suffixes, x y, ax ay ax)' = 'a a a' + test '$(call am__strip_suffixes,x,ax)' = 'a' + test '$(call am__strip_suffixes,x,xa)' = 'xa' + test '$(call am__strip_suffixes,x,xx)' = 'x' + test '$(call am__strip_suffixes,x,xux)' = 'xu' + test '$(call am__strip_suffixes, .c .c++, \ + foo.c bar.c++ baz.cxx zap.c)' = 'foo bar baz.cxx zap' + test '$(call am__strip_suffixes, .a .b, \ + 1.a.a 2.a.b 3.b.a 4.b.b)' = '1.a 2.a 3.b 4.b' + # Corner cases: the *first* matched suffix is stripped + test '$(call am__strip_suffixes,.a .b,x.a.a)' = 'x.a' + test '$(call am__strip_suffixes,.a .b,x.a.b)' = 'x.a' + test '$(call am__strip_suffixes,.a .b,x.b.a)' = 'x.b' + test '$(call am__strip_suffixes,.a .b,x.b.b)' = 'x.b' + test '$(call am__strip_suffixes, .a .b.a, foo.b.a bar.a)' \ + = 'foo.b bar' + test '$(call am__strip_suffixes, .b.a .a, foo.b.a bar.a)' \ + = 'foo bar' + +.PHONY: test-toupper +test-toupper: + test '$(call am__toupper,a)' = A + test '$(call am__toupper,A)' = A + test '$(call am__toupper,aba)' = ABA + test '$(call am__toupper,a b)' = 'A B' + test '$(call am__toupper, a B)' = ' A B' + test '$(call am__toupper,Ab )' = 'AB ' + test '$(call am__toupper,A B c )' = 'A B C ' + test '$(call am__toupper,0)' = 0 + test '$(call am__toupper,0d)' = 0D + test '$(call am__toupper,@:&/?-)' = '@:&/?-' + test '$(call am__toupper,a@B)' = A@B + test '$(call am__toupper,zxzxzxZXZxzxzxzxzx)' = ZXZXZXZXZXZXZXZXZX + test '$(call am__toupper,$(lower))' = '$(upper)' + test '$(call am__toupper,$(upper))' = '$(upper)' + +.PHONY: test-tolower +test-tolower: + test '$(call am__tolower,A)' = a + test '$(call am__tolower,a)' = a + test '$(call am__tolower,ABA)' = aba + test '$(call am__tolower,A B)' = 'a b' + test '$(call am__tolower, A b)' = ' a b' + test '$(call am__tolower,aB )' = 'ab ' + test '$(call am__tolower,a b C )' = 'a b c ' + test '$(call am__tolower,0)' = 0 + test '$(call am__tolower,0D)' = 0d + test '$(call am__tolower,@:&/?-)' = '@:&/?-' + test '$(call am__tolower,a@B)' = a@b + test '$(call am__tolower,ZXZXZXzxzXZXZXZXZX)' = zxzxzxzxzxzxzxzxzx + test '$(call am__tolower,$(upper))' = '$(lower)' + test '$(call am__tolower,$(lower))' = '$(lower)' + +.PHONY: test-canonicalize +test-canonicalize: + test '$(call am__canon,A)' = A + test '$(call am__canon, b)' = b + test '$(call am__canon, foo )' = foo + test '$(call am__canon,$(upper)$(lower)$(digits)_)' = '$(upper)$(lower)$(digits)_' + test '$(call am__canon,@)' = '@' + test '$(call am__canon,%)' = '_' + test '$(call am__canon,.&@!;)' = '__@__' + test '$(call am__canon,')' = '_' + test '$(call am__canon,$(dollar))' = '_' + test '$(call am__canon,$(bslash))' = '_' + test '$(call am__canon,$(comma))' = '_' + test '$(call am__canon,$(bslash)$(comma))' = '__' + test '$(call am__canon,x$(comma)@$(bslash))' = 'x_@_' + +.PHONY: test-newline +test-newline: + @echo OK > foo$(am__newline)@touch bar$(am__newline)-false > baz + test `cat foo` = OK + test -f bar + test -f baz +END + +command_ok_ am__strip_firstword $MAKE test-strip-firstword +command_ok_ am__strip_lastword $MAKE test-strip-lastword +command_ok_ am__uniq $MAKE test-uniq +command_ok_ am__test_strip_suffixes $MAKE test-strip-suffixes +command_ok_ am__tolower $MAKE test-tolower +command_ok_ am__toupper $MAKE test-toupper +command_ok_ am__canon $MAKE test-canonicalize +command_ok_ am__newline $MAKE test-newline + +: diff --cc t/interp3.sh index 1394c6d18,9c56acaf5..b0ed1c7f0 --- a/t/interp3.sh +++ b/t/interp3.sh @@@ -14,14 -14,9 +14,14 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test exe-specific flags with dependency tracking. +# Variable interpolation should work even when GNU make functions are +# involved. This is unfortunately not the case currently, due to +# historical and hard-to-lift limitations (this is also documented in +# the manual, using an example that is a stripped-down version of this +# test case). +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/lex-depend.sh index 653ae8da0,7280b84db..9d4f9609f --- a/t/lex-depend.sh +++ b/t/lex-depend.sh @@@ -77,9 -77,9 +77,9 @@@ $AUTOCON # using slow dependency extractors. ./configure --enable-dependency-tracking -$MAKE test-deps-exist $MAKE +$MAKE test-deps-exist - cross_compiling || test "$(./zoo)" = 'Hello, World!' || Exit 1 + cross_compiling || test "$(./zoo)" = 'Hello, World!' || exit 1 $sleep cat >> my-hdr.h << 'END' diff --cc t/lex-lib-external.sh index 238a12662,9a64266c9..28f254b06 --- a/t/lex-lib-external.sh +++ b/t/lex-lib-external.sh @@@ -71,9 -71,9 +71,9 @@@ $MAKE have-lexlib || skip_ "no system-w $MAKE all if ! cross_compiling; then echo GOOD | ./lexer - echo BAD | ./lexer && Exit 1 + echo BAD | ./lexer && exit 1 : For shells with busted 'set -e'. fi -yl_distcheck +$MAKE distcheck : diff --cc t/lex-line.sh index 3db979f30,9629cce24..fc7ce17ec --- a/t/lex-line.sh +++ b/t/lex-line.sh @@@ -20,9 -20,10 +20,9 @@@ # See also sister test 'yacc-line.test'. required='cc lex' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' -AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC AM_PROG_CC_C_O AC_PROG_LEX @@@ -83,24 -103,28 +83,24 @@@ for vpath in : false; d $MAKE # For debugging, - ls -l . sub sub/dir + ls -l . dir $EGREP 'line|\.l' $c_outputs - grep '#.*line.*build.*\.l' $c_outputs && Exit 1 + grep '#.*line.*build.*\.l' $c_outputs && exit 1 # Adjusted "#line" should not contain reference to the absolute # srcdir. - $EGREP '#.*line *"?/.*\.l' $c_outputs && Exit 1 + $EGREP '#.*line *"?/.*\.l' $c_outputs && exit 1 # Adjusted "#line" should not contain reference to the default # output file names, e.g., 'lex.yy.c'. - grep '#.*line.*lex\.yy' $c_outputs && Exit 1 + grep '#.*line.*lex\.yy' $c_outputs && exit 1 # Look out for a silly regression. - grep "#.*\.l.*\.l" $c_outputs && Exit 1 + grep "#.*\.l.*\.l" $c_outputs && exit 1 if $vpath; then grep '#.*line.*"\.\./zardoz\.l"' zardoz.c - grep '#.*line.*"\.\./dir/quux\.l"' bar-quux.c - grep '#.*line.*"\.\./\.\./sub/zardoz\.l"' sub/foo-zardoz.c - grep '#.*line.*"\.\./\.\./sub/dir/quux\.l"' sub/dir/quux.c + grep '#.*line.*"\.\./dir/quux\.l"' dir/bar-quux.c else grep '#.*line.*"zardoz\.l"' zardoz.c - grep '#.*line.*"dir/quux\.l"' bar-quux.c - grep '#.*line.*"zardoz\.l"' sub/foo-zardoz.c - grep '#.*line.*"dir/quux\.l"' sub/dir/quux.c + grep '#.*line.*"dir/quux\.l"' dir/bar-quux.c fi cd $srcdir diff --cc t/lex-subobj-nodep.sh index f2c9626f0,0c021a26a..526e01b64 --- a/t/lex-subobj-nodep.sh +++ b/t/lex-subobj-nodep.sh @@@ -14,11 -14,11 +14,11 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Ensure subdirs for subdir scanners are generated when subdir-objects -# are used, even when dependency tracking is disabled. +# Ensure subdirs for subdir scanners are generated, even when dependency +# tracking is disabled. required='cc lex' - . ./defs || Exit 1 + . ./defs || exit 1 cat >>configure.ac <<\END AC_PROG_CC diff --cc t/libobj20b.sh index 395bd7b19,a90df20b6..fce4ab342 --- a/t/libobj20b.sh +++ b/t/libobj20b.sh @@@ -15,9 -15,9 +15,9 @@@ # along with this program. If not, see . # Test error reporting for AC_CONFIG_LIBOBJ_DIR. -# See also sister tests 'libobj20a.test' and 'libobj20c.test' . +# See also sister test 'libobj20c.sh'. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_LIBOBJ_DIR([libobj-dir]) diff --cc t/libobj20c.sh index e764e975d,2d1d65b5a..533f195a1 --- a/t/libobj20c.sh +++ b/t/libobj20c.sh @@@ -15,9 -15,9 +15,9 @@@ # along with this program. If not, see . # Test error reporting for AC_CONFIG_LIBOBJ_DIR. -# See also sister tests 'libobj20a.test' and 'libobj20b.test' . +# See also sister test 'libobj20b.sh'. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_LIBOBJ_DIR([libobj-dir]) diff --cc t/libtoo10.sh index 07efaea3e,d78886a20..78d150aa9 --- a/t/libtoo10.sh +++ b/t/libtoo10.sh @@@ -16,13 -16,9 +16,13 @@@ # Make sure .libs directories are removed for _PROGRAMS. # Report from Guillermo Ontañón. +# Also make sure the 'so_locations' files generated by some linkers +# (OSF, IRIX) are removed. +# And also make sure the generated 'libtool' script as well as the +# *.lo files are removed when they should. required='cc libtoolize' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AM_PROG_AR @@@ -56,11 -52,7 +56,11 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure $MAKE all check +: > lib/so_locations +: > src/so_locations $MAKE clean - ls *.lo && Exit 1 ++ls *.lo && exit 1 +test -f libtool test ! -d src/.libs test ! -d src/_libs test ! -d check/.libs diff --cc t/libtool3.sh index 711581a90,22c72d1d8..456cf62ed --- a/t/libtool3.sh +++ b/t/libtool3.sh @@@ -76,8 -75,12 +76,8 @@@ $ACLOCA $AUTOCONF $AUTOMAKE --add-missing --copy -# We need explicit rules to build 1.o and a.lo. Make sure -# Automake did not output additional rules for 1.lo and and a.lo. -$FGREP '1.o:' Makefile.in -$FGREP '1.lo:' Makefile.in && exit 1 -$FGREP 'a.o:' Makefile.in && exit 1 -$FGREP 'a.lo:' Makefile.in +# We shouldn't need explicit rules. - $EGREP '[^%]\.(o|obj|lo|\$\(OBJEXT\)) *:' Makefile.in && Exit 1 ++$EGREP '[^%]\.(o|obj|lo|\$\(OBJEXT\)) *:' Makefile.in && exit 1 ./configure diff --cc t/libtool9.sh index ac3a6b0a4,eb777d807..4d82ddfce --- a/t/libtool9.sh +++ b/t/libtool9.sh @@@ -85,11 -85,9 +85,11 @@@ $AUTOCON $AUTOMAKE --add-missing --copy ./configure -env LDFLAGS=ldflags AM_LDFLAGS=am_ldflags libmod1_la_LDFLAGS=lm1_la_ldflags \ - CFLAGS=cflags AM_CFLAGS=am_cflags prg2_CFLAGS=prg2_cflags \ - $MAKE -e print >output 2>&1 || { cat output; exit 1; } +$MAKE LDFLAGS=ldflags AM_LDFLAGS=am_ldflags \ + CFLAGS=cflags AM_CFLAGS=am_cflags \ + libmod1_la_LDFLAGS=lm1_la_ldflags \ + prg2_CFLAGS=prg2_cflags \ - print >output 2>&1 || { cat output; Exit 1; } ++ print >output 2>&1 || { cat output; exit 1; } cat output grep '1BEG: libmod1.la mod2.la :END1' output grep '2BEG: mod2.la :END2' output diff --cc t/link_cond.sh index 9c120af7f,a5ac4b101..459453cb5 --- a/t/link_cond.sh +++ b/t/link_cond.sh @@@ -64,7 -64,7 +64,7 @@@ $MAKE CXX=fals # Sanity check. rm -f foo foo.exe - $MAKE CC=false && Exit 99 -CC=false $MAKE -e && exit 99 ++$MAKE CC=false && exit 99 $MAKE distclean @@@ -83,6 -83,6 +83,6 @@@ $MAKE CC=fals # Sanity check. rm -f foo foo.exe - $MAKE CXX=false && Exit 99 -CXX=false $MAKE -e && exit 99 ++$MAKE CXX=false && exit 99 : diff --cc t/lisp3.sh index ea18e0021,5b95715ec..9425d9c32 --- a/t/lisp3.sh +++ b/t/lisp3.sh @@@ -84,9 -84,9 +84,9 @@@ find _inst | $EGREP '\.elc?$' && exit unique=0a3346e2af8a689b85002b53df09142a $sleep echo "(message \"$unique\")(provide 'am-three)" > am-three.el - $MAKE 2>stderr || { cat stderr >&2; Exit 1; } -$MAKE >output 2>&1 || { cat output; exit 1; } -cat output -grep $unique output ++$MAKE 2>stderr || { cat stderr >&2; exit 1; } +cat stderr >&2 +grep $unique stderr # It should also work for VPATH-builds. $MAKE distcheck diff --cc t/lisp8.sh index d686bfb9d,6e6b901de..c542cf749 --- a/t/lisp8.sh +++ b/t/lisp8.sh @@@ -16,8 -16,8 +16,8 @@@ # Check the recover rule of lisp_LISP with parallel make. -required='GNUmake emacs' +required=emacs - . ./defs || Exit 1 + . ./defs || exit 1 cat > Makefile.am << 'EOF' dist_lisp_LISP = am-one.el am-two.el am-three.el diff --cc t/local-targets.sh index 003a7e3f3,000000000..d15bc809a mode 100755,000000..100755 --- a/t/local-targets.sh +++ b/t/local-targets.sh @@@ -1,62 -1,0 +1,62 @@@ +#! /bin/sh +# Copyright (C) 2001-2012 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 . + +# The 'all-local', 'check-local' and 'installdirs-local' targets can +# also be defined by included or wrapper Makefiles that Automake never +# sees, as well as through GNU make constructs that Automake does not +# parse. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_SUBST([SafeInclude], [include]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +@SafeInclude@ ./inc.mk +$(foreach x,all check installdirs,$(eval $(x)-local:: ; : > main-$(x))) +END + +cat > inc.mk << 'END' +all-local check-local installdirs-local:: %-local: + : > incl-$* +END + +cat > GNUmakefile << 'END' +include ./Makefile +all-local check-local installdirs-local:: %-local: + : > wrap-$* +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE check installdirs +test -f wrap-all +test -f wrap-check +test -f wrap-installdirs +test -f incl-all +test -f incl-check +test -f incl-installdirs +test -f main-all +test -f main-check +test -f main-installdirs + +: diff --cc t/longline.sh index e246e3008,d0240fdc6..2536846ea --- a/t/longline.sh +++ b/t/longline.sh @@@ -14,19 -14,16 +14,19 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Long lines of += should be wrapped. +# Long lines of = and += should be wrapped. # Report from Simon Josefsson. - . ./defs || Exit 1 + . ./defs || exit 1 -(echo DUMMY = some_long_filename_1; -for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; -do - echo DUMMY += some_long_filename_$i -done) > Makefile.am +i=0 +while test $i -lt 30; do + echo some_very_very_long_variable_content_$i + i=$((i + 1)) +done > t + +{ echo "DUMMY =" && sed 's/^/DUMMY +=/' t; } > Makefile.am +{ echo "ZARDOZ =" && cat t; } | tr '\012\015' ' ' >> Makefile.am $ACLOCAL $AUTOMAKE diff --cc t/makej.sh index 617b45f58,b339bd73c..3b236bf2f --- a/t/makej.sh +++ b/t/makej.sh @@@ -21,7 -21,8 +21,7 @@@ # depend on the time at which autoconf and automake update the cache # via autom4te. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 cat >configure.ac <>configure.ac <<'END' AC_OUTPUT diff --cc t/maken.sh index ffd5ef0df,ec7200895..0caa12cf7 --- a/t/maken.sh +++ b/t/maken.sh @@@ -14,12 -14,12 +14,12 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Ensure that 'make -n dist' and 'make -n distcheck' do not change files +# Ensure that "make -n dist" and "make -n distcheck" do not change files # on disk, due to GNU make executing rules containing '$(MAKE)'. -# Also, ensure that 'make -n dist' and 'make -n distcheck' show what -# would happen, at least when using GNU make. +# Also, ensure that "make -n dist" and "make -n distcheck" show what +# would happen. - . ./defs || Exit 1 + . ./defs || exit 1 mkdir sub diff --cc t/maken3.sh index 5f9981e4a,99e2305bf..3dca8a602 --- a/t/maken3.sh +++ b/t/maken3.sh @@@ -23,8 -25,23 +23,8 @@@ # as well as tags, TAGS. # For gen-testsuite-part: ==> try-with-serial-tests <== - . ./defs || Exit 1 + . ./defs || exit 1 -# Does $MAKE support the '.MAKE' special target? -have_dotmake=false -if using_gmake; then - have_dotmake=: # GNU make must support it. -else - unindent > mk.tmp << 'END' - targ.tmp: - : > $@ - .MAKE: targ.tmp -END - if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then - have_dotmake=: - fi -fi - mkdir sub sub2 cat >> configure.ac << 'END' @@@ -132,22 -149,28 +132,22 @@@ check_targets ( case $target in install-* | installdirs | tags | TAGS ) ;; *) - grep "stamp-$target$" stdout || Exit 1 - test ! -f "stamp-$target$" || Exit 1 - if $have_dotmake; then - grep "stamp-$target$" stdout || exit 1 - fi ++ grep "stamp-$target$" stdout || exit 1 + test ! -f "stamp-$target$" || exit 1 ;; esac case $target in install-* | installdirs ) ;; *) - grep "stamp-$target-sub" stdout || Exit 1 - test ! -f "sub/stamp-$target-sub" || Exit 1 - if $have_dotmake; then - grep "stamp-$target-sub" stdout || exit 1 - fi ++ grep "stamp-$target-sub" stdout || exit 1 + test ! -f "sub/stamp-$target-sub" || exit 1 ;; esac case $target in distclean | maintainer-clean ) ;; *) - grep "should-not-be-executed" stdout || Exit 1 - test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1 - if $have_dotmake; then - grep "should-not-be-executed" stdout || exit 1 - fi ++ grep "should-not-be-executed" stdout || exit 1 + test ! -f "sub2/sub2-$target-should-not-be-executed" || exit 1 ;; esac done diff --cc t/man6.sh index dfaeb12de,dc90321ff..c2f21a9b7 --- a/t/man6.sh +++ b/t/man6.sh @@@ -18,8 -18,12 +18,8 @@@ # even if the 'missing' script is involved. required=help2man - . ./defs || Exit 1 + . ./defs || exit 1 -# Avoid a spurious failure due to a known FreeBSD make incompatibility. -useless_vpath_rebuild \ - && skip_ "VPATH useless rebuild detected (see bug#7884)" - cat > Makefile.am << 'END' dist_man_MANS = $(srcdir)/foobar.1 bazquux.1 zardoz.1 dist_bin_SCRIPTS = foobar bazquux zardoz diff --cc t/man8.sh index 4293fde0e,a7116ae7e..597093f94 --- a/t/man8.sh +++ b/t/man8.sh @@@ -16,8 -16,12 +16,8 @@@ # Check for a bug in distcheck w.r.t. generated manpages. - . ./defs || Exit 1 + . ./defs || exit 1 -# Avoid a spurious failure due to a known FreeBSD make incompatibility. -useless_vpath_rebuild \ - && skip_ "VPATH useless rebuild detected (see bug#7884)" - cat > Makefile.am << 'END' dist_man_MANS = foo.1 foo.1: diff --cc t/memoize.tap index b9188bf72,000000000..ea2f69e5b mode 100755,000000..100755 --- a/t/memoize.tap +++ b/t/memoize.tap @@@ -1,326 -1,0 +1,326 @@@ +#! /bin/sh +# Copyright (C) 2012 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 Automake-provided memoization for make variables. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +plan_ 17 + +ocwd=`pwd` || fatal_ "couldn't get current working directory" + +cp "$am_amdir"/header-vars.am . \ + || fatal_ "fetching makefile fragment headers-vars.am" + +# Filter out Automake comments and things that would need configure +# substitutions. +LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk +rm -f header-vars.am + +T () +{ + tcount=`expr $tcount + 1` + mkdir $tcount.d + cd $tcount.d + echo include ../defn.mk > Makefile + cat >> Makefile + command_ok_ "$1" "$MAKE" test + cd .. +} +tcount=0 + +#--------------------------------------------------------------------------- + +## NOTE: Every repeated check in the recipes of the tests below is +## really intended! + +#--------------------------------------------------------------------------- + +T "basic usage" <<'END' + +foo = $(call am__memoize,foo,ok) + +test: + test '$(foo)' = ok + test '$(foo)' = ok +END + +#--------------------------------------------------------------------------- + +T "variables expanding to blanks only (1)" <<'END' + +foo = $(call am__memoize,foo,$(am__empty) ) + +test: + test '$(foo)' = ' ' + test '$(foo)' = ' ' +END + +#--------------------------------------------------------------------------- + +T "variables expanding to blanks only (2)" < x +one: one-setup + test -f x + test '$(foo1)' = '+' + test ! -f y + test '$(foo2)' = '-' +two-setup: + rm -f x + echo dummy > y +two: two-setup + test ! -f x + test '$(foo1)' = '+' + test -f y + test '$(foo2)' = '-' +END + +#--------------------------------------------------------------------------- + + +T "definition on multiple lines" <<'END' + +foo = $(call am__memoize,foo,a \ + b \ + c \ + \ + d) + +test: + test '$(foo)' = 'a b c d' + test '$(foo)' = 'a b c d' +END + +#--------------------------------------------------------------------------- + +# This usage has been known to cause problems with GNU make <= 3.82, +# tickling this bug: +# +# + +T "known GNU make issue (https://savannah.gnu.org/patch/?7534)" <<'END' + +setup := $(shell mkdir -p t/pm && : > t/pm/Cond2.pl) + +TESTS = $(wildcard t/pm/Cond2.pl) +am__test_bases = $(call am__memoize,am__test_bases,$(TESTS)) + +test: + test '$(am__test_bases)' = 't/pm/Cond2.pl' +END + +#--------------------------------------------------------------------------- + +# Try memoization with variables having a very long content. Our first +# (unpublished) memoization implementation didn't work in that case -- it +# triggered errors like "*** unterminated variable reference. Stop" when +# the content's length because big enough. + +line='dummy abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ =' + +# About 1 million lines. +echo " $line \\" > t +for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do + cat t t > t1 + mv -f t1 t +done + +echo "list = \$(call am__memoize,list,$line \\" >> big.mk +cat t >> big.mk +echo " $line)" >> big.mk + +cat >> big.mk << 'END' +test: + test x'$(word 1, $(list))' = x'dummy' + test x'$(word 3, $(list))' = x'=' + test x'$(word 31, $(list))' = x'dummy' + test x'$(word 93, $(list))' = x'=' +END + +T "very long variable content" < big.mk + +#--------------------------------------------------------------------------- + +: diff --cc t/mkinst3.sh index 79a8dd5d0,258275821..880d417b3 --- a/t/mkinst3.sh +++ b/t/mkinst3.sh @@@ -14,10 -14,10 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test mkinstalldirs with spaces in directory names. +# Test "install-sh -d" with spaces in directory names. am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 cwd=$(pwd) || fatal_ "getting current working directory" diff --cc t/multlib.sh index 1744b36bb,778db14e4..a5b1c94a3 --- a/t/multlib.sh +++ b/t/multlib.sh @@@ -19,8 -19,8 +19,8 @@@ # FIXME: the features tested by this script has been moved in contrib. # FIXME: We should move this script accordingly. -required='gcc GNUmake' +required=gcc - . ./defs || Exit 1 + . ./defs || exit 1 mldir=$am_top_srcdir/contrib/multilib mkdir m4 diff --cc t/no-c.tap index 5adb056df,000000000..90a767ed7 mode 100755,000000..100755 --- a/t/no-c.tap +++ b/t/no-c.tap @@@ -1,57 -1,0 +1,57 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Projects using only Fortran or C++ shouldn't need C-related stuff. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +plan_ 6 + +only_ () +{ + test $# -eq 3 || fatal_ "only_: bad usage" + lang=$1; shift + macro=$1; shift + sources=$* + : ================ $lang ================ : + mkdir "$macro" + cd "$macro" + unindent > configure.ac < Makefile.am + echo foo_SOURCES = $sources >> Makefile.am + r=ok + $ACLOCAL \ + && $AUTOMAKE -a \ + && not $EGREP '\(CC\)|\(CFLAGS\)|AM_CFLAGS' Makefile.in \ + || r='not ok' + result_ "$r" "$lang only" + cd .. +} + +only_ "C++" AC_PROG_CXX '1.cxx 2.cpp 3.c++ 4.cc 5.C' +only_ "Fortran" AC_PROG_FC 'a.f90 b.f95 c.f03 d.f08' +only_ "Fortran 77" AC_PROG_F77 'x.f y.for' +only_ "Java" AM_PROG_GCJ 'foo.java bar.class' +only_ "Objective C" AC_PROG_OBJC 'zardoz.m fu.m' +only_ "Objective C++" AC_PROG_OBJCXX 'foo.mm bar.mm' + +: diff --cc t/no-extra-makefile-code.sh index 1c91452e4,ab0e33d3a..cfe124945 --- a/t/no-extra-makefile-code.sh +++ b/t/no-extra-makefile-code.sh @@@ -30,6 -30,7 +30,6 @@@ rm -f depcomp compil $ACLOCAL $AUTOMAKE - $EGREP 'INCLUDE|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in && Exit 1 -$EGREP 'DEFAULT_INCLUDES|@am__isrc@|-compile|\$\(OBJEXT\)|tab\.[ch]' \ - Makefile.in && exit 1 ++$EGREP 'INCLUDE|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in && exit 1 : diff --cc t/nodist.sh index 931b5c87c,f63ea976a..41083c3f6 --- a/t/nodist.sh +++ b/t/nodist.sh @@@ -34,7 -34,7 +34,7 @@@ $ACLOCA $AUTOMAKE grep '^am_eyeball_OBJECTS' Makefile.in -grep '^DIST_SOURCES =' Makefile.in -grep '^DIST_SOURCES =.*nodist' Makefile.in && exit 1 +grep '^am__dist_sources =' Makefile.in - grep '^am__dist_sources =.*nodist' Makefile.in && Exit 1 ++grep '^am__dist_sources =.*nodist' Makefile.in && exit 1 : diff --cc t/nodist3.sh index 07e904724,f45f66f9e..33a2d5c20 --- a/t/nodist3.sh +++ b/t/nodist3.sh @@@ -31,7 -31,7 +31,7 @@@ EN $ACLOCAL $AUTOMAKE - grep '^dist:' Makefile.in && Exit 1 - grep 'am__dist_sources' Makefile.in && Exit 1 + grep '^dist:' Makefile.in && exit 1 -grep '^DIST_SOURCES =' Makefile.in && exit 1 ++grep 'am__dist_sources' Makefile.in && exit 1 : diff --cc t/nostdinc.sh index 62e752e6a,812c6be22..2ec2b82da --- a/t/nostdinc.sh +++ b/t/nostdinc.sh @@@ -16,8 -16,12 +16,8 @@@ # Test to make sure nostdinc option works correctly. -# We don't require a C compiler explicitly, because the first part of the -# test (where 'Makefile.in' is grepped) does not require one. Insted, we -# just skip the rest of the test if configure fails to find a working C -# compiler. - +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC @@@ -50,20 -45,12 +50,20 @@@ $AUTOMAKE --add-missin # Test with $builddir != $srcdir mkdir build cd build -../configure || exit $? -$EGREP '.*-I *(\.|\$.srcdir.)' Makefile && exit 1 +../configure - $MAKE V=1 > output || { cat output; Exit 1; } ++$MAKE V=1 > output || { cat output; exit 1; } +cat output - grep '.*-I *\.' stdout && Exit 1 ++grep '.*-I *\.' stdout && exit 1 +$MAKE clean +# Shouldn't be picked up from builddir either. +cp ../stdlib.h . +$MAKE +cd .. # Test with $builddir = $srcdir -cd .. -./configure || exit $? -$EGREP '.*-I *(\.|\$.srcdir.)' Makefile && exit 1 +./configure - $MAKE V=1 > output || { cat output; Exit 1; } ++$MAKE V=1 > output || { cat output; exit 1; } +cat output - grep '.*-I *\.' output && Exit 1 ++grep '.*-I *\.' output && exit 1 -exit 0 +: diff --cc t/objdir.sh index 0f1f84466,d14f8c8f3..5d2a599b8 --- a/t/objdir.sh +++ b/t/objdir.sh @@@ -14,20 -14,14 +14,20 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Naming a subdirectory 'obj/' is a bad idea. Automake should say so. +# A directory named 'obj' could create problems with BSD make, but +# shouldn't with GNU make; so check that +# - the old portability warning diagnosing it is gone, and +# - such a directory truly causes no problems with GNU make. +am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 -mkdir obj - -cat >>configure.ac << 'END' -AC_CONFIG_FILES([obj/Makefile]) +cat > configure.ac <. -# Test to make sure '.txi' extension works. +# Automake-NG should recognize the (no-op) 'ng' option. - . ./defs || Exit 1 + . ./defs || exit 1 -cat > Makefile.am << 'END' -info_TEXINFOS = foo.txi +cat > configure.ac < foo.txi -: > texinfo.tex +echo AUTOMAKE_OPTIONS = ng > Makefile.am $ACLOCAL $AUTOMAKE diff --cc t/parallel-tests-concatenated-suffix.sh index 11e3f0222,000000000..0c87cfa10 mode 100755,000000..100755 --- a/t/parallel-tests-concatenated-suffix.sh +++ b/t/parallel-tests-concatenated-suffix.sh @@@ -1,75 -1,0 +1,75 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# The parallel-tests driver should be able to cope with test scripts +# whose names end with several concatenated suffixes. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_OUTPUT +END + +tests='foo.sh foo.t.sh foo.sh.t foo.x.x foo.x.t.sh foo.t.x.sh foo.sh.t.x' + +for t in $tests; do + (echo '#!/bin/sh' && echo 'echo == /$0 ==') > $t + chmod a+x $t +done + +cat > Makefile.am <stdout - $MAKE $j check >>stdout || { cat stdout; Exit 1; } ++ $MAKE $j check >>stdout || { cat stdout; exit 1; } + cat stdout + count_test_results total=7 pass=7 fail=0 skip=0 xfail=0 xpass=0 error=0 + for t in $tests; do grep "^PASS: $t *$" stdout; done + + grep '== .*/foo\.sh ==' foo.log + grep '== .*/foo\.t\.sh ==' foo.t.log + grep '== .*/foo\.sh\.t ==' foo.sh.log + grep '== .*/foo\.x\.x ==' foo.x.log + grep '== .*/foo\.x\.t\.sh ==' foo.x.t.log + grep '== .*/foo\.t\.x\.sh ==' foo.t.x.log + grep '== .*/foo\.sh\.t\.x ==' foo.sh.t.log + + $MAKE $j clean + test ! -f foo.log + test ! -f foo.t.log + test ! -f foo.sh.log + test ! -f foo.x.log + test ! -f foo.x.t.log + test ! -f foo.t.x.log + test ! -f foo.sh.t.log + +done + +: diff --cc t/parallel-tests-dynamic.sh index 625b5f6f1,000000000..da61450c4 mode 100755,000000..100755 --- a/t/parallel-tests-dynamic.sh +++ b/t/parallel-tests-dynamic.sh @@@ -1,160 -1,0 +1,160 @@@ +#! /bin/sh +# Copyright (C) 2012 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 that dynamic content for $(TESTS) is supported, both when set from +# inside the Makefile.am and when overridden from the command line. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > ok <<'END' +#!/bin/sh +exit 0 +END + +cat > ko <<'END' +#!/bin/sh +exit 1 +END + +cat > sk <<'END' +#!/bin/sh +exit 77 +END + +cat > er << 'END' +#!/bin/sh +echo $0 should not be run >&2 +exit 99 +END + +chmod a+x ko ok sk + +mkdir t +cp ok t/nosuffix + +cp ok g1.sh +cp ok g2.sh +cp ok g3.sh +cp ok g4.sh +cp er g5.sh + +cp ok t00-foo.sh +cp ok t02.sh +cp ok t57_mu.sh +cp ok t7311.sh +cp ko t98S.sh +cp ko t99.sh +cp er t1.sh +cp er t9.sh +cp er tx98.sh + +cp sk fu.sh +cp sk mu + +cat > get-tests-list < Makefile.am << 'END' +my_add_dirprefix = $(strip $(1))/$(strip $(2)) +EXTRA_DIST = $(TESTS) get-tests-list +TEST_EXTENSIONS = .sh + +t1 = fu +t2 = mux + +# Also try an empty match suffix, to ensure that the ':=' in there is +# not confused by the parser with an immediate assignment operator. +TESTS = $(t1:=.sh) $(t2:x=) +TESTS += $(wildcard $(srcdir)/t[0-9][0-9]*.sh) +TESTS += $(shell $(srcdir)/get-tests-list) +TESTS += $(call my_add_dirprefix, t, nosuffix) +XFAIL_TESTS = $(wildcard $(srcdir)/t9[0-9]*.sh) +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + - $MAKE check > stdout || { cat stdout; Exit 1; } ++$MAKE check > stdout || { cat stdout; exit 1; } +cat stdout + +count_test_results total=13 pass=9 fail=0 xpass=0 xfail=2 skip=2 error=0 + +grep '^PASS: t/nosuffix$' stdout +grep '^PASS: g1\.sh$' stdout +grep '^PASS: g2\.sh$' stdout +grep '^PASS: g3\.sh$' stdout +grep '^PASS: g4\.sh$' stdout +grep '^PASS: t00-foo\.sh$' stdout +grep '^PASS: t02\.sh$' stdout +grep '^PASS: t57_mu\.sh$' stdout +grep '^PASS: t7311\.sh$' stdout +grep '^XFAIL: t98S\.sh$' stdout +grep '^XFAIL: t99\.sh$' stdout +grep '^SKIP: fu\.sh$' stdout +grep '^SKIP: mu$' stdout + +$MAKE mostlyclean +test "`find . -name *.log`" = ./config.log + - $MAKE distcheck > stdout || { cat stdout; Exit 1; } ++$MAKE distcheck > stdout || { cat stdout; exit 1; } +cat stdout +count_test_results total=13 pass=9 fail=0 xpass=0 xfail=2 skip=2 error=0 + +$MAKE check tests1='$(wildcard t00*.sh t98?.sh)' \ + tests2='$(shell ./get-tests-list | sed 1d)' \ + TESTS='$(tests1) $(tests2)' \ - > stdout || { cat stdout; Exit 1; } ++ > stdout || { cat stdout; exit 1; } +cat stdout + +count_test_results total=4 pass=3 fail=0 xpass=0 xfail=1 skip=0 error=0 + +grep '^PASS: g3\.sh$' stdout +grep '^PASS: g4\.sh$' stdout +grep '^PASS: t00-foo\.sh' stdout +grep '^XFAIL: t98S\.sh' stdout + +$MAKE mostlyclean +test "`find . -name *.log`" = ./config.log + +$MAKE check TESTS='$(shell echo t00 | sed "s/$$/-foo/") t99' +test -f t00-foo.log +test -f t99.log + +$MAKE check \ + foo='E9E9E' \ + a='t00.err' \ + b='${a:.err=-foo}' \ + TESTS='$(b) t$(subst E,,$(foo)) $(call my_add_dirprefix,t,nosuffix)' \ - > stdout || { cat stdout; Exit 1; } ++ > stdout || { cat stdout; exit 1; } +cat stdout + +count_test_results total=3 pass=2 fail=0 xpass=0 xfail=1 skip=0 error=0 +grep '^PASS: t/nosuffix' stdout +grep '^PASS: t00-foo\.sh' stdout +grep '^XFAIL: t99\.sh' stdout + +: diff --cc t/parallel-tests-empty-tests.sh index 9edd26021,0ed2ff255..aefe6b592 --- a/t/parallel-tests-empty-tests.sh +++ b/t/parallel-tests-empty-tests.sh @@@ -14,9 -14,11 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check parallel-tests features: -# - empty TESTS -# - empty TEST_LOGS +# Check parallel-tests features: empty TESTS - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_FILES([sub1/Makefile sub2/Makefile]) diff --cc t/parallel-tests-exit-statuses.sh index ab910950c,bd5bb7685..dd899ea1e --- a/t/parallel-tests-exit-statuses.sh +++ b/t/parallel-tests-exit-statuses.sh @@@ -83,21 -82,19 +83,21 @@@ LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | diff exp-fail got-fail st=1 -XFAIL_TESTS="$failure_statuses 99" $MAKE -e check >stdout && st=0 +$MAKE check XFAIL_TESTS="$failure_statuses 99" >stdout && st=0 cat stdout cat test-suite.log - test $st -gt 0 || Exit 1 + test $st -gt 0 || exit 1 LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-1 diff exp-xfail-1 got-xfail-1 st=0 -XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses" \ - $MAKE -e check >stdout || st=$? +$MAKE check \ + XFAIL_TESTS="$failure_statuses" \ + TESTS="0 77 $failure_statuses" \ + > stdout || st=$? cat stdout cat test-suite.log - test $st -eq 0 || Exit 1 + test $st -eq 0 || exit 1 LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-2 diff exp-xfail-2 got-xfail-2 diff --cc t/parallel-tests-extra-programs.sh index 2fd09cfc5,52eb2b03f..7f2a0ea33 --- a/t/parallel-tests-extra-programs.sh +++ b/t/parallel-tests-extra-programs.sh @@@ -151,10 -159,10 +151,10 @@@ $slee echo 'int main (void) { return 0; }' > none.c st=0 -RECHECK_LOGS= $MAKE -e check >stdout || st=$? +$MAKE check AM_LAZY_CHECK=yes >stdout || st=$? cat stdout ls -l - test $st -eq 0 || Exit 1 + test $st -eq 0 || exit 1 # For debugging. stat stamp foo.log bar.log baz.log || : diff --cc t/parallel-tests-fork-bomb.sh index 7542fb5c0,2e6bfac19..8cb248ec9 --- a/t/parallel-tests-fork-bomb.sh +++ b/t/parallel-tests-fork-bomb.sh @@@ -62,12 -100,36 +62,12 @@@ do_check ( { st=0 log=$1; shift - env "$@" $MAKE -e check >output 2>&1 || st=$? + $MAKE "$@" check >output 2>&1 || st=$? cat output - $FGREP '::OOPS::' output && Exit 1 # Possible infinite recursion. + $FGREP '::OOPS::' output && exit 1 # Possible infinite recursion. - # Check that at least we don't create a botched global log file. - test ! -f "$log" - if using_gmake; then - grep "[Cc]ircular.*dependency" output | $FGREP "$log" - test $st -gt 0 - else - # Look for possible error messages about circular dependencies from - # either make or our own recipes. At least one such a message must - # be present. OTOH, some make implementations (e.g., NetBSD's), while - # smartly detecting the circular dependency early and diagnosing it, - # still exit with a successful exit status (yikes!). So don't check - # the exit status of non-GNU make, to avoid spurious failures. - # this case. - err_seen=no - for err_rx in \ - 'circular.* depend' \ - 'depend.* circular' \ - 'graph cycle' \ - 'infinite (loop|recursion)' \ - 'depend.* on itself' \ - ; do - $EGREP -i "$err_rx" output | $FGREP "$log" || continue - err_seen=yes - break - done - test $err_seen = yes || exit 1 - fi + grep "[Cc]ircular.*dependency" output | $FGREP "$log" + grep "$log:.*depends on itself" output + test $st -gt 0 } : > test-suite.test diff --cc t/parallel-tests-harderror.sh index b51b27182,8e1e014d7..4ac1f6188 --- a/t/parallel-tests-harderror.sh +++ b/t/parallel-tests-harderror.sh @@@ -67,7 -69,8 +67,7 @@@ cat test-suite.lo grep '^ERROR: foo$' test-suite.log cd sub - $MAKE DISABLE_HARD_ERRORS='' check && Exit 1 -# The '-e' is wanted here. -DISABLE_HARD_ERRORS='' $MAKE -e check && exit 1 ++$MAKE DISABLE_HARD_ERRORS='' check && exit 1 cat test-suite.log grep '^ERROR: bar$' test-suite.log cd .. diff --cc t/parallel-tests-internals.sh index 8614c5c9e,4211131c7..f15852f66 --- a/t/parallel-tests-internals.sh +++ b/t/parallel-tests-internals.sh @@@ -14,9 -14,10 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test that := definitions work as expected at make time. +# Some internals of the parallel testsuite harness implementation. - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT diff --cc t/parallel-tests-log-compiler-1.sh index 0d109bb5b,9c4ffce00..a3b3a94fb --- a/t/parallel-tests-log-compiler-1.sh +++ b/t/parallel-tests-log-compiler-1.sh @@@ -111,7 -111,7 +111,7 @@@ test -f bla.lo test -f bli.suff.log test -f sub/test.log - $MAKE check T_LOG_FLAGS=--bad && Exit 1 -T_LOG_FLAGS=--bad $MAKE -e check && exit 1 ++$MAKE check T_LOG_FLAGS=--bad && exit 1 cat test-suite.log cat bla.log # With the above flag overridden, bla.t should fail ... diff --cc t/parallel-tests-log-override.sh index a02ec5402,1fa5d9a05..7aa3020a1 --- a/t/parallel-tests-log-override.sh +++ b/t/parallel-tests-log-override.sh @@@ -73,10 -73,10 +73,10 @@@ cat test-suite.lo cp test-suite.log orig $MAKE clean - test -f test-suite.log && Exit 99 # Sanity check. + test -f test-suite.log && exit 99 # Sanity check. # Check that we can override the testsuite log file at runtime. -TEST_SUITE_LOG=zardoz.log $MAKE -e check +$MAKE check TEST_SUITE_LOG=zardoz.log ls -l test ! -f test-suite.log cat zardoz.log diff --cc t/parallel-tests-logvars-example.sh index 301eb57d0,0d66b646c..50bdba2f1 --- a/t/parallel-tests-logvars-example.sh +++ b/t/parallel-tests-logvars-example.sh @@@ -15,10 -15,10 +15,10 @@@ # along with this program. If not, see . # Test the example of usage of generic and extension-specific -# LOG_COMPILER and LOG_FLAGS given in the manual. +# LOG_COMPILER, LOG_FLAGS and LOG_DEPENDNECIES given in the manual. required=python - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <. + +# The parallel-tests driver must prefer tests with an extension to +# extension-less tests. This is required to allow the user to have +# a, say, 'all.test' test case even in the face of the 'all' target. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > foo <<'END' +#!/bin/sh +echo "foo without suffix run" >&2 +exit 99 +END + +cat > foo.test <<'END' +#!/bin/sh +echo "$0 has been run" +END +chmod a+x foo.test + +cp foo.test all.test +cp foo.test dist.test +cp foo.test install.test +cp foo.test bad-target.test + +cat > Makefile.am << 'END' +bad-target: + @echo $@ has been run >&2; exit 1 +install-data-local: + @echo $@ has been run >&2; exit 1 +TESTS = foo.test all.test install.test dist.test bad-target.test +EXTRA_DIST = oops-this-does-not-exist +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure --prefix="`pwd`/inst" + +$MAKE check +ls -l # For debugging. +test ! -d inst +for t in foo all install dist bad-target; do + grep "$t\.test has been run" $t.log +done + +: diff --cc t/parallel-tests-no-color-in-log.sh index 2f19fbc64,c46993fef..acfc16f9a --- a/t/parallel-tests-no-color-in-log.sh +++ b/t/parallel-tests-no-color-in-log.sh @@@ -46,9 -45,9 +45,9 @@@ $AUTOMAKE --add-missin ./configure mv config.log config-log # Avoid possible false positives below. - $MAKE check AM_COLOR_TESTS=always && Exit 1 -AM_COLOR_TESTS=always $MAKE -e check && exit 1 ++$MAKE check AM_COLOR_TESTS=always && exit 1 # Not a useless use of cat; see above comments "grep-nonprinting" # requirement in 'test-init.sh'. - cat *.log | grep "$esc" && Exit 1 + cat *.log | grep "$esc" && exit 1 : diff --cc t/parallel-tests-no-repeat.sh index 2c696506a,70809a6a6..dae8b6013 --- a/t/parallel-tests-no-repeat.sh +++ b/t/parallel-tests-no-repeat.sh @@@ -14,30 -14,33 +14,30 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure that mdate-sh is added to the right directory. -# Report from Kevin Dalley. +# The parallel-tests harness do not cause the same test to be +# uselessly run multiple times. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' -AC_CONFIG_FILES([sub/Makefile]) -END - -cat > Makefile.am << 'END' -SUBDIRS = sub -END +echo AC_OUTPUT >> configure.ac +echo TESTS = foo.test > Makefile.am -mkdir sub - -cat > sub/Makefile.am << 'END' -info_TEXINFOS = textutils.texi -END - -cat > sub/textutils.texi << 'END' -@include version.texi -@setfilename textutils.info +cat > foo.test <<'END' +#! /bin/sh +ls -l && mkdir bar END +chmod a+x foo.test $ACLOCAL +$AUTOCONF $AUTOMAKE -a -ls -l sub -test -f sub/mdate-sh + +./configure + - $MAKE -j1 check || { cat test-suite.log; Exit 1; } ++$MAKE -j1 check || { cat test-suite.log; exit 1; } +rmdir bar - $MAKE -j2 check || { cat test-suite.log; Exit 1; } ++$MAKE -j2 check || { cat test-suite.log; exit 1; } +rmdir bar - $MAKE -j4 check || { cat test-suite.log; Exit 1; } ++$MAKE -j4 check || { cat test-suite.log; exit 1; } : diff --cc t/parallel-tests-per-suffix-deps.sh index d60a609e2,000000000..7bf001735 mode 100755,000000..100755 --- a/t/parallel-tests-per-suffix-deps.sh +++ b/t/parallel-tests-per-suffix-deps.sh @@@ -1,162 -1,0 +1,162 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# The user should be able to easily specify extra dependencies for +# the test cases, depending on their extension (or lack thereof). +# We do so with the help of "${prefix}LOG_DEPENDENCIES" variables. +# See the last wishlist in automake bug#11287. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AC_SUBST([EXEEXT], [.bin]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +TEST_EXTENSIONS = .test .sh +TESTS = foo.test foo2.test bar.sh baz zard.oz quux.bin mu.test.bin + +TEST_LOG_DEPENDENCIES = test-dep +SH_LOG_DEPENDENCIES = sh-dep1 sh-dep2 +LOG_DEPENDENCIES = dep + +DEPS = test-dep sh-dep1 sh-dep2 dep new-test-dep +$(DEPS): + echo dummy > $@ +CLEANFILES = $(DEPS) + +.PHONY: setup +setup: + chmod a+x $(TESTS) +EXTRA_DIST = $(TESTS) +END + +cat > foo.test <<'END' +#! /bin/sh +test -f test-dep || test -f new-test-dep +END + +cat > foo2.test <<'END' +#! /bin/sh +test -f test-dep +END + +cp foo2.test mu.test.bin + +cat > bar.sh <<'END' +#! /bin/sh +test -f sh-dep1 && test -f sh-dep2 +END + +cat > baz <<'END' +#! /bin/sh +test -f dep +END + +cp baz quux.bin + +cat > zard.oz <<'END' +#! /bin/sh +test -f dep +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +$MAKE setup + +cleanup () { rm -f test-dep sh-dep1 sh-dep2 dep; } + +$MAKE check -j4 +test ! -f new-test-dep +test -f test-dep +test -f sh-dep1 +test -f sh-dep2 +test -f dep +test -f quux.log # Sanity check. +test -f mu.log # Likewise. + +cleanup + +$MAKE check TESTS=foo.test +test -f test-dep +test ! -f sh-dep1 +test ! -f sh-dep2 +test ! -f dep + +cleanup +rm -f bar.log +$MAKE check TESTS=bar.sh AM_LAZY_CHECK=yes +test ! -f test-dep +test -f sh-dep1 +test -f sh-dep2 +test ! -f dep + +cleanup +$MAKE check TESTS=baz +test ! -f test-dep +test ! -f sh-dep1 +test ! -f sh-dep2 +test -f dep + +cleanup +$MAKE check TESTS='foo bar' +test -f test-dep +test -f sh-dep1 +test -f sh-dep2 +test ! -f dep + +cleanup +$MAKE check TESTS=zard.oz +test ! -f test-dep +test ! -f sh-dep1 +test ! -f sh-dep2 +test -f dep + +cleanup +$MAKE check TESTS=mu.test.bin +test -f test-dep +test ! -f sh-dep1 +test ! -f sh-dep2 +test ! -f dep + +cleanup +$MAKE check TESTS='quux.bin bar.sh' +test ! -f test-dep +test -f sh-dep1 +test -f sh-dep2 +test -f dep + +cleanup +$MAKE check TESTS=foo TEST_LOG_DEPENDENCIES=new-test-dep +test -f new-test-dep +test ! -f test-dep +test ! -f sh-dep1 +test ! -f sh-dep2 +test ! -f dep + +cleanup +$MAKE check TESTS=baz XFAIL_TESTS=baz LOG_DEPENDENCIES= +test ! -f dep +grep ':test-result: XFAIL' baz.trs + +$MAKE distcheck + +: diff --cc t/parallel-tests-srcdir-in-test-name.sh index f137e9385,008852924..72dc491b5 --- a/t/parallel-tests-srcdir-in-test-name.sh +++ b/t/parallel-tests-srcdir-in-test-name.sh @@@ -14,43 -14,34 +14,43 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check that ':test-results:' directives in test scripts' output doesn't -# originate spurious results in the testsuite summary. +# Check parallel-tests features: listing $(srcdir)/ in TESTS works. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' -AC_OUTPUT -END +echo AC_OUTPUT >> configure.ac cat > Makefile.am << 'END' -TESTS = foo.test bar.test +TESTS = \ + $(srcdir)/foo \ + @srcdir@/foo2 \ + @srcdir@/bar.test \ + ${srcdir}/sub/baz.test \ + built.test + +XFAIL_TESTS = $(srcdir)/bar.test foo2 + +built.test: + (echo '#!/bin/sh' && echo 'exit 77') >$@-t + chmod a-w,a+x $@-t && mv -f $@-t $@ END -cat > foo.test <<'END' -#! /bin/sh -echo :test-result:XFAIL -echo :test-result: SKIP -echo :test-result:ERROR +cat > foo <<'END' +#!/bin/sh exit 0 END -cat > bar.test <<'END' -#! /bin/sh -echo :test-result: ERROR -echo :test-result:FAIL -echo :test-result: XPASS -exit 0 +chmod a+x foo + +cat > foo2 <<'END' +#!/bin/sh +exit 1 END -chmod a+x foo.test bar.test +chmod a+x foo2 + +cp foo2 bar.test + +mkdir sub +cp foo sub/baz.test $ACLOCAL $AUTOCONF diff --cc t/parallel-tests-unreadable.sh index fa2448a10,895d4769e..39e351926 --- a/t/parallel-tests-unreadable.sh +++ b/t/parallel-tests-unreadable.sh @@@ -49,57 -51,25 +49,57 @@@ $AUTOMAKE - ./configure -for files in \ - 'foo.log bar.log' \ - 'foo.trs bar.trs' \ - 'foo.trs bar.log' \ - 'foo.log bar.trs' \ -; do +doit () +{ + rm -f $* $MAKE check rm -f test-suite.log - chmod a-r $files - $MAKE test-suite.log || { ls -l; exit 1; } - ls -l - grep '^foofoofoo$' foo.log - grep '^:test-result: PASS' foo.trs - grep '^barbarbar$' bar.log - grep '^:test-result: SKIP' bar.trs - grep '^SKIP: bar' test-suite.log - grep '^barbarbar$' test-suite.log - $EGREP ':.*foo|foofoofoo' test-suite.log && exit 1 - : For shells with busted 'set -e'. + chmod a-r $* - $MAKE test-suite.log 2>stderr && { cat stderr >&2; Exit 1; } ++ $MAKE test-suite.log 2>stderr && { cat stderr >&2; exit 1; } + cat stderr >&2 +} + +could_not_read () +{ + # We have to settle for weak checks to avoid spurious failures due to + # the differences in error massages on different systems; for example: + # + # $ cat unreadable-file # GNU/Linux or NetBSD + # cat: unreadable-file: Permission denied + # $ cat unreadable-file # Solaris 10 + # cat: cannot open unreadable + # + # $ grep foo unreadable-file # GNU/Linux and NetBSD + # grep: unreadable: Permission denied + # $ grep foo unreadable-file # Solaris 10 + # grep: can't open "unreadable" + # + # Plus, we must cater to error messages displayed by our own awk + # script: "cannot read "unreadable"". + # + # FIXME: this might still needs adjustments on other systems ... + # + grep "$1:.*[pP]ermission denied" stderr \ + || $EGREP "can(no|')t (open|read) [\"'\`]?$1" stderr +} + +for lst in bar.log 'foo.log bar.log'; do + doit $lst + could_not_read bar.log + grep 'test-suite\.log:.* I/O error reading test results' stderr done +doit foo.trs +could_not_read foo.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + +doit foo.trs bar.trs +could_not_read foo.trs +could_not_read bar.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + +doit foo.trs bar.log +could_not_read foo.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + : diff --cc t/parallel-tests.sh index 4adf83228,f6ebb85a2..dede27854 --- a/t/parallel-tests.sh +++ b/t/parallel-tests.sh @@@ -19,10 -19,11 +19,10 @@@ # - log files, and what goes in 'test-suite.log' # - make clean # - dependencies between tests -# - TESTS redefinition at runtime -# - TEST_LOGS redefinition at runtime -# - RECHECK_LOGS redefinition at runtime +# - TESTS redefinition at runtime (with and without test suffixes) +# - AM_LAZY_CHECK - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT @@@ -78,10 -84,10 +78,10 @@@ test ! -f test-suite.lo # Check dependencies: baz.test needs to run before bar.test, # but foo.test is not needed. -# Note that this usage has a problem: the summary will only -# take bar.log into account, because the $(TEST_SUITE_LOG) rule -# does not "see" baz.log. Hmm. -env TESTS='bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; } +# FIXME: Note that this usage has a problem: the summary will only +# FIXME: take bar.log into account, because the $(TEST_SUITE_LOG) +# FIXME: rule does not "see" baz.log. Hmm. - $MAKE check TESTS=bar.test >stdout && { cat stdout; Exit 1; } ++$MAKE check TESTS=bar.test >stdout && { cat stdout; exit 1; } cat stdout grep '^FAIL: baz\.test$' stdout grep '^ERROR: bar\.test$' stdout @@@ -97,7 -103,7 +97,7 @@@ test -f test-suite.lo # Note that the previous test and this one taken together expose the timing # issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG # before running the tests lazily. - $MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; exit 1; } cat stdout test -f foo.log grep '^PASS: foo\.test$' stdout @@@ -109,27 -115,37 +109,27 @@@ grep '^# ERROR: *1$' stdou # Now, explicitly retry with all test logs already updated, and ensure # that the summary is still displayed. - $MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; exit 1; } cat stdout - grep foo.test stdout && Exit 1 - grep bar.test stdout && Exit 1 - grep baz.test stdout && Exit 1 + grep foo.test stdout && exit 1 + grep bar.test stdout && exit 1 + grep baz.test stdout && exit 1 grep '^# PASS: *1$' stdout grep '^# FAIL: *1$' stdout grep '^# ERROR: *1$' stdout -# Lazily rerunning only foo should only rerun this one test. -env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; } -cat stdout -grep foo.test stdout -grep bar.test stdout && exit 1 -grep baz.test stdout && exit 1 -grep '^# PASS: *1$' stdout -grep '^# FAIL: *1$' stdout -grep '^# ERROR: *1$' stdout - $MAKE clean - $MAKE check TESTS=baz > stdout && { cat stdout; Exit 1; } -env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE check TESTS=baz > stdout && { cat stdout; exit 1; } cat stdout - grep foo.test stdout && Exit 1 - grep bar.test stdout && Exit 1 + grep foo.test stdout && exit 1 + grep bar.test stdout && exit 1 grep baz.test stdout $MAKE clean - $MAKE check TESTS=baz.test > stdout && { cat stdout; Exit 1; } -env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE check TESTS=baz.test > stdout && { cat stdout; exit 1; } cat stdout - grep foo.test stdout && Exit 1 - grep bar.test stdout && Exit 1 + grep foo.test stdout && exit 1 + grep bar.test stdout && exit 1 grep baz.test stdout : diff --cc t/parallel-tests5.sh index 4c01560be,1a88ddfcd..f7aac36a5 --- a/t/parallel-tests5.sh +++ b/t/parallel-tests5.sh @@@ -20,8 -20,8 +20,8 @@@ # Actually, this test doesn't ensure that things happen concurrently. # It merely serves as demonstration. :-) -required='cc native GNUmake' +required='cc native' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/parallel-tests6.sh index 94b464d5d,4f46cebe6..018964ae0 --- a/t/parallel-tests6.sh +++ b/t/parallel-tests6.sh @@@ -16,17 -16,17 +16,13 @@@ # Check parallel-tests features: # - empty TESTS -# BSD make will expand '$(TESTS:=.log)' to '.log' unless overridden. # See parallel-tests10.test for a similar issue. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' -AC_OUTPUT -END - cat >> configure.ac << 'END' - AC_OUTPUT -cat > Makefile.am << 'END' -TESTS = --END ++echo AC_OUTPUT >> configure.ac + - cat > Makefile.am << 'END' - TESTS = - END ++echo TESTS = > Makefile.am $ACLOCAL $AUTOCONF @@@ -39,4 -39,4 +35,4 @@@ for x in TOTAL PASS FAIL XPASS FAIL SKI grep "^# $x: *0$" stdout done - Exit 0 -exit 0 ++: diff --cc t/parallel-tests8.sh index 4f322319a,3e047598a..6d6bdce5c --- a/t/parallel-tests8.sh +++ b/t/parallel-tests8.sh @@@ -14,9 -14,17 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check parallel-tests features: -# - generated distributed tests. -# - listing $(srcdir)/ or $(top_srcdir)/ in TESTS doesn't work ATM, -# and is thus diagnosed. - -# TODO: this test should also ensure that the 'make' implementation -# properly adheres to rules in all cases. See the Autoconf -# manual for the ugliness in this area, when VPATH comes into -# play. :-/ +# Check parallel-tests features: generated distributed tests. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT diff --cc t/pattern-rules.sh index c33319488,f099f0224..50558aa37 --- a/t/pattern-rules.sh +++ b/t/pattern-rules.sh @@@ -14,46 -14,24 +14,46 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check a documented limitation of the Automake's Makefile parser -# w.r.t. POSIX variable substitutions used in the name of targets. -# See Section "General Operation" in the Automake manual. -# If you cause some parts of this test to fail, chances are that you've -# improved the Automake parser ;-) -# See: -# or: +# Automake do not complain about nor messes up pattern rules. - . ./defs || Exit 1 + . ./defs || exit 1 +echo AC_OUTPUT >> configure.ac + cat > Makefile.am <<'END' -$(FOO:=x): bar +foo/%.out: bar/%.in + test -d $(dir $@) || $(MKDIR_P) $(dir $@) + cp $< $@ +%.sh: %/z + cp $< $@ +%: + echo True > $@ +noinst_DATA = foo/one.out +noinst_SCRIPTS = two.sh mu.py END +mkdir bar two +echo "123456789" > bar/one.in +echo "#!/bin/sh" > two/z + $ACLOCAL -AUTOMAKE_fails +$AUTOCONF +$AUTOMAKE -grep 'bad characters.*variable name.*\$(FOO' stderr -grep ':=.*assignments.*not portable' stderr +for vpath in : false; do + if $vpath; then + mkdir build + cd build + srcdir=.. + else + srcdir=. + fi + $srcdir/configure + $MAKE + diff $srcdir/bar/one.in ./foo/one.out + diff $srcdir/two/z ./two.sh + test `cat mu.py` = True + cd $srcdir +done : diff --cc t/per-target-flags.sh index fa2dda30f,000000000..f8b863692 mode 100755,000000..100755 --- a/t/per-target-flags.sh +++ b/t/per-target-flags.sh @@@ -1,96 -1,0 +1,96 @@@ +#! /bin/sh +# Copyright (C) 1999-2012 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 executable-specific and library-specific flags, both with +# and without dependency tracking. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat > configure.ac << END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([-Wno-extra-portability]) +AC_CONFIG_FILES([Makefile libMakefile Makefile2 libMakefile2]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_RANLIB +AC_OUTPUT +END + +$ACLOCAL + +makefiles='Makefile libMakefile Makefile2 libMakefile2' + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.c +foo_CFLAGS = -DBAR +END + +cat > libMakefile.am << 'END' +lib_LIBRARIES = libfoo.a +libfoo_a_SOURCES = foo.c bar.cc +libfoo_a_CFLAGS = -DBAR +libfoo_a_CXXFLAGS = -DZOT +END + +cat - Makefile.am > Makefile2.am << 'END' +AUTOMAKE_OPTIONS = no-dependencies +END + +cat - libMakefile.am > libMakefile2.am << 'END' +AUTOMAKE_OPTIONS = no-dependencies +END + +# Make sure 'compile' is required. +for m in $makefiles; do + AUTOMAKE_fails $m + $EGREP " required file.* '(compile|\./compile)'" stderr +done + +: > compile +$AUTOMAKE + +# Regression test for missing space. - $FGREP ')-c' $makefiles && Exit 1 ++$FGREP ')-c' $makefiles && exit 1 + +# Regression test for botchedly transformed object names. - $FGREP '.o.o' $makefiles && Exit 1 - $FGREP '.obj.obj' $makefiles && Exit 1 - $FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && Exit 1 ++$FGREP '.o.o' $makefiles && exit 1 ++$FGREP '.obj.obj' $makefiles && exit 1 ++$FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && exit 1 + +# Watch against non-transformed "foo.$(OBJEXT)", "foo.o" and "foo.obj" +# (and similarly for bar). - $EGREP '[^-](foo|bar)\.[o$]' $makefiles && Exit 1 ++$EGREP '[^-](foo|bar)\.[o$]' $makefiles && exit 1 + +# All our programs and libraries have per-target flags, so all +# the compilers invocations must use an explicit '-c' option. - grep 'COMPILE. [^-]' $makefiles && Exit 1 - grep 'COMPILE. .[^c]' $makefiles && Exit 1 ++grep 'COMPILE. [^-]' $makefiles && exit 1 ++grep 'COMPILE. .[^c]' $makefiles && exit 1 + +$FGREP 'foo-foo.$(OBJEXT)' Makefile.in +$FGREP 'foo-foo.$(OBJEXT)' Makefile2.in +$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile.in +$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile2.in +$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile.in +$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile2.in + +$FGREP '$(foo_CFLAGS)' Makefile.in +$FGREP '$(foo_CFLAGS)' Makefile2.in +$FGREP '$(libfoo_a_CFLAGS)' libMakefile.in +$FGREP '$(libfoo_a_CFLAGS)' libMakefile2.in + +: diff --cc t/pr9.sh index 2556b8b80,ccb0b93cc..15e8b4b97 --- a/t/pr9.sh +++ b/t/pr9.sh @@@ -20,10 -20,10 +20,10 @@@ # == Report == # When AC_CONFIG_AUX_DIR is set (in my case to 'support'), make dist # no longer automatically includes config.guess, config.sub, install-sh, -# ltconfig, ltmain.sh, mdate-sh, missing, and mkinstalldirs. In fact, -# the entire 'support/' directory is omitted. +# ltconfig, ltmain.sh, mdate-sh, and missing. In fact, the entire +# 'support/' directory is omitted. - . ./defs || Exit 1 + . ./defs || exit 1 cat > configure.ac << END AC_INIT([$me], [1.0]) diff --cc t/remake-all-1.sh index 92beb097a,9596ba801..b57157ab6 --- a/t/remake-all-1.sh +++ b/t/remake-all-1.sh @@@ -15,8 -15,9 +15,8 @@@ # along with this program. If not, see . # Check that the "all" target triggers rebuilt of outdated Makefiles. -# See also sister test 'remake-all-2.test'. - . ./defs || Exit 1 + . ./defs || exit 1 mkfile=Makefile @@@ -37,12 -38,14 +37,12 @@@ echo SUBDIRS = sub > $mkfile.a : > sub/$mkfile.am $ACLOCAL +$AUTOCONF $AUTOMAKE -$EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in - -$AUTOCONF ./configure - $FGREP "$magic1" mkfile.in && Exit 1 # Sanity check. + $FGREP "$magic1" mkfile.in && exit 1 # Sanity check. # Two code paths in configure.am: diff --cc t/remake-subdir-gnu.sh index 52afc445f,24d5c4c0a..a2ead759c --- a/t/remake-subdir-gnu.sh +++ b/t/remake-subdir-gnu.sh @@@ -20,7 -20,8 +20,7 @@@ # See also the other similar tests 'remake-subdir*.test', and the # related test 'aclocal5.test' - . ./defs || Exit 1 -required=GNUmake + . ./defs || exit 1 magic1='::MagicString::One::' magic2='__MagicString__Two__' diff --cc t/remake-subdir.sh index a297b44a6,5026d1684..412630bc0 --- a/t/remake-subdir.sh +++ b/t/remake-subdir.sh @@@ -19,8 -19,14 +19,8 @@@ # See also the other similar tests 'remake-subdir*.test', and the # related test 'aclocal5.test'. - . ./defs || Exit 1 + . ./defs || exit 1 -if using_gmake; then - remake=$MAKE -else - remake="$MAKE Makefile" -fi - magic1='::MagicString::One::' magic2='__MagicString__Two__' diff --cc t/remake10a.sh index 67da954a1,830d6ca2b..232c1d5d0 --- a/t/remake10a.sh +++ b/t/remake10a.sh @@@ -92,10 -96,11 +92,10 @@@ for vpath in : false; d $sleep echo "m4_define([my_fingerprint], [DummyValue])" > $top_srcdir/foo.m4 - using_gmake || $remake $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. - $FGREP $magic3 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. + $FGREP $magic3 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake10b.sh index c3f573db7,7aeab7916..fe491993e --- a/t/remake10b.sh +++ b/t/remake10b.sh @@@ -91,10 -95,11 +91,10 @@@ for vpath in : false; d $sleep echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am - using_gmake || $remake $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. - $FGREP $magic3 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. + $FGREP $magic3 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake10c.sh index c94cd982a,e88c31c27..739d7a73a --- a/t/remake10c.sh +++ b/t/remake10c.sh @@@ -95,10 -99,11 +95,10 @@@ for vpath in : false; d $sleep echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $top_srcdir/m4/foo.m4 echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4 - using_gmake || $remake $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. - $FGREP $magic3 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. + $FGREP $magic3 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake12.sh index dda55503f,02cef718e..15a56cec4 --- a/t/remake12.sh +++ b/t/remake12.sh @@@ -83,9 -102,13 +83,9 @@@ check-local: my-chec END mv -f t zardoz.am cat zardoz.am # For debugging. -if using_gmake; then - $MAKE nil -else - $MAKE zardoz -fi +$MAKE nil $FGREP my-check zardoz # Sanity check. - $FGREP $magic1 zardoz zardoz.in && Exit 1 + $FGREP $magic1 zardoz zardoz.in && exit 1 $FGREP $magic2 zardoz $FGREP $magic2 zardoz.in @@@ -100,12 -123,13 +100,12 @@@ sed '/^#H:/d' zardoz.am > quux.a echo 'FOO = dummy' >> quux.am echo 'BAR = $(BAZ)' > top.in echo "BAZ = $magic3" > bot.in -is_gmake || $MAKE zardoz $MAKE test $FGREP my-check zardoz # Sanity check. - $FGREP $magic3 quux.in && Exit 1 + $FGREP $magic3 quux.in && exit 1 $FGREP $magic3 zardoz - $FGREP $magic1 zardoz && Exit 1 - $FGREP $magic2 zardoz && Exit 1 + $FGREP $magic1 zardoz && exit 1 + $FGREP $magic2 zardoz && exit 1 # After the remake above, the files 'zardoz.am' and 'zardoz.in' # should be no more needed. echo 'endif' > zardoz.am # Put in a syntax error. diff --cc t/remake5.sh index be98afd16,b1e8dd8db..1383d0d04 --- a/t/remake5.sh +++ b/t/remake5.sh @@@ -18,8 -18,14 +18,8 @@@ # but not all. # Report from Ralf Corsepius. - . ./defs || Exit 1 + . ./defs || exit 1 -if using_gmake; then - remake="$MAKE" -else - remake="$MAKE Makefile" -fi - cat >>configure.ac <<'EOF' AM_MAINTAINER_MODE m4_include([foo.m4]) @@@ -58,8 -64,8 +58,8 @@@ $slee grep 'AUTOCONF.*=.*false' Makefile : > rebuild_ok ./configure --no-create -$remake +$MAKE - grep 'AUTOCONF.*=.*false' Makefile && Exit 1 + grep 'AUTOCONF.*=.*false' Makefile && exit 1 # Make sure rebuild rules do work if --enable-maintainer-mode is given. ./configure --enable-maintainer-mode diff --cc t/remake9a.sh index f9a2b8367,3e811b766..567872242 --- a/t/remake9a.sh +++ b/t/remake9a.sh @@@ -79,9 -85,9 +79,9 @@@ for vpath in : false; d $sleep echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \ > $srcdir/tweak-configure-in - remake_ + $MAKE nil $FGREP FINGERPRINT Makefile # For debugging. - $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic1 Makefile && exit 1 $FGREP $magic2 Makefile test x"$(./foo.sh)" = x"$magic2" @@@ -89,9 -95,10 +89,9 @@@ echo cat > $srcdir/tweak-configure-in # Make it a no-op again. sed "s/^\\(FINGERPRINT\\)=.*/\\1=DummyValue/" $srcdir/configure.ac >t mv -f t $srcdir/configure.ac - using_gmake || remake_ $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake9b.sh index 901ebe2c6,c90a9820e..262642c7c --- a/t/remake9b.sh +++ b/t/remake9b.sh @@@ -17,8 -17,14 +17,8 @@@ # Test remake rules when Makefile.am or its prerequisites change. # Keep in sync with the other sister tests 'remake9*.test'. - . ./defs || Exit 1 + . ./defs || exit 1 -if using_gmake; then - remake_() { $MAKE nil; } -else - remake_() { $MAKE Makefile && $MAKE foo.sh; } -fi - magic1=::MagicStringOne:: magic2=__MagicStringTwo__ @@@ -81,9 -87,9 +81,9 @@@ for vpath in : false; d $sleep echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \ > $srcdir/tweak-makefile-am - remake_ + $MAKE nil $FGREP FINGERPRINT Makefile # For debugging. - $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic1 Makefile && exit 1 $FGREP $magic2 Makefile test x"$(./foo.sh)" = x"$magic2" @@@ -91,9 -97,10 +91,9 @@@ echo cat > $srcdir/tweak-makefile-am # Make it a no-op again. sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t mv -f t $srcdir/Makefile.am - using_gmake || remake_ $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake9c.sh index 7ef7ca10d,c39bac1f9..e64059316 --- a/t/remake9c.sh +++ b/t/remake9c.sh @@@ -83,18 -89,19 +83,18 @@@ for vpath in : false; d $sleep echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \ > $srcdir/tweak-acinclude-m4 - remake_ + $MAKE nil $FGREP FINGERPRINT Makefile # For debugging. - $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic1 Makefile && exit 1 $FGREP $magic2 Makefile test x"$(./foo.sh)" = x"$magic2" $sleep echo : > $srcdir/tweak-acinclude-m4 # Make it a no-op again. echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $srcdir/acinclude.m4 - using_gmake || remake_ $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/remake9d.sh index 9a4e77796,23441ac5d..5c8fb2f7a --- a/t/remake9d.sh +++ b/t/remake9d.sh @@@ -83,18 -89,19 +83,18 @@@ for vpath in : false; d $sleep echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \ > $srcdir/tweak-aclocal-m4 - remake_ + $MAKE nil $FGREP FINGERPRINT Makefile # For debugging. - $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic1 Makefile && exit 1 $FGREP $magic2 Makefile test x"$(./foo.sh)" = x"$magic2" $sleep echo cat > $srcdir/tweak-aclocal-m4 # Make it a no-op again. echo 'AC_DEFUN([my_fingerprint], [DummyValue])' >> $srcdir/aclocal.m4 - using_gmake || remake_ $MAKE distcheck - $FGREP $magic1 Makefile && Exit 1 # Sanity check. - $FGREP $magic2 Makefile && Exit 1 # Likewise. + $FGREP $magic1 Makefile && exit 1 # Sanity check. + $FGREP $magic2 Makefile && exit 1 # Likewise. $MAKE distclean diff --cc t/repeated-options.sh index e48a60faa,53dc6662f..0eea68499 --- a/t/repeated-options.sh +++ b/t/repeated-options.sh @@@ -17,31 -17,65 +17,30 @@@ # Check that automake does not complain on repeated options, nor # generate broken or incorrect makefiles. -required='cc bzip2' +required=bzip2 - . ./defs || Exit 1 + . ./defs || exit 1 cat >configure.ac < Makefile.am <<'END' -AUTOMAKE_OPTIONS = parallel-tests subdir-objects subdir-objects -AUTOMAKE_OPTIONS += dist-bzip2 parallel-tests -TESTS = foo.test -EXTRA_DIST = $(TESTS) -TESTS_ENVIRONMENT = EXEEXT='$(EXEEXT)' -bin_PROGRAMS = sub/foo -.PHONY: test-build -test-build: - ls -l . sub - test -f sub/foo.$(OBJEXT) - test -f sub/foo$(EXEEXT) +AUTOMAKE_OPTIONS = no-dist-gzip no-dist-gzip dist-bzip2 +AUTOMAKE_OPTIONS += dist-bzip2 foreign END -mkdir sub - -cat > foo.test <<'END' -#!/bin/sh -test -f sub/foo$EXEEXT && test -x sub/foo$EXEEXT -END -chmod a+x foo.test - -cat > sub/foo.c <<'END' -int main (void) -{ - return 0; -} -END - -cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver . - $ACLOCAL -$AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; exit 1; } -test -s stderr && { cat stderr >&2; exit 1; } -rm -f stderr $AUTOCONF +$AUTOMAKE --foreign --foreign -Wall 2>stderr && test ! -s stderr \ - || { cat stderr >&2; Exit 1; } ++ || { cat stderr >&2; exit 1; } ./configure + $MAKE -$MAKE test-build -$MAKE check -ls -l -test -f foo.log -test -f test-suite.log -$MAKE clean $MAKE distcheck -ls -l test -f $me-1.0.tar.bz2 test ! -r $me-1.0.tar.gz diff --cc t/self-check-dir.tap index 7e09fc79b,96b831a57..2bbe82d81 --- a/t/self-check-dir.tap +++ b/t/self-check-dir.tap @@@ -66,10 -66,10 +66,10 @@@ do_check 'do not pre-populate testdir' do_check 'do not create nor chdir in testdir' \ 'am_create_testdir=no' \ - 'test ! -d t/_self.dir || Exit 1 - test ! -f t/_self.dir || Exit 1 - test ! -r t/_self.dir || Exit 1 - grep "compare-autodiffs" Makefile || Exit 1 - case $(pwd) in '"$cwd"') : ;; *) Exit 1;; esac' + 'test ! -d t/_self.dir || exit 1 + test ! -f t/_self.dir || exit 1 + test ! -r t/_self.dir || exit 1 - grep "self-check-dir\.tap" Makefile || exit 1 ++ grep "compare-autodiffs" Makefile || exit 1 + case $(pwd) in '"$cwd"') : ;; *) exit 1;; esac' : diff --cc t/serial-tests.sh index 809c51927,95cee71ed..1e7d367bb --- a/t/serial-tests.sh +++ b/t/serial-tests.sh @@@ -21,9 -21,9 +21,9 @@@ am_create_testdir=empt hasnt_parallel_tests () { - $EGREP -i 'test_suite_log|test_(logs|bases)|\.log.*:' $1 && Exit 1 - grep 'recheck.*:' $1 && Exit 1 - $EGREP 'TEST_SUITE_LOG|TEST_LOGS|\.log.*:' $1 && exit 1 ++ $EGREP -i 'test_suite_log|test_(logs|bases)|\.log.*:' $1 && exit 1 + grep 'recheck.*:' $1 && exit 1 - grep '^check-TESTS: \$(TESTS)$' $1 + grep '^check-TESTS: \$(am__cooked_tests)$' $1 } has_parallel_tests () diff --cc t/silent-lex.sh index a663961f0,e9c6b5556..5b98a1bb6 --- a/t/silent-lex.sh +++ b/t/silent-lex.sh @@@ -17,8 -17,10 +17,8 @@@ # Check silent-rules mode for Lex. required='cc lex' - . ./defs || Exit 1 + . ./defs || exit 1 -mkdir sub - cat >>configure.ac <<'EOF' AM_PROG_CC_C_O AC_PROG_LEX @@@ -53,20 -69,25 +53,20 @@@ $AUTOMAKE --add-missin $AUTOCONF # Ensure per-target rules are used, to ensure their coverage below. - $FGREP 'foo2-foo.c' Makefile.in || Exit 99 + $FGREP 'foo2-foo.c' Makefile.in || exit 99 -$FGREP 'bar2-bar.c' sub/Makefile.in || exit 99 ./configure --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - $EGREP '(mv|ylwrap) ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + $EGREP '(mv|ylwrap) ' stdout && exit 1 grep 'LEX .*foo\.' stdout -grep 'LEX .*bar\.' stdout grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout grep 'CCLD .*foo1' stdout -grep 'CCLD .*bar1' stdout grep 'CCLD .*foo2' stdout -grep 'CCLD .*bar2' stdout # Cleaning and then rebuilding with the same V flag (and without # removing the generated sources in between) shouldn't trigger a @@@ -86,9 -109,10 +86,9 @@@ grep 'CCLD .*foo2' stdou # Ensure a truly clean rebuild. $MAKE clean -rm -f *foo.c sub/*bar.c +rm -f *foo.c - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c ' stdout diff --cc t/silent-many-gcc.sh index 1560bc21d,433aaa62d..a36948722 --- a/t/silent-many-gcc.sh +++ b/t/silent-many-gcc.sh @@@ -39,19 -39,24 +39,19 @@@ do_and_check_silent_build ( mv -f t stdout cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - $EGREP '(mv|ylwrap) ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + $EGREP '(mv|ylwrap) ' stdout && exit 1 + grep ' CC .*bar\.' stdout grep 'CXX .*foo1\.' stdout - grep 'CXX .*baz1\.' stdout - grep 'FC .*foo2\.' stdout - grep 'FC .*baz2\.' stdout + grep ' FC .*foo2\.' stdout grep 'F77 .*foo3\.' stdout - grep 'F77 .*baz3\.' stdout grep ' CC .*foo5\.' stdout - grep ' CC .*baz5\.' stdout grep ' CC .*foo6\.' stdout - grep ' CC .*baz6\.' stdout grep 'CXXLD .*foo' stdout - grep 'CCLD .*bar' stdout + grep ' CCLD .*bar' stdout grep 'CXXLD .*baz' stdout - grep 'CCLD .*bla' stdout if ! $rebuild; then grep 'YACC .*foo6\.' stdout @@@ -170,9 -196,9 +170,9 @@@ $FGREP am_cv_CC_dependencies_compiler_t $FGREP am_cv_CXX_dependencies_compiler_type configure # Ensure per-target rules are used, to ensure their coverage below. # (We do not do an exhaustive check, that wouldn't be practical). - $FGREP 'bar-bar.$(OBJEXT)' Makefile.in || Exit 99 - $FGREP 'baz-foo5.c' Makefile.in || Exit 99 - $FGREP 'baz-foo6.c' Makefile.in || Exit 99 -$FGREP 'bar-bar.o' Makefile.in -$FGREP 'fo2-foo5.c' Makefile.in -$FGREP 'fo2-foo6.c' Makefile.in ++$FGREP 'bar-bar.$(OBJEXT)' Makefile.in || exit 99 ++$FGREP 'baz-foo5.c' Makefile.in || exit 99 ++$FGREP 'baz-foo6.c' Makefile.in || exit 99 # Force gcc ("fast") depmode. depmodes="am_cv_CC_dependencies_compiler_type=gcc \ diff --cc t/silent-many-generic.sh index 05fd6111e,0837a5da6..eb1010cda --- a/t/silent-many-generic.sh +++ b/t/silent-many-generic.sh @@@ -40,19 -40,24 +40,19 @@@ do_and_check_silent_build ( mv -f t stdout cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - $EGREP '(mv|ylwrap) ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + $EGREP '(mv|ylwrap) ' stdout && exit 1 + grep ' CC .*bar\.' stdout grep 'CXX .*foo1\.' stdout - grep 'CXX .*baz1\.' stdout - grep 'FC .*foo2\.' stdout - grep 'FC .*baz2\.' stdout + grep ' FC .*foo2\.' stdout grep 'F77 .*foo3\.' stdout - grep 'F77 .*baz3\.' stdout grep ' CC .*foo5\.' stdout - grep ' CC .*baz5\.' stdout grep ' CC .*foo6\.' stdout - grep ' CC .*baz6\.' stdout grep 'CXXLD .*foo' stdout - grep 'CCLD .*bar' stdout + grep ' CCLD .*bar' stdout grep 'CXXLD .*baz' stdout - grep 'CCLD .*bla' stdout if ! $rebuild; then grep 'YACC .*foo6\.' stdout @@@ -197,9 -223,9 +197,9 @@@ $AUTOCON # Ensure per-target rules are used, to ensure their coverage below. # (We do not do an exhaustive check, that wouldn't be practical). - $FGREP 'bar-bar.$(OBJEXT)' Makefile.in || Exit 99 - $FGREP 'baz-foo5.c' Makefile.in || Exit 99 - $FGREP 'baz-foo6.c' Makefile.in || Exit 99 -$FGREP 'bar-bar.o' Makefile.in -$FGREP 'fo2-foo5.c' Makefile.in -$FGREP 'fo2-foo6.c' Makefile.in ++$FGREP 'bar-bar.$(OBJEXT)' Makefile.in || exit 99 ++$FGREP 'baz-foo5.c' Makefile.in || exit 99 ++$FGREP 'baz-foo6.c' Makefile.in || exit 99 # Force dependency tracking explicitly, so that slow dependency # extractors are not rejected. Try also with dependency tracking diff --cc t/silent-texi.sh index 0a6bb4880,000000000..1640e0e6b mode 100755,000000..100755 --- a/t/silent-texi.sh +++ b/t/silent-texi.sh @@@ -1,85 -1,0 +1,85 @@@ +#!/bin/sh +# Copyright (C) 2009-2012 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 texinfo rules in silent-rules mode. + +required='makeinfo tex texi2dvi dvips' - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'EOF' +info_TEXINFOS = foo.texi sub/zardoz.texi +EOF + +cat > foo.texi <<'EOF' +\input texinfo +@setfilename foo.info +@settitle foo manual +@bye +EOF + +mkdir sub +cat > sub/zardoz.texi <<'EOF' +\input texinfo +@setfilename zardoz.info +@settitle zardoz manual +@bye +EOF + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure --disable-silent-rules + +# Silent mode output. +st=0 +$MAKE V=0 dvi html info ps pdf >stdout 2>stderr || st=$? +cat stdout +cat stderr >&2 +test $st -eq 0 +grep '^ DVIPS foo\.ps$' stdout +grep '^ MAKEINFO foo\.html$' stdout +grep '^ MAKEINFO foo\.info$' stdout +grep '^ TEXI2DVI foo\.dvi$' stdout +grep '^ TEXI2PDF foo\.pdf$' stdout +grep '^ DVIPS sub/zardoz.ps$' stdout +grep '^ MAKEINFO sub/zardoz.html$' stdout +grep '^ MAKEINFO sub/zardoz.info$' stdout +grep '^ TEXI2DVI sub/zardoz.dvi$' stdout +grep '^ TEXI2PDF sub/zardoz.pdf$' stdout +# No make recipe is displayed before being executed. +$EGREP 'texi2(dvi|pdf)|dvips|makeinfo|(rm|mv) ' \ - stdout stderr && Exit 1 ++ stdout stderr && exit 1 +# No verbose output from TeX nor dvips. +$EGREP '(zardoz|foo)\.log|3\.14|Copyright|This is|[Oo]utput ' \ - stdout stderr && Exit 1 ++ stdout stderr && exit 1 + +# Verbose mode output. - $MAKE clean || Exit 1 - $MAKE V=1 dvi html info ps pdf >output 2>&1 || { cat output; Exit 1; } ++$MAKE clean || exit 1 ++$MAKE V=1 dvi html info ps pdf >output 2>&1 || { cat output; exit 1; } +cat output - $EGREP '(DVIPS|MAKEINFO|TEXI2(PDF|DVI)) ' output && Exit 1 ++$EGREP '(DVIPS|MAKEINFO|TEXI2(PDF|DVI)) ' output && exit 1 +# Verbose output from TeX. +grep '[Oo]utput .*foo\.pdf' output +grep '[Oo]utput .*zardoz\.pdf' output +$FGREP 'foo.log' output +$FGREP 'zardoz.log' output +# Verbose output from dvips. +$FGREP ' dvips' output + +: diff --cc t/silent-yacc.sh index 9a075fccd,779f49834..e68d38e07 --- a/t/silent-yacc.sh +++ b/t/silent-yacc.sh @@@ -18,8 -18,10 +18,8 @@@ # Keep this in sync with sister test 'silent-yacc-gcc.test'. required='cc yacc' - . ./defs || Exit 1 + . ./defs || exit 1 -mkdir sub - cat >>configure.ac <<'EOF' AM_PROG_CC_C_O AC_PROG_YACC @@@ -51,42 -66,50 +51,42 @@@ $AUTOMAKE --add-missin $AUTOCONF # Ensure per-target rules are used, to ensure their coverage below. - $FGREP 'foo2-foo.c' Makefile.in || Exit 99 + $FGREP 'foo2-foo.c' Makefile.in || exit 99 -$FGREP 'bar2-bar.c' sub/Makefile.in || exit 99 ./configure --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - $EGREP '(mv|ylwrap) ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + $EGREP '(mv|ylwrap) ' stdout && exit 1 grep 'YACC .*foo\.' stdout -grep 'YACC .*bar\.' stdout -grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout -grep 'CCLD .*foo1' stdout -grep 'CCLD .*bar1' stdout -grep 'CCLD .*foo2' stdout -grep 'CCLD .*bar2' stdout +grep ' CC .*foo\.' stdout +grep 'CCLD .*foo1' stdout +grep 'CCLD .*foo2' stdout # Cleaning and then rebuilding with the same V flag (and without # removing the generated sources in between) shouldn't trigger a # different set of rules. $MAKE clean - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - $EGREP '(mv|ylwrap) ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + $EGREP '(mv|ylwrap) ' stdout && exit 1 # Don't look for YACC, as probably yacc hasn't been re-run. -grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout -grep 'CCLD .*foo1' stdout -grep 'CCLD .*bar1' stdout -grep 'CCLD .*foo2' stdout -grep 'CCLD .*bar2' stdout +grep ' CC .*foo\.' stdout +grep 'CCLD .*foo1' stdout +grep 'CCLD .*foo2' stdout # Ensure a truly clean rebuild. $MAKE clean -rm -f *foo.[ch] sub/*bar.[ch] +rm -f *foo.[ch] - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c ' stdout diff --cc t/silent.sh index f736c3ba7,633cdd8a8..59e09d361 --- a/t/silent.sh +++ b/t/silent.sh @@@ -46,24 -59,24 +46,24 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1 -$EGREP ' (-c|-o)' stdout && exit 1 -grep 'mv ' stdout && exit 1 -grep 'CC .*foo\.' stdout -grep 'CC .*bar\.' stdout -grep 'CC .*baz\.' stdout -grep 'CC .*bla\.' stdout -grep 'CCLD .*foo' stdout -grep 'CCLD .*bar' stdout -grep 'CCLD .*baz' stdout -grep 'CCLD .*bla' stdout ++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1 +grep ' CC *foo\.o' stdout +grep ' CC *bar-bar\.o' stdout +grep ' CC *sub/baz\.o' stdout +grep ' CC *sub/sub_bla-bla\.o' stdout +grep ' CCLD *foo' stdout +grep ' CCLD *bar' stdout +grep ' CCLD *sub/baz' stdout +grep ' CCLD *sub/bla' stdout $MAKE clean - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c' stdout grep ' -o foo' stdout +grep ' -o sub/baz' stdout - $EGREP '(CC|LD) ' stdout && Exit 1 + $EGREP '(CC|LD) ' stdout && exit 1 : diff --cc t/silent2.sh index a7f0207d4,1d67f7e0f..11e83496e --- a/t/silent2.sh +++ b/t/silent2.sh @@@ -47,24 -60,24 +47,24 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1 -$EGREP ' (-c|-o)' stdout && exit 1 -grep 'mv ' stdout && exit 1 -grep 'CC .*foo\.' stdout -grep 'CC .*bar\.' stdout -grep 'CC .*baz\.' stdout -grep 'CC .*bla\.' stdout -grep 'CCLD .*foo' stdout -grep 'CCLD .*bar' stdout -grep 'CCLD .*baz' stdout -grep 'CCLD .*bla' stdout ++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1 +grep ' CC *foo\.o' stdout +grep ' CC *bar-bar\.o' stdout +grep ' CC *sub/baz\.o' stdout +grep ' CC *sub/sub_bla-bla\.o' stdout +grep ' CCLD *foo' stdout +grep ' CCLD *bar' stdout +grep ' CCLD *sub/baz' stdout +grep ' CCLD *sub/bla' stdout $MAKE clean - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c' stdout grep ' -o foo' stdout +grep ' -o sub/baz' stdout - $EGREP '(CC|LD) ' stdout && Exit 1 + $EGREP '(CC|LD) ' stdout && exit 1 : diff --cc t/silent3.sh index 325c7e7db,fe27ae40b..dd9cc8df5 --- a/t/silent3.sh +++ b/t/silent3.sh @@@ -50,25 -62,25 +50,25 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1 -$EGREP ' (-c|-o)' stdout && exit 1 -grep 'mv ' stdout && exit 1 -grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout -grep ' CC .*baz\.' stdout -grep ' CC .*bla\.' stdout -grep ' CCLD .*foo' stdout -grep ' CCLD .*bar' stdout -grep ' CCLD .*baz' stdout -grep ' CCLD .*bla' stdout ++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1 +grep ' CC *libfoo\.lo' stdout +grep ' CC *libbar_la-libbar\.lo' stdout +grep ' CC *sub/libbaz\.lo' stdout +grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout +grep ' CCLD *libfoo\.la' stdout +grep ' CCLD *libbar\.la' stdout +grep ' CCLD *sub/libbaz\.la' stdout +grep ' CCLD *sub/libbla\.la' stdout $MAKE clean - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c' stdout grep ' -o libfoo' stdout +grep ' -o sub/libbaz' stdout # The libtool command line can contain e.g. a '--tag=CC' option. - sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1 + sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1 : diff --cc t/silent4.sh index eccb341b8,88049f16f..562d0c878 --- a/t/silent4.sh +++ b/t/silent4.sh @@@ -51,25 -63,25 +51,25 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1 -$EGREP ' (-c|-o)' stdout && exit 1 -grep 'mv ' stdout && exit 1 -grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout -grep ' CC .*baz\.' stdout -grep ' CC .*bla\.' stdout -grep ' CCLD .*foo' stdout -grep ' CCLD .*bar' stdout -grep ' CCLD .*baz' stdout -grep ' CCLD .*bla' stdout ++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1 +grep ' CC *libfoo\.lo' stdout +grep ' CC *libbar_la-libbar\.lo' stdout +grep ' CC *sub/libbaz\.lo' stdout +grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout +grep ' CCLD *libfoo\.la' stdout +grep ' CCLD *libbar\.la' stdout +grep ' CCLD *sub/libbaz\.la' stdout +grep ' CCLD *sub/libbla\.la' stdout $MAKE clean - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c' stdout grep ' -o libfoo' stdout +grep ' -o sub/libbaz' stdout # The libtool command line can contain e.g. a '--tag=CC' option. - sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1 + sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1 : diff --cc t/silent9.sh index 6c23c9f8e,c2868b500..ddc48cfe5 --- a/t/silent9.sh +++ b/t/silent9.sh @@@ -50,25 -62,25 +50,25 @@@ $AUTOMAKE --add-missin $AUTOCONF ./configure --disable-dependency-tracking --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1 -$EGREP ' (-c|-o)' stdout && exit 1 -grep 'mv ' stdout && exit 1 -grep ' CC .*foo\.' stdout -grep ' CC .*bar\.' stdout -grep ' CC .*baz\.' stdout -grep ' CC .*bla\.' stdout -grep ' CCLD .*foo' stdout -grep ' CCLD .*bar' stdout -grep ' CCLD .*baz' stdout -grep ' CCLD .*bla' stdout ++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1 +grep ' CC *libfoo\.lo' stdout +grep ' CC *libbar_la-libbar\.lo' stdout +grep ' CC *sub/libbaz\.lo' stdout +grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout +grep ' CCLD *libfoo\.la' stdout +grep ' CCLD *libbar\.la' stdout +grep ' CCLD *sub/libbaz\.la' stdout +grep ' CCLD *sub/libbla\.la' stdout $MAKE clean - $MAKE V=1 >stdout || { cat stdout; Exit 1; } + $MAKE V=1 >stdout || { cat stdout; exit 1; } cat stdout grep ' -c' stdout grep ' -o libfoo' stdout +grep ' -o sub/libbaz' stdout # The libtool command line can contain e.g. a '--tag=CC' option. - sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1 + sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1 : diff --cc t/silentcxx-gcc.sh index 35f01be50,903378c64..6417b6b0b --- a/t/silentcxx-gcc.sh +++ b/t/silentcxx-gcc.sh @@@ -65,24 -73,20 +65,24 @@@ for config_args in am_cv_CXX_dependencies_compiler_type=gcc do ./configure $config_args --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - grep 'mv ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + grep 'mv ' stdout && exit 1 - grep 'CXX .*foo\.' stdout - grep 'CXX .*baz\.' stdout - grep 'CXX .*quux\.' stdout - grep 'CXX .*bar\.' stdout - grep 'CXXLD .*foo1' stdout - grep 'CXXLD .*bar1' stdout - grep 'CXXLD .*foo2' stdout - grep 'CXXLD .*bar2' stdout + grep ' CXX *foo\.o' stdout + grep ' CXX *baz\.o' stdout + grep ' CXX *quux\.o' stdout + grep ' CXX *foo2-foo\.o' stdout + grep ' CXX *foo2-baz\.o' stdout + grep ' CXX *foo2-quux\.o' stdout + grep ' CXX *sub/bar\.o' stdout + grep ' CXX *sub/bar2-bar\.o' stdout + grep ' CXXLD *foo1' stdout + grep ' CXXLD *bar1' stdout + grep ' CXXLD *foo2' stdout + grep ' CXXLD *bar2' stdout # Ensure a clean rebuild. $MAKE clean @@@ -91,10 -95,9 +91,10 @@@ cat stdout grep ' -c ' stdout - grep ' -o ' stdout + grep ' -o quux' stdout + grep ' -o bar2' stdout - $EGREP '(CC|CXX|LD) ' stdout && Exit 1 + $EGREP '(CC|CXX|LD) ' stdout && exit 1 # Ensure a clean reconfiguration/rebuild. $MAKE clean diff --cc t/silentcxx.sh index e35072659,a3c375a22..be24509ba --- a/t/silentcxx.sh +++ b/t/silentcxx.sh @@@ -65,24 -74,20 +65,24 @@@ for config_args in --enable-dependency-tracking --disable-dependency-tracking do ./configure $config_args --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } + $MAKE >stdout || { cat stdout; exit 1; } cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - grep 'mv ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + grep 'mv ' stdout && exit 1 - grep 'CXX .*foo\.' stdout - grep 'CXX .*baz\.' stdout - grep 'CXX .*quux\.' stdout - grep 'CXX .*bar\.' stdout - grep 'CXXLD .*foo1' stdout - grep 'CXXLD .*bar1' stdout - grep 'CXXLD .*foo2' stdout - grep 'CXXLD .*bar2' stdout + grep ' CXX *foo\.o' stdout + grep ' CXX *baz\.o' stdout + grep ' CXX *quux\.o' stdout + grep ' CXX *foo2-foo\.o' stdout + grep ' CXX *foo2-baz\.o' stdout + grep ' CXX *foo2-quux\.o' stdout + grep ' CXX *sub/bar\.o' stdout + grep ' CXX *sub/bar2-bar\.o' stdout + grep ' CXXLD *foo1' stdout + grep ' CXXLD *bar1' stdout + grep ' CXXLD *foo2' stdout + grep ' CXXLD *bar2' stdout # Ensure a clean rebuild. $MAKE clean @@@ -91,10 -96,9 +91,10 @@@ cat stdout grep ' -c ' stdout - grep ' -o ' stdout + grep ' -o quux' stdout + grep ' -o bar2' stdout - $EGREP '(CXX|LD) ' stdout && Exit 1 + $EGREP '(CXX|LD) ' stdout && exit 1 # Ensure a clean reconfiguration/rebuild. $MAKE clean diff --cc t/silentf77.sh index 0b8846e8c,a50c69eaa..aaaa9d855 --- a/t/silentf77.sh +++ b/t/silentf77.sh @@@ -57,19 -65,17 +57,19 @@@ sed '/^NOTICE:/d' stdout > mv -f t stdout cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - grep 'mv ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + grep 'mv ' stdout && exit 1 -grep 'F77 .*foo\.' stdout -grep 'F77 .*bar\.' stdout -grep 'F77LD .*foo1' stdout -grep 'F77LD .*bar1' stdout -grep 'F77LD .*foo2' stdout -grep 'F77LD .*bar2' stdout +grep ' F77 *foo\.' stdout +grep ' F77 *foo2-foo\.' stdout +grep ' F77 *sub/bar\.' stdout +grep ' F77 *sub/bar2-bar\.' stdout +grep ' F77LD *foo1' stdout +grep ' F77LD *foo2' stdout +grep ' F77LD *sub/bar1' stdout +grep ' F77LD *bar2' stdout - $EGREP '(FC|FCLD) ' stdout && Exit 1 + $EGREP '(FC|FCLD) ' stdout && exit 1 # Ensure a clean rebuild. $MAKE clean diff --cc t/silentf90.sh index 3466b8af1,78bbce9ff..3561674df --- a/t/silentf90.sh +++ b/t/silentf90.sh @@@ -57,19 -65,17 +57,19 @@@ sed '/^NOTICE:/d' stdout > mv -f t stdout cat stdout - $EGREP ' (-c|-o)' stdout && Exit 1 - grep 'mv ' stdout && Exit 1 + $EGREP ' (-c|-o)' stdout && exit 1 + grep 'mv ' stdout && exit 1 -grep 'FC .*foo\.' stdout -grep 'FC .*bar\.' stdout -grep 'FCLD .*foo1' stdout -grep 'FCLD .*bar1' stdout -grep 'FCLD .*foo2' stdout -grep 'FCLD .*bar2' stdout +grep ' FC *foo\.' stdout +grep ' FC *foo2-foo\.' stdout +grep ' FC *sub/bar\.' stdout +grep ' FC *sub/bar2-bar\.' stdout +grep ' FCLD *foo1' stdout +grep ' FCLD *foo2' stdout +grep ' FCLD *sub/bar1' stdout +grep ' FCLD *bar2' stdout - $EGREP '(F77|F77LD) ' stdout && Exit 1 + $EGREP '(F77|F77LD) ' stdout && exit 1 # Ensure a clean rebuild. $MAKE clean diff --cc t/spell.sh index 790739d15,18abba245..99466917d --- a/t/spell.sh +++ b/t/spell.sh @@@ -16,39 -16,14 +16,39 @@@ # Test to make sure misspellings in _SOURCES variables cause failure. +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 +cat >> configure.ac << 'END' +AC_PROG_CC +AC_OUTPUT +END + cat > Makefile.am << 'END' bin_PROGRAMS = zardoz foo zardoz_SOURCES = x.c boo_SOURCES = y.c END +echo 'int main (void) { return 0; }' > x.c +echo 'int main (void) { return 0; }' > y.c + $ACLOCAL -AUTOMAKE_fails -grep 'Makefile.am:3:.*boo' stderr +$AUTOCONF +$AUTOMAKE + +./configure - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 + +LC_ALL=C sed 's/^Makefile:[0-9][0-9]*: //' stderr > got + +cat > exp << 'END' +variable 'boo_SOURCES' is defined but no program + or library has 'boo' as canonical name +*** Some Automake-NG error occurred. Stop. +END + +diff exp got + +: diff --cc t/spell2.sh index dead9c118,c468b2b06..6bc7e11e1 --- a/t/spell2.sh +++ b/t/spell2.sh @@@ -14,41 -14,18 +14,41 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure misspellings in _SOURCES variables cause failure. +# Test to make sure misspellings in _LDADD variable cause failure. +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 -echo AC_PROG_CC >> configure.ac +cat >> configure.ac << 'END' +AC_PROG_CC +AC_OUTPUT +END cat > Makefile.am << 'END' bin_PROGRAMS = zardoz zardoz_SOURCES = x.c -qardoz_LDADD = -ljoe +qardoz_LDADD = -lm END +echo 'int main (void) { return 0; }' > x.c + $ACLOCAL -AUTOMAKE_fails -grep 'Makefile.am:3:.*qardoz' stderr +$AUTOCONF +$AUTOMAKE + +./configure + - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 + +LC_ALL=C sed 's/^Makefile:[0-9][0-9]*: //' stderr > got + +cat > exp << 'END' +variable 'qardoz_LDADD' is defined but no program + or library has 'qardoz' as canonical name +*** Some Automake-NG error occurred. Stop. +END + +diff exp got + +: diff --cc t/spy-autovars.sh index 4326745d6,000000000..99f506e34 mode 100755,000000..100755 --- a/t/spy-autovars.sh +++ b/t/spy-autovars.sh @@@ -1,58 -1,0 +1,58 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Verify that our expectations on the behaviour of (some) GNU make +# automatic variables are correct. +# This test is quite incomplete, and should be filled out whenever +# we want to start assuming and using a further behaviour of +# automatic variables of GNU make. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat > Makefile <<'END' +foo: + test $@ = foo + test $(@D) = . + test $(@F) = foo +./bar: + test $@ = ./bar || test $@ = bar + test $(@D) = . + test $(@F) = bar +../baz: + test $@ = ../baz + test $(@D) = .. + test $(@F) = baz +1/2/3: + test $@ = 1/2/3 + test $(@D) = 1/2 + test $(@F) = 3 +/abs/path: + test $@ = /abs/path + test $(@D) = /abs + test $(@F) = path +END + +$MAKE foo +$MAKE ./foo +$MAKE bar +$MAKE ./bar +$MAKE ../baz +$MAKE 1/2/3 +$MAKE ./1/2/3 +$MAKE /abs/path + +: diff --cc t/spy-pattern-rules.sh index b2bb25d96,30a18c0d7..c1e0c7926 --- a/t/spy-pattern-rules.sh +++ b/t/spy-pattern-rules.sh @@@ -14,41 -14,24 +14,41 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure Automake supports implicit rules "confusing" -# extensions. Inspired by a mail from Alex Hornby. +# Check that, if we have two pattern rules from which the same file (or +# set of files) can be built, and both are applicable, the first one wins. +# This is used at least in our 'parallel-tests' support. +am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 -cat > Makefile.am << 'END' -SUFFIXES = .idl S.cpp C.h -SUFFIXES += C.cpp S.h -.idlC.cpp: +cat > Makefile <<'END' +default: + +%.foo: % + cp $< $@ +%.foo: %.x cp $< $@ + +%.bar: %.x + cp $< $@ +%.bar: % + +%.mu %.fu: %.1 + cp $< $*.mu && cp $< $*.fu +%.mu %.fu: %.2 + cp $< $*.mu && cp $< $*.fu END -$ACLOCAL -$AUTOMAKE +echo one > all +echo two > all.x +$MAKE all.foo all.bar +diff all all.foo +diff all.x all.bar -# Make sure Automake has NOT recognized .cpp and .idlC as two new -# extensions. -grep 'SUFFIXES.* \.cpp' Makefile.in && exit 1 -grep 'SUFFIXES.* \.idlC' Makefile.in && exit 1 +echo one > x.1 +echo two > x.2 +$MAKE x.mu +diff x.mu x.1 +diff x.fu x.1 : diff --cc t/spy-phony.sh index 4e428193f,dd918a14d..a1f9d15c0 --- a/t/spy-phony.sh +++ b/t/spy-phony.sh @@@ -14,44 -14,28 +14,44 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure libtool is removed. -# Report from Kevin Dalley. +# Check that the '.PHONY' semantics we expect truly hold. -required=libtool +am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' -AC_LIBTOOL_DLOPEN -AC_DISABLE_SHARED -AC_PROG_LIBTOOL -AC_SUBST([LIBTOOL_DEPS]) +cat > Makefile <<'END' +.PHONY: pdir pfile +pdir rdir: + echo foo > $@/foo +pfile rfile: + echo bar >$@ +.PHONY: other +other: + echo baz >> dummy +indirect: other + echo run > $@ END -: > Makefile.am - -: > ltmain.sh -: > config.guess -: > config.sub - -$ACLOCAL -$AUTOMAKE - -grep 'rm -f libtool' Makefile.in +: > rfile +mkdir rdir +$MAKE rdir rfile +test ! -s rfile +test ! -f rdir/foo + +: > pfile +mkdir pdir +$MAKE pdir pfile +test "`cat pfile`" = bar +test "`cat pdir/foo`" = foo + +$MAKE other +test "`cat dummy`" = baz +$MAKE other +test "`cat dummy`" = "baz${nl}baz" + +echo not run > indirect +$MAKE indirect +test "`cat indirect`" = run +test "`cat dummy`" = "baz${nl}baz${nl}baz" : diff --cc t/spy-trailing-backlash.sh index cc5d72008,000000000..07e67677a mode 100755,000000..100755 --- a/t/spy-trailing-backlash.sh +++ b/t/spy-trailing-backlash.sh @@@ -1,72 -1,0 +1,72 @@@ +#! /bin/sh +# Copyright (C) 2012 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 that GNU make line-continuation with backslash-newline has the +# semantic we expect. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat > Makefile << 'END' +default: + +hash = \# +ok: ; true :--$(hash)--: + +var1 = \ +rule1: + +rule2: \ +; echo ok > sentinel + +# The backslash doesn't cause we to continue to read after +# the fist blank line. +rule3: \ + +var2 = ok + +# Ditto. +var3 = a \ + +b: + +# The backslash will cause the next line to be a comment as well \ +$(error comment not continued) + +var4 = foo \ +# not seen + +.PHONY: test +test: + test $(var1) = rule1: + test $(var2) = ok + test $(var3) = a + test $(var4) = foo + test -z '$(var5)' + +var5 = \ +END + +$MAKE +$MAKE ok +$MAKE ok | grep ':--#--:' - $MAKE rule1 && Exit 1 ++$MAKE rule1 && exit 1 +$MAKE rule2 +test -f sentinel +$MAKE rule3 +$MAKE test + +: diff --cc t/spy-var-append.sh index b7d614f4e,000000000..ac8cc5256 mode 100755,000000..100755 --- a/t/spy-var-append.sh +++ b/t/spy-var-append.sh @@@ -1,57 -1,0 +1,57 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# GNU make allows us to append to undefined variables. +# Also, if we override a variable definition from the command line, +# any '+=' appending to it gets overridden as well. + +am_create_testdir=empty - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat > Makefile << 'END' +var0 += foo + +var1 += bar +var1 += baz + +var2 = a +var2 += b + +var3 := x +var3 += y + +.PHONY: test1 test2 +test1: + test x'$(var0)' = x'foo' + test x'$(var1)' = x'bar baz' + test x'$(var2)' = x'a b' + test x'$(var3)' = x'x y' +test2: + test x'$(var0)' = x'mu' + test x'$(var1)' = x + test x'$(var2)' = x'two' + test x'$(var3)' = x'three' +END + +checkit () +{ - $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; } ++ $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; exit 1; } +} + +checkit test1 +checkit test2 var0=mu var1= var2=two var3=three + +: diff --cc t/spy-vpath-rewrite.sh index b5dd58904,000000000..3e70fea2a mode 100755,000000..100755 --- a/t/spy-vpath-rewrite.sh +++ b/t/spy-vpath-rewrite.sh @@@ -1,150 -1,0 +1,150 @@@ +#! /bin/sh +# Copyright (C) 2012 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 that the automatic variable '$<' always undergoes VPATH rewrite. +# We use that assumption in some of our rules, so it better explicitly +# check that it truly holds. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +ocwd=`pwd` || fatal_ "couldn't get current working directory" + +mkdir src +cd src + +cat > mk <<'END' +.SUFFIXES: +.SUFFIXES: .a .b .a2 .b2 .a3 .b3 .a4 .b4 + +empty = +source = $< + +all: one.b two.b2 three.b3 four.b4 +all: www.d xxx.d2 yyy.d3 zzz.d4 +all: bar/mu.x is.ok zardoz +all: here here2 he/re + +.a.b: + cp $< $@ + +.a2.b2: + cp '$<' $@ + +.a3.b3: + cp $(empty)$<$(empty) $@ + +.a4.b4: + cp $(source) $@ + +%.d: %.c + cp $< $@ + +%.d2: %.c2 + cp '$(source)' $@ + +%.d3: %.c3 %.cc + cp `echo '$<'` $@ + +%.d4: %.c4 ignore-me + orig=x$(<)x && orig=`expr "$$orig" : 'x\(.*\)x$$'` && cp $$orig $@ + +bar/%: foo/% + mkdir $(dir $@) + cp $< $@ + +%.ok: zap/% + cp "$<" $@ + +%: zap/sub/% + cp '$<' $@ + +here: there + cp $< $@ + +here2: there2 ignore-me + cp '$<' $@ + +he/re: the/re + mkdir $(dir $@) + cp "$(source)" $@ +END + +mkdir foo zap zap/sub the +for file in \ + one.a \ + two.a2 \ + three.a3 \ + four.a4 \ + www.c \ + xxx.c2 \ + yyy.c3 \ + zzz.c4 \ + foo/mu.x \ + zap/is \ + zap/sub/zardoz \ + there \ + there2 \ + the/re \ +; do + echo $file > $file +done +touch yyy.cc ignore-me + +do_test () +{ + srcdir=$1 + cp $srcdir/mk Makefile + $MAKE -k all VPATH=$srcdir + if test "$srcdir" != "."; then - test ! -f $srcdir/bar && test ! -d $srcdir/bar || Exit 1 - test ! -f $srcdir/he && test ! -d $srcdir/he || Exit 1 ++ test ! -f $srcdir/bar && test ! -d $srcdir/bar || exit 1 ++ test ! -f $srcdir/he && test ! -d $srcdir/he || exit 1 + fi + diff $srcdir/one.a one.b + diff $srcdir/two.a2 two.b2 + diff $srcdir/three.a3 three.b3 + diff $srcdir/four.a4 four.b4 + diff $srcdir/www.c www.d + diff $srcdir/xxx.c2 xxx.d2 + diff $srcdir/yyy.c3 yyy.d3 + diff $srcdir/zzz.c4 zzz.d4 + diff $srcdir/foo/mu.x bar/mu.x + diff $srcdir/zap/is is.ok + diff $srcdir/zap/sub/zardoz zardoz + diff $srcdir/there here + diff $srcdir/the/re he/re +} + +cd "$ocwd" +mkdir build +cd build +do_test ../src + +cd "$ocwd" +mkdir build2 +cd build2 +do_test "$ocwd"/src + +cd "$ocwd" +cd src +mkdir build +cd build +do_test .. + +cd "$ocwd" +cd src +do_test . + +: diff --cc t/spy-wildcard.sh index 83ebde78d,6df427f30..9a8e47daf --- a/t/spy-wildcard.sh +++ b/t/spy-wildcard.sh @@@ -14,23 -14,19 +14,23 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test that := definitions produce warnings, but otherwise work. +# Check that the behaviour of the $(wildcard) builtin in corner cases +# matches the assumptions done in our recipes. - . ./defs || Exit 1 + . ./defs || exit 1 -cat > Makefile.am << 'END' -ICONS := $(wildcard *.xbm) -END +mkdir dir +echo dummy > file -$ACLOCAL -AUTOMAKE_fails -grep ':=.*not portable' stderr +cat > Makefile <<'END' +.PHONY: test +test: + test x'$(wildcard dir)' = x'dir' + test x'$(wildcard file)' = x'file' + test x'$(wildcard dir/)' = x'dir/' + test x'$(wildcard file/.)' = x'' +END -$AUTOMAKE -Wno-portability -grep '^ICONS *:= *\$(wildcard \*\.xbm) *$' Makefile.in +$MAKE test : diff --cc t/stdinc-no-repeated.sh index 159cda589,5d7694fe1..afeb1fd3c --- a/t/stdinc-no-repeated.sh +++ b/t/stdinc-no-repeated.sh @@@ -14,14 -14,12 +14,14 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure .info-less @setfilename works. +# Check that automake rules do not use repeated "-I $(srcdir)" in the +# compiler invocation. -required='makeinfo tex texi2dvi' +required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' +AC_PROG_CC AC_OUTPUT END @@@ -32,21 -40,14 +32,21 @@@ $ACLOCA $AUTOCONF $AUTOMAKE --add-missing -grep '^INFO_DEPS.*textutils$' Makefile.in - -# We should not use single suffix inference rules (with separate -# dependencies), this confuses Solaris make. -grep '^\.texi:$' Makefile.in && exit 1 -grep 'textutils: *textutils\.texi' Makefile.in - +# Test with $builddir != $srcdir +mkdir build +cd build +../configure - $MAKE V=1 > stdout || { cat stdout; Exit 1; } ++$MAKE V=1 > stdout || { cat stdout; exit 1; } +cat stdout +grep '.*-I *\. .*-I *\.\. ' stdout - grep '.*-I *\. .*-I *\. ' stdout && Exit 1 ++grep '.*-I *\. .*-I *\. ' stdout && exit 1 +cd .. + +# Test with $builddir = $srcdir ./configure - $MAKE V=1 > stdout || { cat stdout; Exit 1; } -$MAKE distcheck ++$MAKE V=1 > stdout || { cat stdout; exit 1; } +cat stdout +grep '.*-I *\. ' stdout - grep '.*-I *\..*-I *\.' stdout && Exit 1 ++grep '.*-I *\..*-I *\.' stdout && exit 1 : diff --cc t/subdir.sh index 2ce68b86b,249481aa3..fb1e2469c --- a/t/subdir.sh +++ b/t/subdir.sh @@@ -14,9 -14,10 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure install-sh and mkinstalldirs correctly found in -# subdirs. +# Test to make sure install-sh is correctly found in subdirs. - . ./defs || Exit 1 + . ./defs || exit 1 mkdir zot diff --cc t/subobj-c.sh index 0bbeb2bb0,000000000..eafecaf75 mode 100755,000000..100755 --- a/t/subobj-c.sh +++ b/t/subobj-c.sh @@@ -1,118 -1,0 +1,118 @@@ +#! /bin/sh +# Copyright (C) 1999-2012 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 subdir objects with C, building both a library and an executable. +# Keep in sync with sister test 'subobj-cxx.sh'. + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_AR +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = progs/wish +lib_LIBRARIES = libs/libhope.a +progs_wish_SOURCES = generic/a.c generic/b.c +libs_libhope_a_SOURCES = sub/sub2/foo.c + +.PHONY: remake-single-object +remake-single-object: + rm -rf generic + $(MAKE) generic/a.$(OBJEXT) + test -f generic/a.$(OBJEXT) + test ! -f generic/b.$(OBJEXT) + rm -rf generic + $(MAKE) generic/b.$(OBJEXT) + test ! -f generic/a.$(OBJEXT) + test -f generic/b.$(OBJEXT) + rm -rf sub generic + $(MAKE) sub/sub2/foo.$(OBJEXT) + test -f sub/sub2/foo.$(OBJEXT) + test ! -d generic +END + +mkdir generic sub sub/sub2 + +cat > generic/a.c < generic/b.c + +cat > sub/sub2/foo.c <<'END' +int answer (void) +{ + return 42; +} +END + +$ACLOCAL - $AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; } ++$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; } +cat stderr >&2 + +# Make sure compile is installed, and that Automake says so. +grep 'install.*compile' stderr +test -f compile + - $EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && Exit 1 ++$EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && exit 1 + +$AUTOCONF + +mkdir build +cd build +../configure +$MAKE + +test -d progs +test -d libs +test -d generic +test -d sub/sub2 + +if test -f progs/wish; then + EXEEXT= +elif test -f progs/wish.exe; then + EXEEXT=.exe +else + fatal_ "couldn't determine extension of executables" +fi + +# The libraries and executables are not uselessly remade. +: > xstamp +$sleep +echo dummy > progs/change-dir-timestamp +echo dummy > libs/change-dir-timestamp +echo dummy > generic/change-dir-timestamp +echo dummy > sub/change-dir-timestamp +echo dummy > sub/sub2/change-dir-timestamp +$MAKE +is_newest xstamp progs/wish$EXEEXT libs/libhope.a + +$MAKE remake-single-object + +# Must work also with dependency tracking disabled. +# Also sanity check the distribution. +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking + +: diff --cc t/subobj-cxx-grep.sh index 1a03b16f0,646c6cf2c..b1f6980b6 --- a/t/subobj-cxx-grep.sh +++ b/t/subobj-cxx-grep.sh @@@ -14,14 -14,16 +14,14 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test of subdir objects with C++. +# Grepping checks on the use of subdir objects with C++. +# See relate test 't/subobj-cxx-grep.sh' for semantic checks. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << 'END' -AC_PROG_CXX -END +echo AC_PROG_CXX >> configure.ac cat > Makefile.am << 'END' -AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = wish wish_SOURCES = generic/a.cc generic/b.cxx END @@@ -30,8 -32,7 +30,8 @@@ $ACLOCA $AUTOMAKE $FGREP 'generic/a.$(OBJEXT)' Makefile.in -grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1 -grep '.*-c -o' Makefile.in +$FGREP 'generic/b.$(OBJEXT)' Makefile.in - grep '[^/][ab]\.\$(OBJEXT)' Makefile.in && Exit 1 - grep '.*-c -o' Makefile.in ++grep '[^/][ab]\.\$(OBJEXT)' Makefile.in && exit 1 ++grep '.* -c -o ' Makefile.in : diff --cc t/subobj-cxx.sh index ccb9e7716,000000000..e72a4e796 mode 100755,000000..100755 --- a/t/subobj-cxx.sh +++ b/t/subobj-cxx.sh @@@ -1,121 -1,0 +1,121 @@@ +#! /bin/sh +# Copyright (C) 1999-2012 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 subdir objects with C++, building both a library and an executable. +# Keep in sync with sister test 'subobj-c.sh'. + +required=c++ - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CXX +AM_PROG_AR +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = progs/wish +lib_LIBRARIES = libs/libhope.a +progs_wish_SOURCES = generic/a.cc generic/b.c++ +libs_libhope_a_SOURCES = sub/sub2/foo.cxx + +.PHONY: remake-single-object +remake-single-object: + rm -rf generic + $(MAKE) generic/a.$(OBJEXT) + test -f generic/a.$(OBJEXT) + test ! -f generic/b.$(OBJEXT) + rm -rf generic + $(MAKE) generic/b.$(OBJEXT) + test ! -f generic/a.$(OBJEXT) + test -f generic/b.$(OBJEXT) + rm -rf sub generic + $(MAKE) sub/sub2/foo.$(OBJEXT) + test -f sub/sub2/foo.$(OBJEXT) + test ! -d generic +END + +mkdir generic sub sub/sub2 + +cat > generic/a.cc < generic/b.c++ < sub/sub2/foo.cxx <<'END' +using namespace std; // Make this valid C++ but invalid C. +int answer (void) +{ + return 42; +} +END + +$ACLOCAL +$AUTOMAKE -a +test ! -f compile # This is not needed by C++ support. - $EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && Exit 1 ++$EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && exit 1 + +$AUTOCONF + +mkdir build +cd build +../configure +$MAKE + +test -d progs +test -d libs +test -d generic +test -d sub/sub2 + +if test -f progs/wish; then + EXEEXT= +elif test -f progs/wish.exe; then + EXEEXT=.exe +else + fatal_ "couldn't determine extension of executables" +fi + +# The libraries and executables are not uselessly remade. +: > xstamp +$sleep +echo dummy > progs/change-dir-timestamp +echo dummy > libs/change-dir-timestamp +echo dummy > generic/change-dir-timestamp +echo dummy > sub/change-dir-timestamp +echo dummy > sub/sub2/change-dir-timestamp +$MAKE +is_newest xstamp progs/wish$EXEEXT libs/libhope.a + +$MAKE remake-single-object + +# Must work also with dependency tracking disabled. +# Also sanity check the distribution. +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking + +: diff --cc t/subobj-libtool.sh index fc9f8c7e1,000000000..940e872a9 mode 100755,000000..100755 --- a/t/subobj-libtool.sh +++ b/t/subobj-libtool.sh @@@ -1,94 -1,0 +1,94 @@@ +#! /bin/sh +# Copyright (C) 1999-2012 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 of subdir objects with libtool. + +required='cc libtoolize' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_AR +AC_PROG_LIBTOOL +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LTLIBRARIES = libs/libfoo.la +libs_libfoo_la_SOURCES = generic/1.c generic/2.c sub/subsub/3.c + +.PHONY: remake-single-object +remake-single-object: + rm -rf generic + $(MAKE) generic/1.lo + test -f generic/1.lo + test ! -f generic/2.lo + rm -rf generic + $(MAKE) generic/2.lo + test ! -f generic/1.lo + test -f generic/2.lo + rm -rf sub generic + $(MAKE) sub/subsub/3.lo + test -f sub/subsub/3.lo + test ! -d generic +END + +mkdir generic sub sub/subsub +echo 'int one (void) { return 1; }' > generic/1.c +echo 'int two (void) { return 2; }' > generic/2.c +echo 'int three (void) { return 3; }' > sub/subsub/3.c + +libtoolize +$ACLOCAL + - $AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; } ++$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; } +cat stderr >&2 + +# Make sure compile is installed, and that Automake says so. +grep 'install.*compile' stderr +test -f compile + - grep '[^/][123]\.lo' Makefile.in && Exit 1 ++grep '[^/][123]\.lo' Makefile.in && exit 1 + +$AUTOCONF + +mkdir build +cd build +../configure +$MAKE + +test -d libs +test -d generic +test -d sub/subsub + +# The libraries and executables are not uselessly remade. +: > xstamp +$sleep +echo dummy > libs/change-dir-timestamp +echo dummy > generic/change-dir-timestamp +echo dummy > sub/change-dir-timestamp +echo dummy > sub/subsub/change-dir-timestamp +$MAKE +is_newest xstamp libs/libfoo.la + +$MAKE remake-single-object + +# VPATH builds must work also with dependency tracking disabled. +# Also sanity check the distribution. +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking + +: diff --cc t/subobj10.sh index e1d911ada,cefb0ab06..55776a722 --- a/t/subobj10.sh +++ b/t/subobj10.sh @@@ -14,12 -14,15 +14,12 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# PR 492: Test asm subdir-objects. +# PR 492: Test asm subdir objects. required=gcc - . ./defs || Exit 1 + . ./defs || exit 1 -cat > configure.ac << END -AC_INIT([$me], [1.0]) -AM_INIT_AUTOMAKE([subdir-objects]) - +cat >> configure.ac << 'END' AM_PROG_AS AM_PROG_AR AC_PROG_RANLIB diff --cc t/subobj11a.sh index 6fea19a55,474ed82fc..25603cef6 --- a/t/subobj11a.sh +++ b/t/subobj11a.sh @@@ -14,25 -14,20 +14,25 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test that automake works around a bug of Solaris Make. The bug is the -# following. If we have a Makefile containg a file inclusion like this: +# If we have a Makefile containing a file inclusion like this: +# # include .//foo.mk -# Solaris make fails with a message like: +# +# Solaris 10 make fails with a message like: +# # make: ... can't find '/foo.mk': No such file or directory # make: fatal error ... read of include file '/foo.mk' failed -# (even if the file 'foo.mk' exists). The error disappear by collapsing -# the repeated slash '/' characters into a single one. # -# See also sister "grepping" test 'subobj11b.test', and related test -# 'subobj11c.test'. +# (even if the file 'foo.mk' exists). Our dependency tracking support +# code used to generate include directives like that sometimes, thus +# causing spurious failures. +# +# GNU make shouldn't suffer from that Solaris make bug, but we check +# the problematic setup anyway -- better safe than sorry. +# required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/subobj8.sh index 6ab39d346,58b1e41f3..cd25f6692 --- a/t/subobj8.sh +++ b/t/subobj8.sh @@@ -14,10 -14,9 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure 'compile' is included when subdir-objects is used in a subdir. +# Make sure 'compile' is included when subdir objects are used in a +# subdir. - . ./defs || Exit 1 + . ./defs || exit 1 cat > configure.ac << END AC_INIT([$me], [1.0]) diff --cc t/subobj9.sh index 3743bc30b,2d8f8fbe2..4b3c4d5fb --- a/t/subobj9.sh +++ b/t/subobj9.sh @@@ -23,9 -23,11 +23,9 @@@ # forgets '.../.o'. required='c++ libtoolize' - . ./defs || Exit 1 + . ./defs || exit 1 -cat > configure.ac << END -AC_INIT([$me], [1.0]) -AM_INIT_AUTOMAKE([subdir-objects]) +cat >> configure.ac << END AC_PROG_CXX AM_PROG_AR AM_PROG_LIBTOOL diff --cc t/subpkg-yacc.sh index 022e6533b,3d107cfb8..52b896b83 --- a/t/subpkg-yacc.sh +++ b/t/subpkg-yacc.sh @@@ -18,13 -18,10 +18,13 @@@ # properly, when a subpackage is involved. required='cc yacc' - . ./defs || Exit 1 + . ./defs || exit 1 -cat >>configure.ac <<'END' +cat > configure.ac <<'END' +AC_INIT([suya], [0.5a], [automake-ng@gnu.org]) +AM_INIT_AUTOMAKE([foreign -Wall]) AC_PROG_CC +AC_CONFIG_FILES([GNUmakefile]) AC_CONFIG_SUBDIRS([lib]) AC_OUTPUT END diff --cc t/subpkg.sh index 18d3e20bb,72fcb0ac7..4f86072f9 --- a/t/subpkg.sh +++ b/t/subpkg.sh @@@ -107,10 -104,7 +107,10 @@@ $AUTOHEADE $AUTOMAKE -Wno-override --add-missing cd .. - ./configure >stdout || { cat stdout; Exit 1; } -./configure ++./configure >stdout || { cat stdout; exit 1; } +cat stdout +grep '^checking whether cc understands -c and -o together' stdout + $MAKE $MAKE distcheck test ! -d subpack-1 # Make sure distcheck cleans up after itself. diff --cc t/substref.sh index 6e9bb6f6a,4ea39e602..d24bf1382 --- a/t/substref.sh +++ b/t/substref.sh @@@ -47,8 -47,8 +47,8 @@@ $MAKE tes # This is unrelated to the rest of this test. But while we are # at it, make sure we don't use am__helldl_SOURCES_DIST here, since -# it's not needed. DIST_SOURCES should contain $(helldl_SOURCES). +# it's not needed. am__dist_sources should contain $(helldl_SOURCES). - grep am__helldl_SOURCES_DIST Makefile && Exit 1 + grep am__helldl_SOURCES_DIST Makefile && exit 1 -grep 'DIST_SOURCES.*\$(helldl_SOURCES)' Makefile +grep 'am__dist_sources.*\$(helldl_SOURCES)' Makefile : diff --cc t/suffix-chain.sh index e1f96b2f6,535e36e86..7ac4997f6 --- a/t/suffix-chain.sh +++ b/t/suffix-chain.sh @@@ -19,8 -19,10 +19,8 @@@ # See automake bug#7824 and bug#7670. required=cc - . ./defs || Exit 1 + . ./defs || exit 1 -plan_ 8 - cat >> configure.ac <<'END' AC_PROG_CC AC_OUTPUT diff --cc t/suffix-custom-default-ext.sh index 0bc729524,000000000..1736921d0 mode 100755,000000..100755 --- a/t/suffix-custom-default-ext.sh +++ b/t/suffix-custom-default-ext.sh @@@ -1,70 -1,0 +1,70 @@@ +#! /bin/sh +# Copyright (C) 2002-2012 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 . + +# Interaction between user-defined extensions for files in _SOURCES +# and the use of AM_DEFAULT_SOURCE_EXT. + +required=c++ - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AC_PROG_CXX +AC_OUTPUT +END + +cat > Makefile.am <<'END' +AM_DEFAULT_SOURCE_EXT = .cc +bin_PROGRAMS = foo bar baz qux +%.cc: %.zoo + sed 's/INTEGER/int/g' $< >$@ +EXTRA_DIST = $(addsuffix .zoo,$(bin_PROGRAMS)) +generated_cc_sources = $(addsuffix .cc,$(bin_PROGRAMS)) +CLEANFILES = $(generated_cc_sources) +# We don't want the generated C++ files to be distributed, and this +# is the best workaround we've found so far. Not very clean, but it +# works. +dist-hook: + rm -f $(addprefix $(distdir)/,$(generated_cc_sources)) +END + +# This is deliberately valid C++, but invalid C. +cat > foo.zoo <<'END' +using namespace std; +INTEGER main (void) +{ + return 0; +} +END +cp foo.zoo bar.zoo +cp foo.zoo baz.zoo +cp foo.zoo qux.zoo + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +$MAKE all +$MAKE distdir +ls -l $distdir +test ! -f $distdir/foo.cc +test ! -f $distdir/bar.cc +test ! -f $distdir/baz.cc +test ! -f $distdir/qux.cc +$MAKE distcheck + +: diff --cc t/suffix-custom-link.sh index 1a3c0134b,000000000..8b1e50511 mode 100755,000000..100755 --- a/t/suffix-custom-link.sh +++ b/t/suffix-custom-link.sh @@@ -1,74 -1,0 +1,74 @@@ +#! /bin/sh +# Copyright (C) 2002-2012 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 that Automake support entries with user-defined extensions of +# files in _SOURCES, and we can override the choice of a link in case +# the Automake default (C linker) would be inappropriate. + +required=c++ - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AC_PROG_CXX +AC_OUTPUT +END + +cat > Makefile.am <<'END' +%.$(OBJEXT): %.xt +## Creative quoting to plase maintainer checks. + sed -e 's/@/o/g' -e 's/!/;/g' -e 's/<-/<''$*-t.cc \ + && $(CXX) -c $*-t.cc \ + && rm -f $*-t.cc \ + && mv -f $*-t.$(OBJEXT) $@ +bin_PROGRAMS = foo +foo_SOURCES = 1.xt 2.xt +foo_LINK = $(CXX) -o $@ +END + +cat > 1.xt <<'END' +#include +void say_hell@ (v@id)! +int main (v@id) +{ + say_hell@ ()! + std::exit(0)! +} +END + +cat > 2.xt <<'END' +#include +void say_hell@ (v@id) +{ + using namespace std! + c@ut <- "Hell@, W@rld\n" <- endl! +} +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +$MAKE all +if cross_compiling; then :; else + ./foo + ./foo | grep 'Hello, World' +fi + +$MAKE distcheck + +: diff --cc t/suffix-custom-subobj.sh index 254ab7907,22ec98520..070be7439 --- a/t/suffix-custom-subobj.sh +++ b/t/suffix-custom-subobj.sh @@@ -14,11 -14,11 +14,11 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Tests that Automake understands suffix rules with subdir objects. -# Reported by John Ratliff. +# Tests that pattern rules with subdir objects are understood. +# Originally reported by John Ratliff against suffix rules. required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >>configure.ac <. + +# Check that Automake support entries with user-defined extensions of +# files in _SOURCES, if there is a rule to turn files with that +# extension in object files. +# See also related test 'suffix-custom-go.sh' for a check using a +# real-world third party compiler (Go from Google). + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac <<'END' +AC_CONFIG_HEADERS([config.h]) - AC_DEFINE([EXIT_OK], [0], [Exit status for success]) - AC_DEFINE([EXIT_KO], [1], [Exit status for failure]) ++AC_DEFINE([EXIT_OK], [0], [The exit status for success]) ++AC_DEFINE([EXIT_KO], [1], [The exit status for failure]) +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am <<'END' +AM_DEFAULT_SOURCE_EXT = .my-c +MY_CFLAGS = $(if $(filter .,$(srcdir)),,-I $(srcdir)) $(CPPFLAGS) +%.$(OBJEXT): %.my-c + sed -e 's/@/o/g' -e 's/~/0/g' $< >$*-t.c \ + && $(CC) $(MY_CFLAGS) -c $*-t.c \ + && rm -f $*-t.c \ + && mv -f $*-t.$(OBJEXT) $@ +bin_PROGRAMS = foo +bin_PROGRAMS += zardoz +zardoz_SOURCES = main.c protos.h greet.my-c cleanup.my-c +END + +cat > foo.my-c <<'END' +#include +#include +int main (v@id) +{ + printf ("Dummy\n"); + exit (~); +} +END + +cat > protos.h << 'END' +void greet (void); +int cleanup (void); +#include +END + +cat > greet.my-c << 'END' +#include "pr@t@s.h" +void greet (v@id) +{ + printf ("Hell@, "); +} +END + +cat > cleanup.my-c << 'END' +#include "pr@t@s.h" +int cleanup (v@id) +{ + return (fcl@se (std@ut) == ~); +} +END + +cat > main.c <<'END' +#include +#include "protos.h" +int main (void) +{ + greet (); + puts ("W@rld!\n"); + return (cleanup () ? EXIT_OK : EXIT_KO); +} +END + +$ACLOCAL +$AUTOHEADER +$AUTOMAKE +$AUTOCONF + +./configure + +$MAKE all +if cross_compiling; then :; else + ./foo + ./zardoz + ./zardoz | grep 'Hello, W@rld!' +fi + +$MAKE distcheck + +: diff --cc t/suffix-hdr.sh index 67c7034c6,000000000..aced454a8 mode 100755,000000..100755 --- a/t/suffix-hdr.sh +++ b/t/suffix-hdr.sh @@@ -1,82 -1,0 +1,82 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Use of "custom" headers (with custom suffix). + +required='cc native' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_PROGRAMS = zardoz +nodist_zardoz_SOURCES = foo.c +EXTRA_DIST = bar.my-h foo.my-c +BUILT_SOURCES = bar.h +%.c: %.my-c + sed 's/INTEGER/int/' $< >$@ +%.h: %.my-h + sed 's/SUBSTITUTE/#define/' $< >$@ +CLEANFILES = $(nodist_zardoz_SOURCES) $(BUILT_SOURCES) +END + +cat > foo.my-c << 'END' +#include "bar.h" +INTEGER main (void) +{ + printf ("Hello, %s!\n", PLANET); + return 0; +} +END + +cat > bar.my-h << 'END' +#include +SUBSTITUTE PLANET "Mars" +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure --enable-dependency-tracking + +$MAKE +./zardoz +test "$(./zardoz)" = 'Hello, Mars!' + +$sleep +$PERL -npi -e 's/\bMars\b/Jupiter/' bar.my-h + +$MAKE +./zardoz +test "$(./zardoz)" = 'Hello, Jupiter!' + +$MAKE distdir +test -f $distdir/foo.my-c +test -f $distdir/bar.my-h +test ! -f $distdir/foo.c +test ! -f $distdir/bar.h + +$MAKE clean +test ! -f foo.c +test ! -f bar.h + +$MAKE distcheck + +: diff --cc t/suffix-obj.sh index 41d70eec7,7500543d1..38bf38faa --- a/t/suffix-obj.sh +++ b/t/suffix-obj.sh @@@ -15,8 -15,9 +15,8 @@@ # along with this program. If not, see . # Test to make sure that '.o' and '.obj' are handled like '.$(OBJEXT)'. -# See also related "grepping" test suffix6.test. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' # $(LINK) is not defined automatically by Automake, since the *_SOURCES diff --cc t/suffix-rules-old-fashioned.sh index 8de64ce54,d9db4aad1..c0dd3d5dc --- a/t/suffix-rules-old-fashioned.sh +++ b/t/suffix-rules-old-fashioned.sh @@@ -14,11 -14,16 +14,11 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure libtool clean targets exist. -# Report from Eric Magnien. +# Automake-NG still accepts old-fashioned suffix rules. - . ./defs || Exit 1 -required=libtoolize + . ./defs || exit 1 cat >> configure.ac << 'END' -AC_PROG_CC -AM_PROG_AR -AC_PROG_LIBTOOL AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT END diff --cc t/suffix10.sh index 243ed2331,a65092415..6f95391c9 --- a/t/suffix10.sh +++ b/t/suffix10.sh @@@ -19,8 -18,10 +19,8 @@@ # (related to PR/37) required='cc libtoolize yacc' - . ./defs || Exit 1 + . ./defs || exit 1 -plan_ 7 - cat >>configure.ac <. -# Tests that Automake understands suffix rules with renamed objects -# and subdir objects. -# Reported by Florian Briegel. +# Tests that Automake understands suffix-based pattern rules with +# renamed objects and subdir objects. Reported by Florian Briegel. required=cc - . ./defs || Exit 1 + . ./defs || exit 1 cat >>configure.ac <. -# Make sure proper suffix rules for C compilation are produced, +# Make sure proper pattern rules for C compilation are produced, # and only once, even for libtool libraries. # See also related test 'suffix.test'. -required=libtoolize - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/suffix3.sh index bdf22cd59,000000000..f569c528c mode 100755,000000..100755 --- a/t/suffix3.sh +++ b/t/suffix3.sh @@@ -1,69 -1,0 +1,69 @@@ +#! /bin/sh +# Copyright (C) 1999-2012 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 that suffix rules chain. + +required=c++ - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CXX +AC_OUTPUT +END + +cat > Makefile.am << 'END' +%.cc: %.zoo + sed 's/INTEGER/int/g' $< >$@ +bin_PROGRAMS = zardoz +nodist_zardoz_SOURCES = foo.cc +EXTRA_DIST = foo.zoo +CLEANFILES = foo.cc +END + +$ACLOCAL +$AUTOMAKE + +# Automake has been clearly told that foo.zoo is eventually transformed +# into foo.o, and to use this latter file (to link foo). +$FGREP 'foo.$(OBJEXT)' Makefile.in +# Finally, our dummy package doesn't use C in any way, so it the +# Makefile shouldn't contain stuff related to the C compiler. - $FGREP '$(LINK)' Makefile.in && Exit 1 - $FGREP 'AM_CFLAGS' Makefile.in && Exit 1 - $FGREP '$(CFLAGS)' Makefile.in && Exit 1 - $FGREP '$(CC)' Makefile.in && Exit 1 ++$FGREP '$(LINK)' Makefile.in && exit 1 ++$FGREP 'AM_CFLAGS' Makefile.in && exit 1 ++$FGREP '$(CFLAGS)' Makefile.in && exit 1 ++$FGREP '$(CC)' Makefile.in && exit 1 + + +$AUTOCONF +./configure + +# This is deliberately valid C++, but invalid C. +cat > foo.zoo <<'END' +using namespace std; +INTEGER main (void) +{ + return 0; +} +END + +$MAKE all +$MAKE distcheck + +# Intermediate files should not be distributed. +$MAKE distdir +test ! -r $me-1.0/foo.cc + +: diff --cc t/suffix8.sh index f4920ea47,fdaf08714..30bb6e4c2 --- a/t/suffix8.sh +++ b/t/suffix8.sh @@@ -19,8 -19,10 +19,8 @@@ # From PR/37. required='cc libtoolize' - . ./defs || Exit 1 + . ./defs || exit 1 -plan_ 10 - cat >>configure.ac <<'END' AM_PROG_AR AM_PROG_LIBTOOL diff --cc t/tap-autonumber.sh index 7c6aed0b7,abc4ec8c0..74f7facbb --- a/t/tap-autonumber.sh +++ b/t/tap-autonumber.sh @@@ -44,7 -44,7 +44,7 @@@ not o ok END - $MAKE check TESTS=all.test >stdout && { cat stdout; Exit 1; } -TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE check TESTS=all.test >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=14 pass=6 fail=5 xpass=1 xfail=1 skip=1 error=0 diff --cc t/tap-bailout-leading-space.sh index cfa6eeee2,d0d3096a4..2612cd24a --- a/t/tap-bailout-leading-space.sh +++ b/t/tap-bailout-leading-space.sh @@@ -50,7 -50,8 +50,7 @@@ ERROR: b.test - Bail out ERROR: c.test - Bail out! FUBAR! END - $MAKE TESTS='a.test b.test c.test' check >stdout && { cat stdout; Exit 1; } -TESTS='a.test b.test c.test' $MAKE -e check >stdout \ - && { cat stdout; exit 1; } ++$MAKE TESTS='a.test b.test c.test' check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3 diff --cc t/tap-bailout-suppress-later-errors.sh index f9f0062d2,cd9aa146b..50739590c --- a/t/tap-bailout-suppress-later-errors.sh +++ b/t/tap-bailout-suppress-later-errors.sh @@@ -52,8 -52,8 +52,8 @@@ ok ok 3 END -TESTS='foo.test bar.test baz.test' $MAKE -e check >stdout \ +$MAKE TESTS='foo.test bar.test baz.test' check >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3 diff --cc t/tap-bailout.sh index d07d6c324,91dfd2442..d8c606507 --- a/t/tap-bailout.sh +++ b/t/tap-bailout.sh @@@ -118,8 -118,8 +118,8 @@@ echo "ERROR: e.test - Bail out!" >> ex # Doing the sums above, we have: test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5' -TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \ +$MAKE TESTS='a.test b.test c.test d.test e.test' check >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout count_test_results $test_counts diff --cc t/tap-basic.sh index ad67f6524,b3b79de89..cf923002a --- a/t/tap-basic.sh +++ b/t/tap-basic.sh @@@ -134,7 -127,7 +134,7 @@@ Bail out ok 1 END - $MAKE TESTS=bail.test check >stdout && { cat stdout; Exit 1; } -TESTS=bail.test $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TESTS=bail.test check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1 @@@ -144,16 -137,16 +144,16 @@@ test -f bail.lo test -f test-suite.log grep '^ERROR: bail\.test - Bail out!' stdout - grep '^PASS:' stdout && Exit 1 + grep '^PASS:' stdout && exit 1 test $($FGREP -c ': bail.test' stdout) -eq 1 - $FGREP 'success.test' stdout && Exit 1 + $FGREP 'success.test' stdout && exit 1 -# Override TEST_LOGS from the command line, making it point to a test +# Override TESTS from the command line, making it point to a test # (ok.test) that has to be generated at make time. rm -f *.log *.test - $MAKE TESTS=ok check >stdout || { cat stdout; Exit 1; } -TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE TESTS=ok check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0 diff --cc t/tap-color.sh index 6773b2800,2fa45d184..f60cc57b8 --- a/t/tap-color.sh +++ b/t/tap-color.sh @@@ -117,22 -117,48 +117,22 @@@ test_color ( test_no_color () { - # With make implementations that, like Solaris make, in case of errors - # print the whole failing recipe on standard output, we should content - # ourselves with a laxer check, to avoid false positives. - # Keep this in sync with lib/am/check.am:$(am__color_tests). - if $FGREP '= Xalways; then' stdout; then - # Extra verbose make, resort to laxer checks. - # But we also want to check that the testsuite summary is not unduly - # colorized. - ( - set +e # In case some grepped regex below isn't matched. - # Not a useless use of cat; see above comments "grep-nonprinting" - # requirement in 'test-init.sh'. - cat stdout | grep "TOTAL.*:" - cat stdout | grep "PASS.*:" - cat stdout | grep "FAIL.*:" - cat stdout | grep "SKIP.*:" - cat stdout | grep "XFAIL.*:" - cat stdout | grep "XPASS.*:" - cat stdout | grep "ERROR.*:" - cat stdout | grep "^#" - cat stdout | grep 'test.*expected' - cat stdout | grep 'test.*not run' - cat stdout | grep '====' - cat stdout | grep '[Ss]ee .*test-suite\.log' - cat stdout | grep '[Tt]estsuite summary' - ) | grep "$esc" && exit 1 - : For shells with broken 'set -e' - else - cat stdout | grep "$esc" && exit 1 - : For shells with broken 'set -e' - fi + # Not a useless use of cat; see above comments "grep-nonprinting" + # requirement in 'test-init.sh'. - cat stdout | grep "$esc" && Exit 1 - : ++ cat stdout | grep "$esc" && exit 1 ++ : For 'set -e'. } +# It should be possible to override AM_COLOR_TESTS also from the +# environment. # Forced colorization should take place also with non-ANSI terminals; # hence the "TERM=dumb" definition. --TERM=dumb AM_COLOR_TESTS=always $MAKE check >stdout \ - && { cat stdout; Exit 1; } ++AM_COLOR_TESTS=always $MAKE TERM=dumb check >stdout \ + && { cat stdout; exit 1; } cat stdout test_color - $MAKE check TERM=ansi >stdout && { cat stdout; Exit 1; } -TERM=ansi $MAKE -e check >stdout \ - && { cat stdout; exit 1; } ++$MAKE check TERM=ansi >stdout && { cat stdout; exit 1; } cat stdout test_no_color diff --cc t/tap-common-setup.sh index f76ce3b08,6bf168e1a..32a474a4f --- a/t/tap-common-setup.sh +++ b/t/tap-common-setup.sh @@@ -16,9 -16,11 +16,9 @@@ # Auxiliary test to set up common data used by many tests on TAP support. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac << END -AC_OUTPUT -END +echo AC_OUTPUT >> configure.ac cat > Makefile.am << 'END' TEST_LOG_DRIVER = $(srcdir)/tap-driver diff --cc t/tap-deps.sh index 9e52b79bc,ee76e938f..60997b466 --- a/t/tap-deps.sh +++ b/t/tap-deps.sh @@@ -17,10 -17,10 +17,10 @@@ # Basic TAP test protocol support: # - dependencies between test scripts - . ./defs || Exit 1 + . ./defs || exit 1 cat > Makefile.am << 'END' -# The tests are *deliberately* listed in inversed order here. +# The tests are *deliberately* listed in inverted order here. TESTS = c.test b.test a.test b.log: a.log c.log: b.log diff --cc t/tap-diagnostic.sh index 058757cdf,10b4f5b01..340d69a33 --- a/t/tap-diagnostic.sh +++ b/t/tap-diagnostic.sh @@@ -52,9 -52,9 +52,9 @@@ PASS: all.test 4 - zardo # all.test: Shell metacharacters here: $metacharacters END - $MAKE check >stdout || { cat stdout; Exit 1; } + $MAKE check >stdout || { cat stdout; exit 1; } cat stdout - $EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1 -$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1 ++$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1 count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0 echo 'AM_TEST_LOG_DRIVER_FLAGS = --comments' >> Makefile @@@ -66,10 -66,10 +66,10 @@@ cat go diff exp got count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0 -TEST_LOG_DRIVER_FLAGS="--no-comments" $MAKE -e check >stdout \ +$MAKE check TEST_LOG_DRIVER_FLAGS="--no-comments" >stdout \ - || { cat stdout; Exit 1; } + || { cat stdout; exit 1; } cat stdout - $EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1 -$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1 ++$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1 count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0 # The "#"-prepended lines here shouldn't be parsed as test results. diff --cc t/tap-doc2.sh index f42a687a7,c2f0fa3f4..9ce91c6c0 --- a/t/tap-doc2.sh +++ b/t/tap-doc2.sh @@@ -78,7 -80,10 +78,7 @@@ cp "$am_scriptdir"/tap-driver.sh build- case $MAKE in *\ -j*) skip_ "can't work easily with concurrent make";; esac - $MAKE check >stdout && { cat stdout; Exit 1; } -# Prevent Sun Distributed Make from trying to run in parallel. -DMAKE_MODE=serial; export DMAKE_MODE - + $MAKE check >stdout && { cat stdout; exit 1; } cat stdout cat > exp <<'END' @@@ -101,10 -106,10 +101,10 @@@ diff exp go grep '^Please report to bug-automake@gnu\.org$' stdout -env \ +$MAKE check \ TESTS='foo.test baz.test' \ TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \ - > stdout || { cat stdout; Exit 1; } - $MAKE -e check >stdout || { cat stdout; exit 1; } ++ > stdout || { cat stdout; exit 1; } cat > exp <<'END' PASS: foo.test 1 - Swallows fly diff --cc t/tap-global-log.sh index 3d4663ce8,85db2cb34..9fd851e20 --- a/t/tap-global-log.sh +++ b/t/tap-global-log.sh @@@ -102,10 -102,10 +102,10 @@@ cat > skipall.test << 'END END # We don't care about the exit status of "make check" here. -TESTS="$(echo *.test)" $MAKE -e check || : +$MAKE TESTS="$(echo *.test)" check || : cat test-suite.log - grep ':.*ok|not seen' test-suite.log && Exit 1 + grep ':.*ok|not seen' test-suite.log && exit 1 for s in skip todo fail xpass bail error; do $FGREP "::$s::" test-suite.log diff --cc t/tap-global-result.sh index e5ca64b56,ba232c3b3..9d695648e --- a/t/tap-global-result.sh +++ b/t/tap-global-result.sh @@@ -140,7 -140,7 +140,7 @@@ EN tests=$(echo *.test) # Also required later. - $MAKE TESTS="$tests" check >stdout && { cat stdout; Exit 1; } -TESTS="$tests" $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TESTS="$tests" check >stdout && { cat stdout; exit 1; } cat stdout # Dirty trick required here. @@@ -149,7 -149,7 +149,7 @@@ for tst in $(echo " $tests " | sed 's/\ done rm -f test-suite.log - $MAKE TESTS="$tests" test-suite.log && Exit 1 -TESTS="$tests" $MAKE -e test-suite.log && exit 1 ++$MAKE TESTS="$tests" test-suite.log && exit 1 cat test-suite.log have_rst_section () diff --cc t/tap-lazy-check.sh index 408646a85,e774f7310..44befac01 --- a/t/tap-lazy-check.sh +++ b/t/tap-lazy-check.sh @@@ -14,9 -14,10 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# TAP support: -# - RECHECK_LOGS +# TAP support: AM_LAZY_CHECK - . ./defs || Exit 1 + . ./defs || exit 1 cat > Makefile.am << 'END' TEST_LOG_COMPILER = cat @@@ -57,14 -58,14 +57,14 @@@ grep_summary ( grep '^# ERROR: *1$' stdout } - $MAKE check && Exit 1 -$MAKE -e check && exit 1 ++$MAKE check && exit 1 test -f foo.log test -f bar.log test -f baz.log rm -f foo.log bar.log - $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; } cat stdout test -f foo.log test -f bar.log @@@ -79,7 -80,7 +79,7 @@@ touch foo.tes # We re-run only a successful test, but the tests that failed in the # previous run should still be taken into account, and cause an overall # failure. - $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; } cat stdout grep '^PASS: foo\.test 1$' stdout grep '^PASS: foo\.test 2$' stdout @@@ -89,18 -90,29 +89,18 @@@ grep_summar $sleep touch zardoz - $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; } cat stdout grep '^ERROR: baz\.test' stdout - $EGREP '(foo|bar)\.test' stdout && Exit 1 + $EGREP '(foo|bar)\.test' stdout && exit 1 is_newest baz.log zardoz grep_summary # Now, explicitly retry with all test logs already updated, and ensure # that the summary is still displayed. - $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; } -env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; } ++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; } cat stdout - $EGREP '(foo|bar|baz)\.test' stdout && Exit 1 + $EGREP '(foo|bar|baz)\.test' stdout && exit 1 grep_summary -# The following should re-run foo.test (and only foo.test), even if its -# log file is up-to-date. -: > older -env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; } -cat stdout -grep '^PASS: foo\.test 1$' stdout -grep '^PASS: foo\.test 2$' stdout -grep 'ba[rz]\.test' stdout && exit 1 -is_newest foo.log older -grep_summary - : diff --cc t/tap-log.sh index c5bcf0c88,4a4f7e6bf..d5f113ed3 --- a/t/tap-log.sh +++ b/t/tap-log.sh @@@ -85,7 -85,7 +85,7 @@@ EN chmod a+x *.test - $MAKE check TEST_SUITE_LOG=my.log && Exit 1 -TEST_SUITE_LOG=my.log $MAKE -e check && exit 1 ++$MAKE check TEST_SUITE_LOG=my.log && exit 1 ls -l # For debugging. test ! -f test-suite.log test ! -f global.log diff --cc t/tap-merge-stdout-stderr.sh index 6b9995a40,1fe4b8563..38a5f74b8 --- a/t/tap-merge-stdout-stderr.sh +++ b/t/tap-merge-stdout-stderr.sh @@@ -60,8 -60,8 +60,8 @@@ count_test_results total=2 pass=1 fail= # See that the option '--no-merge' can override the effect of '--merge'. -TEST_LOG_DRIVER_FLAGS=--no-merge $MAKE -e check >stdout \ +$MAKE check TEST_LOG_DRIVER_FLAGS=--no-merge >stdout \ - || { cat stdout; Exit 1; } + || { cat stdout; exit 1; } cat stdout count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0 diff --cc t/tap-msg0-bailout.sh index 09b232f2f,cf8918c74..2faf679f5 --- a/t/tap-msg0-bailout.sh +++ b/t/tap-msg0-bailout.sh @@@ -26,7 -26,7 +26,7 @@@ echo 'Bail out! 0' > a.test echo 'Bail out! 0.0' > b.test - $MAKE TESTS='a.test b.test' check >stdout && { cat stdout; Exit 1; } -TESTS='a.test b.test' $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TESTS='a.test b.test' check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=2 diff --cc t/tap-msg0-planskip.sh index c965ab243,7602affb1..7502a462a --- a/t/tap-msg0-planskip.sh +++ b/t/tap-msg0-planskip.sh @@@ -25,7 -25,7 +25,7 @@@ echo '1..0 # SKIP 0' > a.test echo '1..0 # SKIP 0.0' > b.test - $MAKE TESTS='a.test b.test' check >stdout || { cat stdout; Exit 1; } -TESTS='a.test b.test' $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE TESTS='a.test b.test' check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0 diff --cc t/tap-out-of-order.sh index eec90b3ec,e884a1e07..0e3ffb203 --- a/t/tap-out-of-order.sh +++ b/t/tap-out-of-order.sh @@@ -57,8 -57,8 +57,8 @@@ ok 1 ok 17 END -TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \ +$MAKE TESTS='a.test b.test c.test d.test' check >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8 diff --cc t/tap-passthrough-exit.sh index a39725225,7b800d5bc..617f89cdd --- a/t/tap-passthrough-exit.sh +++ b/t/tap-passthrough-exit.sh @@@ -52,7 -52,7 +52,7 @@@ for e in $exit_statuses; d done done -env TEST_LOG_DRIVER_FLAGS='--ignore-exit' $MAKE -e check +$MAKE check TEST_LOG_DRIVER_FLAGS='--ignore-exit' - $FGREP ".test - exited with status" *.log && Exit 1 + $FGREP ".test - exited with status" *.log && exit 1 : diff --cc t/tap-passthrough.sh index 77bb2f0d9,993e750e8..380548f27 --- a/t/tap-passthrough.sh +++ b/t/tap-passthrough.sh @@@ -46,7 -46,7 +46,7 @@@ ok # SKIP who cares $weirdchars END - $MAKE TESTS=ok.test check || { cat ok.log; Exit 1; } -TESTS=ok.test $MAKE -e check || { cat ok.log; exit 1; } ++$MAKE TESTS=ok.test check || { cat ok.log; exit 1; } cat ok.log for rx in \ diff --cc t/tap-plan-corner.sh index fcd26a5b5,86ba401e8..044258e38 --- a/t/tap-plan-corner.sh +++ b/t/tap-plan-corner.sh @@@ -36,8 -36,8 +36,8 @@@ ok END for pos in leading trailing; do - TESTS="$pos-repeated.test" $MAKE -e check >stdout \ + $MAKE TESTS="$pos-repeated.test" check >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1 grep "^ERROR: $pos-repeated\\.test - multiple test plans$" stdout @@@ -59,8 -59,8 +59,8 @@@ ok 1..2 END -env TESTS="leading-repeated.test trailing-repeated.test" \ - $MAKE -e check >stdout && { cat stdout; exit 1; } +$MAKE TESTS="leading-repeated.test trailing-repeated.test" check >stdout \ - && { cat stdout; Exit 1; } ++ && { cat stdout; exit 1; } cat stdout count_test_results total=6 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=3 grep "^ERROR: leading-repeated\\.test - multiple test plans$" stdout @@@ -90,8 -90,8 +90,8 @@@ cat > 4.test <stdout && { cat stdout; exit 1; } +$MAKE TESTS="1.test 2.test 3.test 4.test" check >stdout \ - && { cat stdout; Exit 1; } ++ && { cat stdout; exit 1; } cat stdout count_test_results total=8 pass=0 fail=0 xpass=0 xfail=0 skip=4 error=4 for i in 1 2 3 4; do @@@ -112,7 -112,7 +112,7 @@@ ok ok 5 END - $MAKE check >stdout && { cat stdout; Exit 1; } -$MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=8 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=3 @@@ -143,7 -143,7 +143,7 @@@ ok ok 3 END - $MAKE check >stdout && { cat stdout; Exit 1; } -$MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=5 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=3 @@@ -174,7 -174,7 +174,7 @@@ ok ok 5 END - $MAKE check >stdout && { cat stdout; Exit 1; } -$MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=7 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=4 diff --cc t/tap-plan-leading-zero.sh index a3b78a5c5,84047a664..ce6477db1 --- a/t/tap-plan-leading-zero.sh +++ b/t/tap-plan-leading-zero.sh @@@ -47,8 -47,8 +47,8 @@@ done >> d.tes echo 1..00 > e.test echo '1..000 # SKIP' > f.test -env TESTS='a.test b.test c.test d.test e.test f.test' \ - $MAKE -e check >stdout || { cat stdout; exit 1; } +$MAKE TESTS='a.test b.test c.test d.test e.test f.test' check >stdout \ - || { cat stdout; Exit 1; } ++ || { cat stdout; exit 1; } cat stdout count_test_results total=115 pass=113 xfail=0 skip=2 fail=0 xpass=0 error=0 diff --cc t/tap-plan-malformed.sh index 274b07c85,68a0f474f..b89aa9409 --- a/t/tap-plan-malformed.sh +++ b/t/tap-plan-malformed.sh @@@ -47,7 -47,7 +47,7 @@@ EN tests_list=$(echo *.test) - $MAKE TESTS="$tests_list" check >stdout && { cat stdout; Exit 1; } -TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TESTS="$tests_list" check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=9 pass=2 fail=0 xpass=0 xfail=2 skip=0 error=5 diff --cc t/tap-plan-middle.sh index b3b2cef77,77f16a74a..253862340 --- a/t/tap-plan-middle.sh +++ b/t/tap-plan-middle.sh @@@ -73,8 -73,8 +73,8 @@@ EN tests=$(echo *.test) for tap_flags in "" "--comments"; do - env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \ - $MAKE -e check >stdout || { cat stdout; exit 1; } + $MAKE check TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" >stdout \ - || { cat stdout; Exit 1; } ++ || { cat stdout; exit 1; } cat stdout count_test_results total=12 pass=7 xfail=2 skip=3 fail=0 xpass=0 error=0 done diff --cc t/tap-plan-whitespace.sh index b1c1f2f93,106cad078..122ff2f08 --- a/t/tap-plan-whitespace.sh +++ b/t/tap-plan-whitespace.sh @@@ -32,7 -32,7 +32,7 @@@ cat > bar.test <stdout || { cat stdout; Exit 1; } -TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=3 pass=3 fail=0 error=0 xpass=0 xfail=0 skip=0 diff --cc t/tap-plan.sh index 5a707fa47,40fc8c30d..810625191 --- a/t/tap-plan.sh +++ b/t/tap-plan.sh @@@ -41,8 -41,8 +41,8 @@@ o END for tap_flags in "" "--comments"; do - env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS='top.test bot.test' \ - $MAKE -e check >stdout || { cat stdout; exit 1; } + $MAKE TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="top.test bot.test" \ - check >stdout || { cat stdout; Exit 1; } ++ check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=7 pass=5 xfail=1 skip=1 fail=0 xpass=0 error=0 done diff --cc t/tap-planskip-and-logging.sh index ce7912949,7c1e017b9..3b999d1b6 --- a/t/tap-planskip-and-logging.sh +++ b/t/tap-planskip-and-logging.sh @@@ -45,8 -45,8 +45,8 @@@ an early non-TAP lin a later non-TAP line END -TESTS='foo.test foo2.test bar.test' $MAKE -e check >stdout \ +$MAKE TESTS='foo.test foo2.test bar.test' check >stdout \ - || { cat stdout; Exit 1; } + || { cat stdout; exit 1; } cat stdout count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=3 error=0 diff --cc t/tap-planskip-case-insensitive.sh index f278e3d4c,a67712b8d..61f1ea0c4 --- a/t/tap-planskip-case-insensitive.sh +++ b/t/tap-planskip-case-insensitive.sh @@@ -32,7 -32,7 +32,7 @@@ for c4 in p P; d echo "1..0 # $c1$c2$c3$c4 foobar" > $j.test done; done; done; done - $MAKE TESTS="$(echo *.test)" check >stdout || { cat stdout; Exit 1; } -TESTS="$(echo *.test)" $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE TESTS="$(echo *.test)" check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0 diff --cc t/tap-planskip-late.sh index 6f73bc2e7,af337336a..50d74a925 --- a/t/tap-planskip-late.sh +++ b/t/tap-planskip-late.sh @@@ -32,7 -32,7 +32,7 @@@ cat > bar.test <stdout || { cat stdout; Exit 1; } -TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; } cat stdout grep '^SKIP: foo\.test .* from the last line$' stdout diff --cc t/tap-planskip-unplanned-corner.sh index bebd39877,2ce46863c..98dd349be --- a/t/tap-planskip-unplanned-corner.sh +++ b/t/tap-planskip-unplanned-corner.sh @@@ -32,7 -32,7 +32,7 @@@ ok 1 # SKI 1..0 # SKIP END - $MAKE TESTS='foo.test bar.test' check >stdout && { cat stdout; Exit 1; } -TESTS='foo.test bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TESTS='foo.test bar.test' check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=3 diff --cc t/tap-planskip-whitespace.sh index 582291123,d9c54963e..ca29d1ab3 --- a/t/tap-planskip-whitespace.sh +++ b/t/tap-planskip-whitespace.sh @@@ -34,8 -34,8 +34,8 @@@ cat > baz.test < stdout \ +$MAKE TESTS='foo.test bar.test baz.test' check > stdout \ - || { cat stdout; Exit 1; } + || { cat stdout; exit 1; } cat stdout count_test_results total=3 pass=0 fail=0 error=0 xpass=0 xfail=0 skip=3 diff --cc t/tap-planskip.sh index b76224537,9e6704b28..b160e4858 --- a/t/tap-planskip.sh +++ b/t/tap-planskip.sh @@@ -56,8 -56,8 +56,8 @@@ cat > mu.test <stdout || { cat stdout; exit 1; } +$MAKE TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \ - check >stdout || { cat stdout; Exit 1; } ++ check >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0 diff --cc t/tap-test-number-0.sh index 7eb5e2ef0,c085da0c9..e611edcc1 --- a/t/tap-test-number-0.sh +++ b/t/tap-test-number-0.sh @@@ -70,8 -70,8 +70,8 @@@ cat > e.test <stdout \ +$MAKE TESTS='a.test b.test c.test d.test e.test' check >stdout \ - && { cat stdout; Exit 1; } + && { cat stdout; exit 1; } cat stdout count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=5 diff --cc t/tap-unplanned.sh index ac7a266cd,e00e4b89a..262c8012f --- a/t/tap-unplanned.sh +++ b/t/tap-unplanned.sh @@@ -53,7 -53,7 +53,7 @@@ ok not ok 4 ok 5 # SKIP END - $MAKE XFAIL_TESTS=all.test check >stdout && { cat stdout; Exit 1; } -XFAIL_TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE XFAIL_TESTS=all.test check >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4 grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdout diff --cc t/test-driver-custom-multitest-recheck2.sh index 00be33d60,eab6aacc8..fa5feee9a --- a/t/test-driver-custom-multitest-recheck2.sh +++ b/t/test-driver-custom-multitest-recheck2.sh @@@ -16,10 -16,12 +16,10 @@@ # Custom test drivers: try the "recheck" functionality with test protocols # that allow multiple testcases in a single test script. In particular, -# check that this still works when we override $(TESTS) and $(TEST_LOGS) -# at make runtime. -# See also related tests 'test-driver-custom-multitest-recheck.test' and -# 'parallel-tests-recheck-override.test'. +# check that this still works when we override $(TESTS) at make runtime. +# See also related tests 'test-driver-custom-multitest-recheck.test'. - . ./defs || Exit 1 + . ./defs || exit 1 cp "$am_testauxdir"/trivial-test-driver . \ || fatal_ "failed to fetch auxiliary script trivial-test-driver" @@@ -67,9 -69,9 +67,10 @@@ chmod a+x *.tes $ACLOCAL $AUTOCONF -$AUTOMAKE +$AUTOMAKE -a for vpath in : false; do ++ if $vpath; then mkdir build cd build @@@ -91,16 -93,20 +92,16 @@@ rm -f *.run - : An empty '$(TESTS)' or '$(TEST_LOGS)' means that no test should be run. - for var in TESTS TEST_LOGS; do - env "$var=" $MAKE -e recheck >stdout || { cat stdout; exit 1; } - cat stdout - count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0 - test ! -r a.run - test ! -r b.run - test ! -r c.run - done - unset var + : An empty '$(TESTS)' means that no test should be run. - $MAKE TESTS= recheck >stdout || { cat stdout; Exit 1; } ++ $MAKE TESTS= recheck >stdout || { cat stdout; exit 1; } + cat stdout + count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0 + test ! -r a.run + test ! -r b.run + test ! -r c.run : a.test was successful the first time, no need to re-run it. - $MAKE TESTS=a.test recheck >stdout || { cat stdout; Exit 1; } - env TESTS=a.test $MAKE -e recheck >stdout \ - || { cat stdout; exit 1; } ++ $MAKE TESTS=a.test recheck >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0 test ! -r a.run @@@ -109,7 -115,8 +110,7 @@@ : b.test failed, it should be re-run. And make it pass this time. echo OK > b.ok - $MAKE TESTS=b recheck >stdout || { cat stdout; Exit 1; } - TEST_LOGS=b.log $MAKE -e recheck >stdout \ - || { cat stdout; exit 1; } ++ $MAKE TESTS=b recheck >stdout || { cat stdout; exit 1; } cat stdout test ! -r a.run test -f b.run @@@ -119,13 -126,15 +120,13 @@@ rm -f *.run : No need to re-run a.test or b.test anymore. - $MAKE TESTS=b recheck >stdout || { cat stdout; Exit 1; } - TEST_LOGS=b.log $MAKE -e recheck >stdout \ - || { cat stdout; exit 1; } ++ $MAKE TESTS=b recheck >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0 test ! -r a.run test ! -r b.run test ! -r c.run - $MAKE TESTS='a.test b.test' recheck >stdout || { cat stdout; Exit 1; } - TESTS='a.test b.test' $MAKE -e recheck >stdout \ - || { cat stdout; exit 1; } ++ $MAKE TESTS='a.test b.test' recheck >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0 test ! -r a.run @@@ -138,7 -147,8 +139,7 @@@ # Use 'echo' here, since Solaris 10 /bin/sh would try to optimize # a ':' away after the first iteration, even if it is redirected. echo dummy > c.err - $MAKE TESTS='a.test c' recheck >stdout && { cat stdout; Exit 1; } - env TEST_LOGS='a.log c.log' $MAKE -e recheck >stdout \ - && { cat stdout; exit 1; } ++ $MAKE TESTS='a.test c' recheck >stdout && { cat stdout; exit 1; } cat stdout count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1 test ! -r a.run @@@ -151,7 -161,8 +152,7 @@@ : This time, make it pass # Use 'echo', not ':'; see comments above for why. echo dummy > c.ok - $MAKE TESTS='c.test a.test' recheck >stdout || { cat stdout; Exit 1; } - env TESTS='c.test a.test' $MAKE -e recheck >stdout \ - || { cat stdout; exit 1; } ++ $MAKE TESTS='c.test a.test' recheck >stdout || { cat stdout; exit 1; } cat stdout count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0 test ! -r a.run diff --cc t/test-driver-custom-multitest.sh index ed65c2996,da8a88fc9..8d5c31a20 --- a/t/test-driver-custom-multitest.sh +++ b/t/test-driver-custom-multitest.sh @@@ -167,8 -158,8 +167,8 @@@ for vpath in : false; d grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log test $(grep -c '%% ' test-suite.log) -eq 4 - TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \ + $MAKE TESTS='pass.t pass3-skip2-xfail.t' check >stdout \ - || { cat stdout; cat test-suite.log; Exit 1; } + || { cat stdout; cat test-suite.log; exit 1; } cat test-suite.log cat stdout count_test_results total=7 pass=4 fail=0 skip=2 xfail=1 xpass=0 error=0 diff --cc t/test-extensions-cond.sh index d7f78db5f,dda019333..73f617b70 --- a/t/test-extensions-cond.sh +++ b/t/test-extensions-cond.sh @@@ -14,24 -14,22 +14,24 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Expose bug in conditional definition of TEST_EXTENSIONS. +# Conditional definition of TEST_EXTENSIONS is supported. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' -AM_CONDITIONAL([COND], [:]) -AM_CONDITIONAL([COND2], [:]) +AC_CONFIG_FILES([sub/Makefile]) +AM_CONDITIONAL([COND1], [test x"$cond1" = x"yes"]) +AM_CONDITIONAL([COND2], [test x"$cond2" = x"yes"]) +AC_OUTPUT END -$ACLOCAL +mkdir sub -cat > 1.am << 'END' -TESTS = -if COND -## lineno 4 -TEST_EXTENSIONS = .foo +cat > Makefile.am << 'END' +SUBDIRS = sub +TESTS = foo.sh bar.test +if COND1 +TEST_EXTENSIONS = .sh endif END diff --cc t/test-extensions-dynamic.sh index e2dbc7d33,000000000..b04dccab1 mode 100755,000000..100755 --- a/t/test-extensions-dynamic.sh +++ b/t/test-extensions-dynamic.sh @@@ -1,94 -1,0 +1,94 @@@ +#! /bin/sh +# Copyright (C) 2012 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_EXTENSIONS with contents dynamically determined at make time + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_SUBST([suf], [.tap]) +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +END + +mkdir sub + +cat > Makefile.am << 'END' +SUBDIRS = sub +TESTS = foo.sh bar.test baz.t1 mu.t1.t2 zardoz.tap +TEST_EXTENSIONS = .test @suf@ $(foreach i,1 2,.t$(i)) +TEST_EXTENSIONS += $(subst &,.,$(call am__tolower,&SH)) +END + +cat > sub/Makefile.am << 'END' +TESTS = 1.sh 2.bar 3 +TEST_EXTENSIONS = $(suffix $(TESTS)) +END + +cat > foo.sh << 'END' +#!/bin/sh +exit 0 +END +chmod a+x foo.sh + +cp foo.sh bar.test +cp foo.sh baz.t1 +cp foo.sh mu.t1.t2 +cp foo.sh zardoz.tap +cp foo.sh sub/1.sh +cp foo.sh sub/2.bar +cp foo.sh sub/3 + +do_setup () +{ + $MAKE check ${1+"$@"} + ls -l . sub +} + +do_clean () +{ + $MAKE clean + test "$(find . -name '*.log')" = ./config.log +} + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a +./configure + +do_setup +test -f foo.log +test -f bar.log +test -f baz.log +test -f mu.t1.log +test -f zardoz.log +test -f sub/1.log +test -f sub/2.log +test -f sub/3.log + +do_clean + +do_setup TEST_EXTENSIONS='.sh .t2 $(subst o,e,.tost) ${suf}' +test -f foo.log +test -f bar.log +test -f baz.t1.log +test -f mu.t1.log +test -f zardoz.log +test -f sub/1.log +test -f sub/2.bar.log +test -f sub/3.log + +: diff --cc t/test-extensions-funny-chars.sh index e016112cb,000000000..5abc31d07 mode 100755,000000..100755 --- a/t/test-extensions-funny-chars.sh +++ b/t/test-extensions-funny-chars.sh @@@ -1,132 -1,0 +1,132 @@@ +#! /bin/sh +# Copyright (C) 2011-2012 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 Automake can handle "funny chars" in TEST_EXTENSIONS, +# as long as they can be used in GNU make variable names. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +fetch_tap_driver + +echo AC_OUTPUT >> configure.ac + +cat >> Makefile.am <<'END' +TEST_EXTENSIONS = .@ .2 .f-o-o .l!Nu.x +TESTS = foo.@ bar.f-o-o baz.2 zardoz.l!Nu.x +XFAIL_TESTS = zardoz.l!Nu.x +@_LOG_COMPILER = $(SHELL) +2_LOG_COMPILER = $(SHELL) +F-O-O_LOG_DRIVER = $(srcdir)/tap-driver +L!NU.X_LOG_COMPILER = false +EXTRA_DIST = $(TESTS) tap-driver +END + +touch foo.@ bar.f-o-o zardoz.l!Nu.x \ + || skip_ "your file system doesn't support funny characters" + +# Try to ensure this file fails if executed directly. +cat > foo.@ << 'END' +#! /bin/false +echo @K @K @K +exit 0 +END +cp foo.@ baz.2 +# We don't want them to be executable, either. So do this for +# extra safety. +chmod a-x foo.@ baz.2 + +cat > bar.f-o-o << 'END' +#! /bin/sh +echo 1..4 +echo "ok - good" +echo "ok 2 # SKIP" +echo "not ok 3 # TODO" +echo ok +END +chmod a+x bar.f-o-o + +cat > zardoz.l!Nu.x << 'END' +#! /bin/sh +echo Hello Zardoz +exit 0 +END +chmod a+x zardoz.l!Nu.x + +count_all () +{ + count_test_results total=7 pass=4 fail=0 skip=1 xfail=2 xpass=0 error=0 + grep '^PASS: foo\.@$' stdout + grep '^PASS: baz\.2$' stdout + grep '^XFAIL: zardoz.l!Nu\.x$' stdout + grep '^PASS: bar\.f-o-o 1 - good' stdout + grep '^SKIP: bar\.f-o-o 2 # SKIP' stdout + grep '^XFAIL: bar\.f-o-o 3 # TODO' stdout + grep '^PASS: bar\.f-o-o 4$' stdout +} + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +st=0; $MAKE check >stdout || st=$? +cat stdout +ls -l +cat test-suite.log +cat foo.log +grep '@K @K @K' foo.log +cat baz.log +grep '@K @K @K' baz.log +cat bar.log +cat zardoz.log - grep 'Hello Zardoz' zardoz.log && Exit 1 - test $st -eq 0 || Exit 1 ++grep 'Hello Zardoz' zardoz.log && exit 1 ++test $st -eq 0 || exit 1 +count_all + +$MAKE clean +test ! -f test-suite.log +test ! -f foo.log +test ! -f bar.log +test ! -f baz.log +test ! -f zardoz.log + +st=0 +$MAKE check TESTS=zardoz L!NU.X_LOG_COMPILER=/bin/sh >stdout || st=$? +cat stdout +count_test_results total=1 pass=0 fail=0 skip=0 xfail=0 xpass=1 error=0 +cat test-suite.log +test ! -f foo.log +test ! -f bar.log +test ! -f baz.log +cat zardoz.log +grep 'Hello Zardoz' zardoz.log - test $st -gt 0 || Exit 1 ++test $st -gt 0 || exit 1 + - $MAKE recheck >stdout || { cat stdout; Exit 1; } ++$MAKE recheck >stdout || { cat stdout; exit 1; } +cat stdout +count_test_results total=1 pass=0 fail=0 skip=0 xfail=1 xpass=0 error=0 +grep '^XFAIL: zardoz.l!Nu\.x$' stdout + - $MAKE recheck >stdout || { cat stdout; Exit 1; } ++$MAKE recheck >stdout || { cat stdout; exit 1; } +cat stdout +count_test_results total=0 pass=0 fail=0 skip=0 xfail=0 xpass=0 error=0 + - $MAKE distcheck >stdout || { cat stdout; Exit 1; } ++$MAKE distcheck >stdout || { cat stdout; exit 1; } +cat stdout +count_all + +: diff --cc t/test-extensions-invalid.sh index 74058c6bd,98db0a6cd..ebc3c75ea --- a/t/test-extensions-invalid.sh +++ b/t/test-extensions-invalid.sh @@@ -14,32 -14,31 +14,32 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check that 'acconfig.h' is automatically distributed if it exists -# (at automake runtime). -# Related to automake bug#7819. +# Make sure that invalid entries in TEST_EXTENSIONS are diagnosed at +# make runtime. See automake bug#9400. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac <> configure.ac -cat > Makefile.am <<'END' -.PHONY: test -test: distdir - ls -l $(distdir) - echo ' ' $(DIST_COMMON) ' ' | grep '[ /]acconfig\.h ' - test -f $(distdir)/acconfig.h +cat > Makefile.am << 'END' +TESTS = +TEST_EXTENSIONS = mu x1 .foo _ x2 END -: > acconfig.h - $ACLOCAL -$AUTOMAKE $AUTOCONF +$AUTOMAKE -a ./configure -$MAKE test + - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +for suf in mu x1 _ x2; do + $FGREP "invalid test extension: '$suf'" stderr +done + +# Verify that we don't report valid suffixes, even if intermixed +# with invalid ones. - grep 'invalid.*extension.*foo' stderr && Exit 1 ++grep 'invalid.*extension.*foo' stderr && exit 1 : diff --cc t/test-log.sh index d0ed987fc,b622ee70f..6d453d83c --- a/t/test-log.sh +++ b/t/test-log.sh @@@ -88,7 -88,7 +88,7 @@@ $AUTOMAKE - ./configure - $MAKE TEST_SUITE_LOG=my.log check && Exit 1 -TEST_SUITE_LOG=my.log $MAKE -e check && exit 1 ++$MAKE TEST_SUITE_LOG=my.log check && exit 1 ls -l # For debugging. test ! -f test-suite.log test ! -f global.log diff --cc t/test-metadata-global-result.sh index 9633dbd8c,8b6a3c8e2..c93c2c81d --- a/t/test-metadata-global-result.sh +++ b/t/test-metadata-global-result.sh @@@ -135,14 -122,7 +135,14 @@@ cat > zar-doz.x << 'END :test-result: XFAIL END +cat > mu << 'END' +:test-result: PASS +:global-test-result: XFAIL +:test-result: PASS +:test-result: PASS +END + - $MAKE check && Exit 1 + $MAKE check && exit 1 cat test-suite.log have_result < foo.test << 'END :test-result: ERROR END : > zar-doz.x +: > mu - $MAKE check && Exit 1 + $MAKE check && exit 1 cat test-suite.log have_result < foo.test < bar.test < bar < foo.test < foo.test < bar.test +: > bar - mk_check && Exit 1 + mk_check && exit 1 count_test_results total=6 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=1 -cp foo.test bar.test +cp foo.test bar - mk_check && Exit 1 + mk_check && exit 1 count_test_results total=12 pass=2 fail=2 xpass=2 xfail=2 skip=2 error=2 # Check that we are liberal w.r.t. whitespace use. @@@ -166,11 -165,11 +166,11 @@@ for RESULT in PASS FAIL XPASS XFAIL SKI |:test-result:$RESULT $tab| |:test-result:$tab$tab $RESULT$tab $tab | END - echo " $tab $tab$tab :test-result: $RESULT" >> bar.test + echo " $tab $tab$tab :test-result: $RESULT" >> bar done cat foo.test # For debugging. -cat bar.test # Likewise. +cat bar # Likewise. - mk_check && Exit 1 + mk_check && exit 1 count_test_results total=30 pass=5 fail=5 xpass=5 xfail=5 skip=5 error=5 : diff --cc t/test-missing.sh index 115aed93a,441a83894..12bb22980 --- a/t/test-missing.sh +++ b/t/test-missing.sh @@@ -14,9 -14,11 +14,9 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# parallel-tests: -# - non-existent scripts listed in TESTS get diagnosed -# See also related test 'test-missing2.test'. +# parallel-tests: non-existent scripts listed in TESTS get diagnosed. - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_OUTPUT @@@ -35,21 -37,23 +35,21 @@@ $AUTOMAKE - ./configure - $MAKE check >stdout 2>stderr && { cat stdout; cat stderr >&2; Exit 1; } -$MAKE check >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE check >stdout 2>stderr && { cat stdout; cat stderr >&2; exit 1; } +cat stdout; cat stderr >&2 test -f ok.log -grep '^PASS: ok\.test' output -$FGREP 'zardoz.log' output +grep '^PASS: ok\.test' stdout +$FGREP 'zardoz.log' stderr test ! -f test-suite.log - $MAKE TESTS='zardoz2.test' check 2>stderr && { cat stderr >&2; Exit 1; } -TESTS='zardoz2.test' $MAKE -e check >output 2>&1 \ - && { cat output; exit 1; } -cat output -$FGREP 'zardoz2.log' output ++$MAKE TESTS='zardoz2.test' check 2>stderr && { cat stderr >&2; exit 1; } +cat stderr +$FGREP 'zardoz2.log' stderr test ! -f test-suite.log - $MAKE TESTS='zardoz3' check 2>stderr && { cat stderr >&2; Exit 1; } -TEST_LOGS='zardoz3.log' $MAKE -e check >output 2>&1 \ - && { cat output; exit 1; } -cat output -$FGREP 'zardoz3.log' output ++$MAKE TESTS='zardoz3' check 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +$FGREP 'zardoz3.log' stderr test ! -f test-suite.log # The errors should persist even after 'test-suite.log' @@@ -59,9 -63,9 +59,9 @@@ $MAKE check rm -f zardoz.test - $MAKE check 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE check >output 2>&1 && { cat output; exit 1; } -cat output -$FGREP 'zardoz.log' output ++$MAKE check 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +$FGREP 'zardoz.log' stderr test ! -f test-suite.log : diff --cc t/test-trs-recover-parallel.sh index fd8d18312,474e05fa2..bc8b51de2 --- a/t/test-trs-recover-parallel.sh +++ b/t/test-trs-recover-parallel.sh @@@ -14,46 -14,43 +14,46 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check that 'acconfig.h' is *not* automatically distributed when -# placed in a subdirectory. -# Related to automake bug#7819. +# Check parallel harness features: +# - recovery from deleted '.log' and '.trs' files, with parallel make - . ./defs || Exit 1 + . ./defs || exit 1 -cat >> configure.ac < Makefile.am <<'END' -SUBDIRS = sub -sub/acconfig.h: - echo target $@ should not be built >&2; exit 1 -check-local: distdir - ls -l $(distdir)/sub - test ! -f $(distdir)/sub/acconfig.h -END +echo AC_OUTPUT >> configure.ac +echo TESTS = > Makefile.am -mkdir sub +for i in $all; do + echo TESTS += $i.test >> Makefile.am + (echo "#!/bin/sh" && echo "mkdir $i.d") > $i.test + chmod a+x $i.test +done -cat > sub/Makefile.am <<'END' -acconfig.h: - echo target $@ should not be built >&2; exit 1 -check-local: - echo $(DISTFILES) | grep 'acconfig\.h' && exit 1; : - echo $(DIST_COMMON) | grep 'acconfig\.h' && exit 1; : -END - -: > sub/acconfig.h +ls -l # For debugging. $ACLOCAL -$AUTOMAKE $AUTOCONF +$AUTOMAKE -a ./configure + +: Create the required log files. $MAKE check +for n in 1 2 5 7 12; do + for suf in log trs; do + rmdir *.d + rm -f *.$suf + $MAKE -j$n check + for f in $all; do + test -f $f.log + test -f $f.trs + done + done +done + : diff --cc t/test-trs-recover.sh index e09d7f866,9247b1e31..77635e88a --- a/t/test-trs-recover.sh +++ b/t/test-trs-recover.sh @@@ -153,7 -153,7 +153,7 @@@ test -f baz.tr rm -f foo.trs update_stamp touch bar.test - $MAKE AM_LAZY_CHECK=yes check >stdout || { cat stdout; Exit 1; } -RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; exit 1; } ++$MAKE AM_LAZY_CHECK=yes check >stdout || { cat stdout; exit 1; } cat stdout # Check that make has updated what it needed to, but no more. test -f foo.trs diff --cc t/testsuite-summary-reference-log.sh index 85049be51,1851226ac..5b84c17c5 --- a/t/testsuite-summary-reference-log.sh +++ b/t/testsuite-summary-reference-log.sh @@@ -50,7 -50,7 +50,7 @@@ cat stdou grep '^See \./my_test_suite\.log$' stdout mkdir bar - $MAKE TEST_SUITE_LOG=bar/bar.log check >stdout && { cat stdout; Exit 1; } -TEST_SUITE_LOG=bar/bar.log $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TEST_SUITE_LOG=bar/bar.log check >stdout && { cat stdout; exit 1; } cat stdout grep '^See \./bar/bar\.log$' stdout @@@ -80,7 -80,7 +80,7 @@@ cat stdou grep '^See sub/test-suite\.log$' stdout cd .. - $MAKE TEST_SUITE_LOG=foo.log check >stdout && { cat stdout; Exit 1; } -TEST_SUITE_LOG=foo.log $MAKE -e check >stdout && { cat stdout; exit 1; } ++$MAKE TEST_SUITE_LOG=foo.log check >stdout && { cat stdout; exit 1; } cat stdout grep '^See sub/foo\.log$' stdout diff --cc t/txinfo-include.sh index dd4d6335a,000000000..9b609bd9b mode 100755,000000..100755 --- a/t/txinfo-include.sh +++ b/t/txinfo-include.sh @@@ -1,164 -1,0 +1,164 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Texinfo input files using @include directives. Check both in-tree +# and VPATH builds, and both top-level and subdir input. + +required='makeinfo tex texi2dvi' - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +info_TEXINFOS = main.texi sub/more.texi +main_TEXINFOS = one.texi two.texi three.texi +sub_more_TEXINFOS = sub/one.texi sub/two.texi +END + +cat > main.texi << 'END' +\input texinfo +@setfilename main.info +@settitle main +@ifnottex +@node Top +@top GNU dummy. +@menu +* one:: Chapter one +* two:: Chapter two +* three:: Chapter three +@end menu +@end ifnottex +@include one.texi +@include two.texi +@include three.texi +@bye +END + +cat > one.texi << 'END' +@node one +@chapter Chapter one +Foo bar, baz. +END + +cat > two.texi << 'END' +@node two +@chapter Chapter two +Blah Blah Blah. +END + +cat > three.texi << 'END' +@node three +@chapter Chapter two +GNU's Not Unix. +END + +mkdir sub + +cat > sub/more.texi << 'END' +\input texinfo +@setfilename more.info +@settitle main +@ifnottex +@node Top +@top GNU more. +@menu +* desc:: Description of this program +* hist:: History of this program +@end menu +@end ifnottex +@include one.texi +@include two.texi +@bye +END + +cat > sub/one.texi << 'END' +@node desc +@chapter Description of this program +It does something, really. +END + +cat > sub/two.texi << 'END' +@node hist +@chapter History of this program +It was written somehow. +END + +cat > exp << 'END' +./main.info +./sub/more.info +END + +check_info_contents () +{ + srcdir=${1-.} + $FGREP "Foo bar, baz." $srcdir/main.info + $FGREP "Blah Blah Blah." $srcdir/main.info + $FGREP "GNU's Not Unix." $srcdir/main.info + $FGREP 'It does something, really.' $srcdir/sub/more.info + $FGREP 'It was written somehow.' $srcdir/sub/more.info +} + +get_info_names () +{ + find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got +} + +check_expected () +{ + cat exp + cat got + diff exp got +} + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure + +$MAKE info +get_info_names +check_expected + +check_info_contents + +$MAKE dvi +test -f main.dvi +test -f sub/more.dvi + +$MAKE maintainer-clean +test ! -f main.dvi +test ! -f sub/more.dvi +test ! -f main.info +test ! -f sub/more.info + +mkdir build +cd build +../configure +$MAKE all dvi + +get_info_names .. +sed 's|^\./|../|' ../exp > exp +check_expected + +test -f main.dvi +test -f sub/more.dvi + +check_info_contents .. + +$MAKE distcheck + +: diff --cc t/txinfo-rules-once.sh index c35ce9afa,97770f4ce..12e8a84fc --- a/t/txinfo-rules-once.sh +++ b/t/txinfo-rules-once.sh @@@ -14,32 -14,28 +14,32 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure we only create texinfo-related targets once. +# Some grepping checks on Texinfo support. - . ./defs || Exit 1 + . ./defs || exit 1 -cat > Makefile.am << 'END' -info_TEXINFOS = maude.texi liver.txi heart.texinfo -END +echo AC_OUTPUT >> configure.ac + +$ACLOCAL -echo '@setfilename maude.info' > maude.texi -echo '@setfilename liver.info' > liver.txi -echo '@setfilename heart.info' > heart.texinfo : > texinfo.tex -$ACLOCAL +echo info_TEXINFOS = main.texi other.texi sub/x.texi > Makefile.am +mkdir sub +echo @setfilename main.info > main.texi +echo @setfilename other.info > other.texi +echo @setfilename sub/x.info > sub/x.texi $AUTOMAKE +$EGREP '\.(info|pdf|ps|dvi|html|texi)' Makefile.in # For debugging. +test $(grep -c '^%\.info: %\.texi$' Makefile.in) -eq 1 +test $(grep -c '^%\.html: %\.texi$' Makefile.in) -eq 1 +test $(grep -c '^%\.dvi: %\.texi$' Makefile.in) -eq 1 +test $(grep -c '^%\.pdf: %\.texi$' Makefile.in) -eq 1 +test $(grep -c '^%\.ps: %\.dvi$' Makefile.in) -eq 1 -# These are just examples -- basically for many targets in texinfos.am -# we only want them to appear once. But grepping them all would be -# overkill. for t in info dist-info dvi-am install-html uninstall-pdf-am; do - $EGREP "(^| )$t*.:" Makefile.in # For debugging. - test $($EGREP -c "(^| )$t(:| *.:)" Makefile.in) -eq 1 + $FGREP $t Makefile.in # For debugging. + test $(grep -c "^$t *:" Makefile.in) -eq 1 done : diff --cc t/txinfo-unrecognized-extension-2.sh index aef97a9fe,139545d18..ac52e4ad1 --- a/t/txinfo-unrecognized-extension-2.sh +++ b/t/txinfo-unrecognized-extension-2.sh @@@ -14,19 -14,24 +14,19 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure backslash-newline-hash combinations are diagnosed as -# comments following a trailing backslash, even when the combination -# follows a variable assignment that is preceded by a comment. +# Test that automake complains properly when texinfo input files +# specify output info files with an invalid extension. - . ./defs || Exit 1 + . ./defs || exit 1 cat > Makefile.am << 'END' -# initial comment -variable = value-before-comment \ -# - -# comment -SUBDIRS = foo \ -# bar - +info_TEXINFOS = foo.texi bar.texi baz.texi END -mkdir foo +echo '@setfilename foo.inf' > foo.texi +echo '@setfilename bar' > bar.texi +echo '@setfilename baz.texi' > baz.texi +: > texinfo.tex $ACLOCAL AUTOMAKE_fails diff --cc t/txinfo17.sh index f7438531b,d21676920..20c7ecc04 --- a/t/txinfo17.sh +++ b/t/txinfo17.sh @@@ -35,7 -35,5 +35,7 @@@ EN $ACLOCAL $AUTOMAKE --add-missing - grep 'foobar' Makefile.in && Exit 1 -grep 'example' Makefile.in && exit 1 -grep 'texinfo:' Makefile.in ++grep 'foobar' Makefile.in && exit 1 +grep 'texinfo\.info:' Makefile.in + +: diff --cc t/txinfo20.sh index 98c044ee4,4add0c260..45acc7504 --- a/t/txinfo20.sh +++ b/t/txinfo20.sh @@@ -62,17 -62,15 +62,17 @@@ cat > main.texi << 'END END # makeinfo will bail out, but we should conserve the old info files. - $MAKE && Exit 1 + $MAKE && exit 1 -test -f main -test -f main-1 +test -f main.info +test -f main.info-1 # Restore main.texi, and break sub/main.texi. cp main.texi sub/main.texi mv main.old main.texi - $MAKE && Exit 1 + $MAKE && exit 1 -test -f main -test ! -f main-1 -test -f sub/main -test -f sub/main-1 +test -f main.info +test ! -f main.info-1 +test -f sub/main.info +test -f sub/main.info-1 + +: diff --cc t/txinfo21b.sh index 2860cde7d,000000000..2172d7e0f mode 100755,000000..100755 --- a/t/txinfo21b.sh +++ b/t/txinfo21b.sh @@@ -1,181 -1,0 +1,181 @@@ +#! /bin/sh +# Copyright (C) 2003-2012 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 support for building HTML documentation, and the many +# install-DOC flavors, in VPATH builds. +# Keep in sync with sister test 'txinfo21.sh'. +# FIXME: in the long term, the best thing to do is probably to +# FIXME: convert this test and the sister test 'txinfo21.sh' to +# FIXME: TAP, and merge them. + +required='makeinfo tex texi2dvi' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >>configure.ac <<\EOF +AC_CONFIG_FILES([rec/Makefile]) + +# At the time of writing, Autoconf does not supplies any of these +# definitions (and those below are purposely not those of the standard). +AC_SUBST([dvidir], ['${datadir}/${PACKAGE}/dvi']) +AC_SUBST([htmldir], ['${datadir}/${PACKAGE}/html']) +AC_SUBST([pdfdir], ['${datadir}/${PACKAGE}/pdf']) +AC_SUBST([psdir], ['${datadir}/${PACKAGE}/ps']) + +AC_OUTPUT +EOF + +cat > Makefile.am << 'END' +SUBDIRS = rec +info_TEXINFOS = main.texi sub/main2.texi +END + +cat > main.texi << 'END' +\input texinfo +@setfilename main.info +@settitle main +@node Top +Hello walls. +@bye +END + +mkdir sub +cat > sub/main2.texi << 'END' +\input texinfo +@setfilename main2.info +@settitle main2 +@node Top +Hello walls. +@bye +END + +mkdir rec +cat > rec/main3.texi << 'END' +\input texinfo +@setfilename main3.info +@settitle main3 +@node Top +Hello walls. +@bye +END + +cat > rec/Makefile.am << 'END' +info_TEXINFOS = main3.texi + +install-pdf-local: + @$(MKDIR_P) "$(pdfdir)" + :> "$(pdfdir)/hello" +uninstall-local: + rm -f "$(pdfdir)/hello" +END + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +mkdir build +cd build +../configure + +$MAKE + +$sleep +# Test production of split-per-node HTML. +$MAKE html +test -d main.html +test -d sub/main2.html +test -d rec/main3.html + +# Rebuilding main.html should cause its timestamp to be updated. +is_newest main.html ../main.texi +$sleep +touch ../main.texi +$MAKE html +is_newest main.html ../main.texi + +$MAKE clean +test ! -d main.html +test ! -d sub/main2.html +test ! -d rec/main3.html + +# Test production of a single HTML file. +$MAKE MAKEINFOFLAGS=--no-split html +test -f main.html +test -f sub/main2.html +test -f rec/main3.html +$MAKE clean +test ! -f main.html +test ! -f sub/main2.html +test ! -f rec/main3.html + +# Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO. +cat >> ../Makefile.am <<\EOF +AM_MAKEINFOHTMLFLAGS = --no-headers --no-split +AM_MAKEINFOFLAGS = --unsupported-option +EOF +../configure --prefix "`pwd`" +$MAKE html +test -f main.html +test -f sub/main2.html +test -d rec/main3.html +$MAKE clean +test ! -f main.html +test ! -f sub/main2.html +test ! -d rec/main3.html + +$MAKE install-html +test -f share/$me/html/main.html +test -f share/$me/html/main2.html +test -d share/$me/html/main3.html +$MAKE uninstall +test ! -f share/$me/html/main.html +test ! -f share/$me/html/main2.html +test ! -d share/$me/html/main3.html + +$MAKE install-dvi +test -f share/$me/dvi/main.dvi +test -f share/$me/dvi/main2.dvi +test -f share/$me/dvi/main3.dvi +$MAKE uninstall +test ! -f share/$me/dvi/main.dvi +test ! -f share/$me/dvi/main2.dvi +test ! -f share/$me/dvi/main3.dvi + +dvips --help || skip_ "dvips is missing" + +$MAKE install-ps +test -f share/$me/ps/main.ps +test -f share/$me/ps/main2.ps +test -f share/$me/ps/main3.ps +$MAKE uninstall +test ! -f share/$me/ps/main.ps +test ! -f share/$me/ps/main2.ps +test ! -f share/$me/ps/main3.ps + +pdfetex --help || pdftex --help \ + || skip_ "pdftex and pdfetex are both missing" + +$MAKE install-pdf +test -f share/$me/pdf/main.pdf +test -f share/$me/pdf/main2.pdf +test -f share/$me/pdf/main3.pdf +test -f share/$me/pdf/hello +$MAKE uninstall +test ! -f share/$me/pdf/main.pdf +test ! -f share/$me/pdf/main2.pdf +test ! -f share/$me/pdf/main3.pdf +test ! -f share/$me/pdf/hello + +: diff --cc t/uninstall-fail.sh index 6ab728c04,8f160c886..14e3219db --- a/t/uninstall-fail.sh +++ b/t/uninstall-fail.sh @@@ -62,8 -62,8 +62,8 @@@ mkdir $inst $inst/shar : > $inst/share/foobar.txt chmod a-w $inst/share - $MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE uninstall >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE uninstall 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 if test $rm_f_is_silent_on_error = yes; then : "rm -f" is silent on errors, skip the grepping of make output else @@@ -73,8 -73,8 +73,7 @@@ f chmod a-rwx $inst/share (cd $inst/share) && skip_ "cannot make directories fully unreadable" - $MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; } - cat stderr >&2 -$MAKE uninstall >output 2>&1 && { cat output; exit 1; } -cat output ++$MAKE uninstall 2>stderr && { cat stderr >&2; exit 1; } # # Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report # the name of the 'cd' builtin upon a chdir error: diff --cc t/vala-headers.sh index 2e1b5be41,c86c4e616..6c9a569b8 --- a/t/vala-headers.sh +++ b/t/vala-headers.sh @@@ -16,8 -16,8 +16,8 @@@ # Test to make sure compiling Vala code really works with recursive make. -required="pkg-config valac gcc GNUmake" +required="pkg-config valac gcc" - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/vala-libs.sh index 567d5b3b0,f6a7ba9b3..0eab4feb0 --- a/t/vala-libs.sh +++ b/t/vala-libs.sh @@@ -17,8 -17,8 +17,8 @@@ # Building libraries (libtool and static) from Vala sources. # And use of vapi files to call C code from Vala. -required="valac cc pkg-config libtoolize GNUmake" +required="valac cc pkg-config libtoolize" - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/vala-mix.sh index 8f522de06,2580bd074..e16c02cd2 --- a/t/vala-mix.sh +++ b/t/vala-mix.sh @@@ -16,8 -16,8 +16,8 @@@ # Vala sources and C sources in the same program. Functional test. -required='valac cc GNUmake' +required='valac cc' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <<'END' AC_PROG_CC diff --cc t/vala-mix2.sh index 7c793bfbb,e1dbb5d48..7a2d32449 --- a/t/vala-mix2.sh +++ b/t/vala-mix2.sh @@@ -17,8 -17,8 +17,8 @@@ # Vala sources, C and C++ sources and C and C++ headers in the same # program. Functional test. See automake bug#10894. -required='valac cc c++ GNUmake' +required='valac cc c++' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <<'END' AC_PROG_CC diff --cc t/vala-parallel.sh index d52209336,3b659a88d..526c4f6c6 --- a/t/vala-parallel.sh +++ b/t/vala-parallel.sh @@@ -16,8 -16,8 +16,8 @@@ # Vala support with parallel make. -required='valac cc GNUmake' +required='valac cc' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <<'END' AC_PROG_CC diff --cc t/vala-vapi.sh index 2e14eb77a,1862b71bc..dedf0427a --- a/t/vala-vapi.sh +++ b/t/vala-vapi.sh @@@ -16,8 -16,8 +16,8 @@@ # Test and that vapi files are correctly handled by Vala support. -required='valac cc GNUmake' +required='valac cc' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac <<'END' AC_PROG_CC diff --cc t/vala-vpath.sh index 514d0e6d8,9a7ff7687..117d08634 --- a/t/vala-vpath.sh +++ b/t/vala-vpath.sh @@@ -17,8 -17,8 +17,8 @@@ # Test to make sure vala support handles from-scratch VPATH builds. # See automake bug#8753. -required="cc valac GNUmake" +required="cc valac" - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_CONFIG_SRCDIR([hello.vala]) diff --cc t/vala2.sh index cfbffc1b3,1c5bdb9e1..a392a7a4e --- a/t/vala2.sh +++ b/t/vala2.sh @@@ -16,8 -16,8 +16,8 @@@ # Test to make sure compiling Vala code really works with recursive make. -required="pkg-config valac gcc GNUmake" +required="pkg-config valac gcc" - . ./defs || Exit 1 + . ./defs || exit 1 mkdir src diff --cc t/vala3.sh index 6de68f8da,481815060..1de29726d --- a/t/vala3.sh +++ b/t/vala3.sh @@@ -16,8 -16,8 +16,8 @@@ # Test to make sure compiling Vala code really works with non-recursive make. -required="pkg-config valac gcc GNUmake" +required="pkg-config valac gcc" - . ./defs || Exit 1 + . ./defs || exit 1 mkdir src diff --cc t/vala5.sh index 4a37d8fb3,3c55cf170..4e4a4047f --- a/t/vala5.sh +++ b/t/vala5.sh @@@ -16,8 -16,8 +16,8 @@@ # Test per-target flags. -required="pkg-config valac gcc GNUmake" +required="pkg-config valac gcc" - . ./defs || Exit 1 + . ./defs || exit 1 mkdir src diff --cc t/var-undef-append.sh index f59bacca1,000000000..28ca29999 mode 100755,000000..100755 --- a/t/var-undef-append.sh +++ b/t/var-undef-append.sh @@@ -1,100 -1,0 +1,100 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Automake should allow us top append to undefined variables, for +# consistency with GNU make. For the same reason, if we override +# a variable definition from the command line, any '+=' appending +# to it should get overridden as well. +# See also "spy" test 'spy-var-append.sh'. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AM_CONDITIONAL([COND_NO], [false]) +AM_CONDITIONAL([COND_YES], [:]) +AM_CONDITIONAL([COND_YES2], [:]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +var0 += foo0 + +if COND_NO +var00 += foo00 +endif + +if COND_YES +if COND_YES2 +var000 += foo000 +endif +endif + +if COND_NO +var1 = oops +endif +var1 += bar +if COND_YES +var1 += baz +endif +if COND_NO +var1 += oops +endif + +if COND_YES +var2 = a +endif +var2 += b + +if COND_YES +var3 := c +endif +var3 += d + +var4 = cuckoo +var4 += nightingale + +.PHONY: test1 test2 +test1: + test x'$(var0)' = x'foo0' + test x'$(var00)' = x'' + test x'$(var000)' = x'foo000' + test x'$(var1)' = x'bar baz' + test x'$(var2)' = x'a b' + test x'$(var3)' = x'c d' + test x'$(var4)' = x'cuckoo nightingale' +test2: + test x'$(var0)' = x + test x'$(var1)' = x'one' + test x'$(var2)' = x'two' + test x'$(var3)' = x'three' + test x'$(var4)' = x'' +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +checkit () +{ - $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; } ++ $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; exit 1; } +} + +checkit test1 +checkit test2 var0= var1=one var2=two var3=three var4= + +: diff --cc t/vars-assign.sh index 120118f83,0795f9381..36d3dc736 --- a/t/vars-assign.sh +++ b/t/vars-assign.sh @@@ -14,35 -14,33 +14,35 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check for _AM_OUTPUT_DEPENDENCY_COMMANDS grouping bug, -# reported by Markus Duft. +# Automake do not complain about nor messes up GNU make specific +# variable assignments (":=" and "?="). - . ./defs || Exit 1 + . ./defs || exit 1 -cat >>configure.ac << END -AC_PROG_CC -AC_OUTPUT -END +echo AC_OUTPUT >> configure.ac -cat > Makefile.am << END -bin_PROGRAMS = foo -foo_SOURCES = foo.c foo.h -END +unset PREFOO FOO BAR BAZ XFOO XBAZ || : + +cat > Makefile.am <<'END' +PREFOO = bar +FOO := foo$(PREFOO)$(XFOO) +XFOO = fail +BAR ?= barbar -cat >foo.c << END -#include "foo.h" +.PHONY: test1 test2 +test1: + test $(FOO) = foobar + test $(BAR) = barbar +test2: + test $(FOO) = foobar + test $(BAR) = rabrab END -: >foo.h $ACLOCAL -$AUTOMAKE $AUTOCONF -./configure --disable-dependency-tracking 2>stderr || { - stat=$?; cat stderr >&2; exit $stat; -} -cat stderr >&2 -grep shift stderr && exit 1 +$AUTOMAKE +./configure +$MAKE test1 +PREFOO=notseen FOO=notseen BAR=rabrab $MAKE test2 : diff --cc t/vartar.sh index d5ddf6531,1c9dc3bed..91d8fb9b0 --- a/t/vartar.sh +++ b/t/vartar.sh @@@ -16,12 -16,12 +16,12 @@@ # Targets and macros are two different name spaces. - . ./defs || Exit 1 + . ./defs || exit 1 cat > Makefile.am << 'END' -install = install -install: - $(install) install +xinstall = xinstall +xinstall: + $(xinstall) xinstall END $ACLOCAL diff --cc t/vartypos-deps.sh index 212b29a34,000000000..8ba379225 mode 100755,000000..100755 --- a/t/vartypos-deps.sh +++ b/t/vartypos-deps.sh @@@ -1,103 -1,0 +1,103 @@@ +#! /bin/sh +# Copyright (C) 2010-2012 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 we warn about possible variable typos for the +# *_DEPENDENCIES when we should, and do not warn about them +# when we should not. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +subdirs='ok1 ok2 ko1 ko2' +mkdir $subdirs + +errgrep () +{ + grep "variable '${1}_DEPENDENCIES' is defined" stderr + grep "'$1' as canonical name" stderr +} + +cat >> configure.ac < Makefile.am <<'END' +AM_LDFLAGS = unused +ETAGS_ARGS = --unused +TAGS_DEPENDENCIES = foo.c +CONFIG_STATUS_DEPENDENCIES = cvs-version.sh +CONFIGURE_DEPENDENCIES = cvs-version.sh +foo.c: + echo 'int main (void) { return 0; }' > $@ +END + +: > cvs-version.sh + +cat > ok1/Makefile.am <<'END' +TESTS = unused ignored.test +LOG_DEPENDENCIES = unused +TEST_LOG_DEPENDENCIES = unused +END + +cat > ok2/Makefile.am <<'END' +TESTS = ignored.sh notseen.tap +TEST_EXTENSIONS = .sh .tap +LOG_DEPENDENCIES = unused +SH_LOG_DEPENDENCIES = unused +TAP_LOG_DEPENDENCIES = unused +END + +cat > ko1/Makefile.am <<'END' +LOG_DEPENDENCIES = +TEST_LOG_DEPENDENCIES = +END + +cat > ko2/Makefile.am <<'END' +TESTS = unused ignored.test +TEST_LOG_DEPENDENCIES = +LOG_DEPENDENCIES = +SH_LOG_DEPENDENCIES = +CONFIGSTATUS_DEPENDENCIES = +CONFIG_DEPENDENCIES = +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +$MAKE +(cd ok1 && $MAKE) +(cd ok2 && $MAKE) + +cd ko1 - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +errgrep LOG +errgrep TEST_LOG +cd .. + +cd ko2 - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +errgrep SH_LOG +errgrep CONFIG +errgrep CONFIGSTATUS - $EGREP "'(TEST_)?LOG" stderr && Exit 1 ++$EGREP "'(TEST_)?LOG" stderr && exit 1 +cd .. + +: diff --cc t/vartypos-whitelist.sh index 7c718b2dc,000000000..e886fc360 mode 100755,000000..100755 --- a/t/vartypos-whitelist.sh +++ b/t/vartypos-whitelist.sh @@@ -1,109 -1,0 +1,109 @@@ +#! /bin/sh +# Copyright (C) 2010-2012 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 we allow the use to whitelist false positives in our +# detection of variable typos. Inspired by the GNU coreutils (8.17) +# build system. + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CC +AM_PROG_AR +AC_PROG_RANLIB +AC_SUBST([LIBSELINUX], ["$l_selinux"]) +AC_OUTPUT +END + +l_selinux=; export l_selinux= + +cat > Makefile.am <<'END' +bin_PROGRAMS = cp mv rm +noinst_LIBRARIES = libremove.a libcopy.a +remove_LDADD = libremove.a +copy_LDADD = libcopy.a +copy_LDADD += @LIBSELINUX@ +cp_LDADD = $(copy_LDADD) +rm_LDADD = $(remove_LDADD) +mv_LDADD = $(copy_LDADD) $(remove_LDADD) +AM_VARTYPOS_WHITELIST = copy_LDADD remove_LDADD +EXTRA_DIST = libcopy.h libremove.h +END + +echo 'extern void cu_copy (void);' > libcopy.h +echo 'extern void cu_remove (void);' > libremove.h + +cat > libcopy.c << 'END' +#include "libcopy.h" +void cu_copy (void) { return; } +END + +cat > libremove.c << 'END' +#include "libremove.h" +void cu_remove (void) { return; } +END + +cat > cp.c <<'END' +#include "libcopy.h" +int main (void) +{ + cu_copy (); + return 0; +} +END + +cat > rm.c <<'END' +#include "libremove.h" +int main (void) +{ + cu_remove (); + return 0; +} +END + +cat > mv.c <<'END' +#include "libremove.h" +#include "libcopy.h" +int main (void) +{ + cu_copy (); + cu_remove (); + return 0; +} +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure +$MAKE + +# If we remove the whitelisting, failure ensues. - $MAKE AM_VARTYPOS_WHITELIST= 2>stderr && { cat stderr; Exit 1; } ++$MAKE AM_VARTYPOS_WHITELIST= 2>stderr && { cat stderr; exit 1; } +cat stderr >&2 +grep "'copy_LDADD' is defined but no program" stderr +grep "'remove_LDADD' is defined but no program" stderr - $MAKE AM_VARTYPOS_WHITELIST=remove_LDADD 2>stderr && { cat stderr; Exit 1; } ++$MAKE AM_VARTYPOS_WHITELIST=remove_LDADD 2>stderr && { cat stderr; exit 1; } +cat stderr >&2 +grep "'copy_LDADD' is defined but no program" stderr - grep "remove_LDADD" stderr && Exit 1 ++grep "remove_LDADD" stderr && exit 1 + +# Sanity check the distribution. +$MAKE distcheck + +: diff --cc t/vartypos.sh index cf9b31e86,16317fb32..9048c20fc --- a/t/vartypos.sh +++ b/t/vartypos.sh @@@ -16,16 -16,9 +16,16 @@@ # Make sure we warn about possible variable typos when we should. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >>configure.ac <<'END' +: > ltmain.sh + +cat >> configure.ac <<'END' +m4_define([AC_PROG_RANLIB], [AC_SUBST([RANLIB], [who-cares])]) +m4_define([AM_PROG_AR], [AC_SUBST([AR], [who-cares])]) +m4_define([LT_INIT], [AC_SUBST([LIBTOOL], [who-cares])]) +LT_INIT +AM_PROG_AR AC_PROG_RANLIB AC_OUTPUT END @@@ -82,28 -41,49 +82,28 @@@ nihil END $ACLOCAL -AUTOMAKE_fails -Wno-extra-portability -# The expected diagnostic is: -# automake: warnings are treated as errors -# Makefile.am:2: warning: variable 'nodist_foo_SOURCES' is defined but no program or -# Makefile.am:2: library has 'foo' as canonical name (possible typo) -# Makefile.am:1: warning: variable 'foo_SOURCES' is defined but no program or -# Makefile.am:1: library has 'foo' as canonical name (possible typo) -# Makefile.am:9: warning: variable 'libfoo_a_SOURCES' is defined but no program or -# Makefile.am:9: library has 'libfoo_a' as canonical name (possible typo) -# Makefile.am:10: warning: variable 'nodist_libfoo_a_SOURCES' is defined but no program or -# Makefile.am:10: library has 'libfoo_a' as canonical name (possible typo) -# Makefile.am:11: warning: variable 'EXTRA_libfoo_a_SOURCES' is defined but no program or -# Makefile.am:11: library has 'libfoo_a' as canonical name (possible typo) -# Makefile.am:3: warning: variable 'EXTRA_foo_SOURCES' is defined but no program or -# Makefile.am:3: library has 'foo' as canonical name (possible typo) -# Makefile.am:12: warning: variable 'libfoo_a_LIBADD' is defined but no program or -# Makefile.am:12: library has 'libfoo_a' as canonical name (possible typo) -# Makefile.am:4: warning: variable 'foo_LDADD' is defined but no program or -# Makefile.am:4: library has 'foo' as canonical name (possible typo) -# Makefile.am:5: warning: variable 'foo_LDFLAGS' is defined but no program or -# Makefile.am:5: library has 'foo' as canonical name (possible typo) -# Makefile.am:14: warning: variable 'EXTRA_libfoo_a_DEPENDENCIES' is defined but no program or -# Makefile.am:14: library has 'libfoo_a' as canonical name (possible typo) -# Makefile.am:7: warning: variable 'EXTRA_foo_DEPENDENCIES' is defined but no program or -# Makefile.am:7: library has 'foo' as canonical name (possible typo) -# Makefile.am:6: warning: variable 'foo_DEPENDENCIES' is defined but no program or -# Makefile.am:6: library has 'foo' as canonical name (possible typo) -# Makefile.am:13: warning: variable 'libfoo_a_DEPENDENCIES' is defined but no program or -# Makefile.am:13: library has 'libfoo_a' as canonical name (possible typo) - -grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \ - && exit 1 -test $(grep -c 'variable.*is defined but' stderr) -eq 13 - -# If we add a global -Wnone, all warnings should disappear. -$AUTOMAKE -Wnone - -# Likewise, if matching programs or libraries are defined. -cat >>Makefile.am <<'END' +$AUTOCONF +$AUTOMAKE -a + +./configure - $MAKE nihil 2>stderr && { cat stderr >&2; Exit 1; } ++$MAKE nihil 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 + +$FGREP 'as canonical' stderr \ - | $EGREP -v " '(foo|libfoo_a|libbar_la)' " && Exit 1 ++ | $EGREP -v " '(foo|libfoo_a|libbar_la)' " && exit 1 +test 36 -eq $(grep -c 'variable.*is defined but' stderr) + +# If matching programs or libraries are defined, all errors should +# disappear. +cat >> Makefile.am <<'END' bin_PROGRAMS = foo lib_LIBRARIES = libfoo.a +lib_LTLIBRARIES = libbar.la END -$AUTOMAKE -Wno-extra-portability +# FIXME! We have to remake the Makefile by hand! This is unacceptable. +$AUTOMAKE Makefile +./config.status Makefile +$MAKE nihil : diff --cc t/verbatim.sh index f0f6b7469,000000000..eb12959ee mode 100755,000000..100755 --- a/t/verbatim.sh +++ b/t/verbatim.sh @@@ -1,161 -1,0 +1,161 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# A line starting with '!' used in our internal .am fragments is +# passed verbatim to the output Makefile, and in the right place +# too. Yes, this test is hacky ... as is the behaviour it tests +# after all ;-) + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +long1=long +long2="$long1 $long1" +long4="$long2 $long2" +long8="$long4 $long4" +long16="$long8 $long8" +long32="$long16 $long16" +long64="$long32 $long32" +long128="$long64 $long64" +long256="$long128 $long128" +long512="$long256 $long265" + +# Sanity check. +case $long512 in + *' long long '*) ;; + *) fatal_ 'defining $long512' ;; +esac + +mkdir am +cp "$am_amdir"/*.am ./am + +echo pkgdata_DATA = configure.ac > Makefile.am + +# The '.am' file are read-only when this test is run under +# "make distcheck", so we need to unlink any of them we want +# to overwrite. +rm -f am/data.am +cat > am/data.am << 'END' +include 0.am +include 1.am +include 2.am +include 3.am +END + +echo "!x = $long256" > am/0.am + +cat >> am/1.am << 'END' +!## unmodified +!xyz = \ +rule: + @echo Go Custom Rule +!!unmodified! +.PHONY: test-xyz +test-xyz: + test '$(xyz)' = '!unmodified!' +END + +cat > am/2.am << 'END' +!badrule1: ; @echo "'$@' unexpectedly won over 'all'!"; exit 1 +!badrule2: +! @echo "'$@' unexpectedly won over 'all'!"; exit 1 +all-local: verbatim-rule + test -f $<.ok +!verbatim-rule: +!ifeq (ok,ok) +! @echo $@ run correctly +! : > $@.ok +!else +! echo $@ failure; exit 1 +!endif +# We want this deliberately after verbatim-rule. +x = ok +END + +cat > am/3.am << 'END' +x1 := 1 +x2 := 2 + +foo = . + +!ifndef FOO +!foo += $(x1) +!else +!foo += $(x2) +!endif + +!ifeq ($(BAR),1) +!bar = aaa +!else +!ifeq "$(BAR)" "2" +!bar = lol +!else +!bar = default +!endif # this comment should be comment ignored +!endif + +check-var: + test '$($(var))' = '$(val)' +END + +# Avoid interferences from the environment. +FOO= BAR=; unset FOO BAR + +$ACLOCAL +$AUTOMAKE --libdir=. + - grep '^!' Makefile.in | grep -v '^!unmodified!$' && Exit 1 ++grep '^!' Makefile.in | grep -v '^!unmodified!$' && exit 1 + +# Use perl, to avoid possible issues with regex length in vendor greps. +$PERL -e " + while (<>) { exit (0) if (/^x = $long256$/); } + exit (1); +" Makefile.in + +grep '^!unmodified!$' Makefile.in +test $(grep -c '^!unmodified!$' Makefile.in) -eq 1 +grep '^## unmodified$' Makefile.in +grep '^xyz = \\$' Makefile.in + +$EGREP 'foo|bar' Makefile.in # For debugging. +test `grep -c '^foo +=' Makefile.in` -eq 2 +test `grep -c '^bar =' Makefile.in` -eq 3 + +$AUTOCONF +./configure + +# The created makefile is not broken. +$MAKE -n + +$MAKE rule +test ! -f verbatim-rule.ok +$MAKE +test -f verbatim-rule.ok - $MAKE | grep 'Custom Rule' && Exit 1 ++$MAKE | grep 'Custom Rule' && exit 1 +$MAKE test-xyz + +$MAKE check-var var=foo val='. 1' +$MAKE check-var var=foo val='. 1' FOO='' +$MAKE check-var var=foo val='. 2' FOO=yes +$MAKE check-var var=foo val='. 2' FOO=' who cares!' + +$MAKE check-var var=bar val=default +$MAKE check-var var=bar val=aaa BAR=1 +$MAKE check-var var=bar val=lol BAR=2 +$MAKE check-var var=bar val=default BAR=3 + +: diff --cc t/vpath-built-sources.sh index 1f470736a,000000000..e6d961f34 mode 100755,000000..100755 --- a/t/vpath-built-sources.sh +++ b/t/vpath-built-sources.sh @@@ -1,73 -1,0 +1,73 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# In a VPATH build, a target starting with $(srcdir) is triggered to +# build a source with the same name but without the $(srcdir). + +required=cc - . ./defs || Exit 1 ++. ./defs || exit 1 + +ocwd=`pwd` || fatal_ "couldn't get current working directory" + +cat >> configure.ac <<'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am <<'END' +noinst_PROGRAMS = p1 p2 p3 tp1 tp2 tp3 + +write-it = echo 'int main (void) { return 0; }' >$@ + +# We keep all the targets on separate lines to make sure the dumb +# Automake parser actually sees them all. +$(srcdir)/p1.c: + $(write-it) +${srcdir}/p2.c: + $(write-it) +@srcdir@/p3.c: + $(write-it) +$(top_srcdir)/tp1.c: + $(write-it) +${top_srcdir}/tp2.c: + $(write-it) +@top_srcdir@/tp3.c: + $(write-it) +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +mkdir build +cd build +../configure +$MAKE all + +cd "$ocwd" +rm -f *.c +mkdir -p sub1/sub2/sub3 +cd sub1/sub2/sub3 +"$ocwd"/configure --disable-dependency-tracking +$MAKE all + +cd "$ocwd" +rm -f *.c +./configure +$MAKE all +$MAKE distcheck + +: diff --cc t/vpath-rewrite.sh index 0d2db6cbc,000000000..61fb2e685 mode 100755,000000..100755 --- a/t/vpath-rewrite.sh +++ b/t/vpath-rewrite.sh @@@ -1,100 -1,0 +1,100 @@@ +#! /bin/sh +# Copyright (C) 2012 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 Automake-provided internal make macros to deal with VPATH rewrites. + - . ./defs || Exit 1 ++. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << END +bsub: + mkdir \$@ +bsub/foo: bsub + mkdir \$@ +bsub/foo/bar: bsub/foo + mkdir \$@ +bsub/mu.c++: bsub/foo + touch \$@ +bsub/foo/pu.cxx: bsub/foo + touch \$@ + +clean-local: + rm -rf bsub + +## Yes, I'm a lazy typist. +vr = \$(am__vpath_rewrite) + +test-common: bsub/foo/bar bsub/mu.c++ bsub/foo/pu.cxx + test '\$(call vr,Makefile)' = Makefile + test '\$(call vr,$tab config.status )' = config.status + test '\$(call vr,.)' = . +## FIXME: These two do not work apparently :-( Such use cases are not +## FIXME: required presently though, so this is not a big deal. + : test '\$(call vr, bsub$tab )' = bsub + : test '\$(call vr,bsub)' = bsub + test '\$(call vr,bsub/.)' = bsub/. + test '\$(call vr,bsub/mu.c++)' = bsub/mu.c++ + test '\$(call vr,bsub/foo/pu.cxx)' = bsub/foo/pu.cxx + test '\$(call vr,bsub/foo )' = bsub/foo + test '\$(call vr,bsub/foo/bar)' = bsub/foo/bar + test '\$(call vr,nonesuch)' = \$(srcdir)/nonesuch + test '\$(call vr, $tab nonesuch2 )' = \$(srcdir)/nonesuch2 + test '\$(call vr, sub/none)' = \$(srcdir)/sub/none + +test-vpath: test-common + test '\$(call vr,ssub)' = \$(srcdir)/ssub + test '\$(call vr,ssub/foo )' = \$(srcdir)/ssub/foo + test '\$(call vr, ssub/foo/bar)' = \$(srcdir)/ssub/foo/bar + test '\$(call vr,Makefile.in )' = \$(srcdir)/Makefile.in + test '\$(call vr,zap/paz.c)' = \$(srcdir)/zap/paz.c + test '\$(call vr,configure $tab)' = \$(srcdir)/configure + test '\$(call vr, configure.ac$tab )' = \$(srcdir)/configure.ac + +test-intree: test-common + test '\$(call vr,ssub)' = ssub + test '\$(call vr,ssub/foo )' = ssub/foo + test '\$(call vr, ssub/foo/bar)' = ssub/foo/bar + test '\$(call vr,Makefile.in )' = Makefile.in + test '\$(call vr,zap/paz.c)' = zap/paz.c + test '\$(call vr,configure $tab)' = configure + test '\$(call vr, configure.ac$tab )' = configure.ac +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +mkdir zap ssub ssub/foo ssub/foo/bar +: > zap/paz.c + +./configure +$MAKE test-intree +$MAKE distclean + +mkdir build +cd build +../configure +$MAKE test-vpath +cd .. + +ocwd=`pwd` || fatal_ "couldn't get current working directory" +mkdir build2 build2/subbuild +cd build2/subbuild +"$ocwd"/configure +$MAKE test-vpath + +: diff --cc t/vpath.sh index f20ebf840,dcb08ffb0..20908104e --- a/t/vpath.sh +++ b/t/vpath.sh @@@ -17,31 -17,17 +17,31 @@@ # Test to make sure VPATH can be overridden. # Report from Anthony Green. - . ./defs || Exit 1 + . ./defs || exit 1 +echo AC_OUTPUT >> configure.ac + cat > Makefile.am << 'END' VPATH = zardoz +%.bar: %.foo + cp $< $@ END $ACLOCAL +$AUTOCONF $AUTOMAKE -grep VPATH Makefile.in # For debugging. -grep '^VPATH = zardoz$' Makefile.in -grep 'VPATH.*@srcdir@' Makefile.in && exit 1 +mkdir build +cd build +mkdir zardoz +../configure + +echo OK > zardoz/file.foo +echo KO > ../file.foo +$MAKE file.bar +test "$(cat file.bar)" = OK +rm -f file.bar zardoz/file.foo - $MAKE file.bar && Exit 1 ++$MAKE file.bar && exit 1 +test ! -f file.bar : diff --cc t/warnopts.sh index 887f73a5e,68ceb2a84..c3be61798 --- a/t/warnopts.sh +++ b/t/warnopts.sh @@@ -16,12 -16,10 +16,12 @@@ # Make sure that we can enable or disable warnings on a per-file basis. - . ./defs || Exit 1 + . ./defs || exit 1 -cat >>configure.ac <> configure.ac << 'END' +AC_PROG_CC AC_CONFIG_FILES([sub/Makefile]) +AM_CONDITIONAL([COND_FALSE], [false]) AC_OUTPUT END @@@ -52,16 -44,22 +52,16 @@@ EN $ACLOCAL AUTOMAKE_fails # The expected diagnostic is -# Makefile.am:3: warning: variable 'foo_SOURCES' is defined but no program or -# library has 'foo' as canonical name (possible typo) -# sub/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' -grep '^Makefile.am:.*foo_SOURCES' stderr -grep '^sub/Makefile.am:.*INCLUDES' stderr -grep '^sub/Makefile.am:.*foo_SOURCES' stderr && exit 1 -grep '^Makefile.am:.*INCLUDES' stderr && exit 1 -# Only three lines of warnings. -test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 3 +# automake: warnings are treated as errors +# Makefile.am:6: warning: compiling 'sub/foo.c' in subdir requires 'AM_PROG_CC_C_O' in 'configure.ac' +# sub/Makefile.am:1: warning: 'AUTOMAKE_OPTIONS' cannot have conditional contents +grep '^Makefile\.am:.*sub/foo\.c.*AM_PROG_CC_C_O' stderr +grep '^sub/Makefile.am:.*AUTOMAKE_OPTIONS' stderr - grep '^sub/Makefile\.am:.*AM_PROG_CC_C_O' stderr && Exit 1 - grep '^Makefile\.am:.*AUTOMAKE_OPTIONS' stderr && Exit 1 ++grep '^sub/Makefile\.am:.*AM_PROG_CC_C_O' stderr && exit 1 ++grep '^Makefile\.am:.*AUTOMAKE_OPTIONS' stderr && exit 1 +# Only two lines of warnings. +test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 2 -# On fast machines the autom4te.cache created during the above run of -# $AUTOMAKE is likely to have the same time stamp as the configure.ac -# created below; thus causing traces for the old configure.ac to be -# used. We could do '$sleep', but it's faster to erase the -# directory. (Erase autom4te*.cache, not autom4te.cache, because some -# bogus installations of Autoconf use a versioned cache). rm -rf autom4te*.cache # If we add a global -Wnone, all warnings should disappear. diff --cc t/werror.sh index 7407e00de,01d76fc03..d6c6587c1 --- a/t/werror.sh +++ b/t/werror.sh @@@ -16,19 -16,11 +16,19 @@@ # Test to make sure -Werror and --add-missing work together. +am_create_testdir=empty - . ./defs || Exit 1 + . ./defs || exit 1 -: > Makefile.am - -rm -f install-sh depcomp missing mkinstalldirs +cat > configure.ac < Makefile.am +test ! -f install-sh # Sanity check. $ACLOCAL $AUTOMAKE -Werror --add-missing +test -f install-sh # Sanity check. + +: diff --cc t/werror2.sh index e77a85b6e,52ec1811a..8b42833ad --- a/t/werror2.sh +++ b/t/werror2.sh @@@ -19,9 -19,9 +19,9 @@@ # succeed if make is run a second time immediately afterwards. # Report from Harlan Stenn. - . ./defs || Exit 1 + . ./defs || exit 1 -echo AC_OUTPUT>>configure.ac +echo AC_OUTPUT >> configure.ac : > Makefile.am diff --cc t/yacc-depend2.sh index c5b69f652,70f3f14cc..281dcd276 --- a/t/yacc-depend2.sh +++ b/t/yacc-depend2.sh @@@ -15,10 -15,11 +15,10 @@@ # along with this program. If not, see . # Make sure depcomp does not needlessly update headers and objects -# for yacc rules. This test still fails with FreeBSD make (but passes -# with NetBSD make). +# for yacc rules. required='cc yacc' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' AC_PROG_CC diff --cc t/yacc-dist-nobuild-subdir.sh index 174d704fe,850b027b9..7dc5b8b5d --- a/t/yacc-dist-nobuild-subdir.sh +++ b/t/yacc-dist-nobuild-subdir.sh @@@ -15,11 -15,16 +15,11 @@@ # along with this program. If not, see . # Check that VPATH builds and "make distcheck" works with packages -# using yacc and the automake 'subdir-objects' option. -# Exposes automake bug#8485. +# using yacc sources in a subdir option. Exposes automake bug#8485. required='cc yacc' - . ./defs || Exit 1 + . ./defs || exit 1 -# This test is bounded to fail for any implementation that -# triggers automake bug#7884. -useless_vpath_rebuild && skip_ "would trip on automake bug#7884" - cat >> configure.ac << 'END' AC_PROG_CC AM_PROG_CC_C_O @@@ -79,10 -85,9 +79,10 @@@ chmod u+w # Try to enable dependency tracking even with slow dependency # extractors, to improve coverage. ../configure --enable-dependency-tracking YACC=false -$MAKE + +$MAKE all YACC=false - ls -l sub/*.[ch] && Exit 1 + ls -l sub/*.[ch] && exit 1 -env DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE distcheck +$MAKE distcheck YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false' : diff --cc t/yacc-dist-nobuild.sh index 04c887ff4,40b833245..45cb10916 --- a/t/yacc-dist-nobuild.sh +++ b/t/yacc-dist-nobuild.sh @@@ -83,8 -83,8 +83,8 @@@ chmod a-w $distdi mkdir build2 cd build2 ../$distdir/configure - $MAKE 2>stderr && { cat stderr >&2; Exit 1; } -$MAKE >out 2>&1 && { cat out; exit 1; } -cat out -$FGREP parse.c out ++$MAKE 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 +$FGREP parse.c stderr : diff --cc t/yacc-lex-cxx-alone.sh index e9548a54c,000000000..e669cbc5f mode 100755,000000..100755 --- a/t/yacc-lex-cxx-alone.sh +++ b/t/yacc-lex-cxx-alone.sh @@@ -1,116 -1,0 +1,116 @@@ +#! /bin/sh +# Copyright (C) 2011-2012 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 . + +# Yacc + C++ support for a program built only from yacc sources. +# Lex + C++ support for a program built only from lex sources. + +required='c++ yacc' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >> configure.ac << 'END' +AC_PROG_CXX +AC_PROG_LEX +AC_PROG_YACC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo bar +foo_SOURCES = foo.yy +bar_SOURCES = bar.lxx + +.PHONY: check-dist +check-dist: distdir + echo ' ' $(am__dist_common) ' ' | grep '[ /]foo\.cc' + echo ' ' $(am__dist_common) ' ' | grep '[ /]bar\.cxx' + ls -l $(distdir) + test -f $(distdir)/foo.cc + test -f $(distdir)/bar.cxx +END + +cat > foo.yy << 'END' +%{ +// Valid C++, but deliberately invalid C. +#include +#include +// "std::" qualification required by Sun C++ 5.9. +int yylex (void) { return std::getchar (); } +void yyerror (const char *s) { return; } +%} +%% +a : 'a' { exit(0); }; +%% +int main (void) +{ + yyparse (); + return 1; +} +END + +cat > bar.lxx << 'END' +%{ +#define YY_NO_UNISTD_H 1 +int isatty (int fd) { return 0; } +%} +%% +"x" return EOF; +. +%% +// Valid C++, but deliberately invalid C. +#include +int main (void) +{ + /* We don't use a 'while' loop here (like a real lexer would do) + to avoid possible hangs. */ + if (yylex () == EOF) + std::exit (0); + else + std::exit (1); +} + +/* Avoid possible link errors. */ +int yywrap (void) { return 1; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +$MAKE + +# The Yacc-derived and Lex-derived C++ sources must be created, and not +# removed once compiled (i.e., not treated like "intermediate files" in +# the GNU make sense). +test -f foo.cc +test -f bar.cxx + +if cross_compiling; then :; else + echo a | ./foo - echo b | ./foo && Exit 1 ++ echo b | ./foo && exit 1 + echo x | ./bar - echo y | ./bar && Exit 1 ++ echo y | ./bar && exit 1 + : # Don't trip on 'set -e'. +fi + +# The Yacc-derived and Lex-derived C++ sources must be shipped. +$MAKE check-dist + +# Sanity check on distribution. +$MAKE distcheck + +: diff --cc t/yacc-line.sh index 1d536eec6,4ef2c011f..fab905ef9 --- a/t/yacc-line.sh +++ b/t/yacc-line.sh @@@ -19,9 -20,10 +19,9 @@@ # See also sister test 'lex-line.test'. required='cc yacc' - . ./defs || Exit 1 + . ./defs || exit 1 cat >> configure.ac << 'END' -AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC AM_PROG_CC_C_O AC_PROG_YACC @@@ -78,23 -97,25 +78,23 @@@ for vpath in : false; d $EGREP 'line|\.y' $c_outputs # Adjusted "#line" should not contain reference to the builddir. - grep '#.*line.*build.*\.y' $c_outputs && Exit 1 + grep '#.*line.*build.*\.y' $c_outputs && exit 1 # Adjusted "#line" should not contain reference to the absolute # srcdir. - $EGREP '#.*line *"?/.*\.y' $c_outputs && Exit 1 + $EGREP '#.*line *"?/.*\.y' $c_outputs && exit 1 # Adjusted "#line" should not contain reference to the default # output file names, e.g., 'y.tab.c' and 'y.tab.h'. - grep '#.*line.*y\.tab\.' $c_outputs && Exit 1 + grep '#.*line.*y\.tab\.' $c_outputs && exit 1 # Look out for a silly regression. - grep "#.*\.y.*\.y" $c_outputs && Exit 1 + grep "#.*\.y.*\.y" $c_outputs && exit 1 if $vpath; then grep '#.*line.*"\.\./zardoz\.y"' zardoz.c - grep '#.*line.*"\.\./dir/quux\.y"' bar-quux.c - grep '#.*line.*"\.\./\.\./sub/zardoz\.y"' sub/foo-zardoz.c - grep '#.*line.*"\.\./\.\./sub/dir/quux\.y"' sub/dir/quux.c + grep '#.*line.*"\.\./zardoz\.y"' baz-zardoz.c + grep '#.*line.*"\.\./dir/quux\.y"' dir/quux.c else grep '#.*line.*"zardoz\.y"' zardoz.c - grep '#.*line.*"dir/quux\.y"' bar-quux.c - grep '#.*line.*"zardoz\.y"' sub/foo-zardoz.c - grep '#.*line.*"dir/quux\.y"' sub/dir/quux.c + grep '#.*line.*"zardoz\.y"' baz-zardoz.c + grep '#.*line.*"dir/quux\.y"' dir/quux.c fi cd $srcdir diff --cc t/yacc-subobj-nodep.sh index e0c415fda,000000000..81c11aa63 mode 100755,000000..100755 --- a/t/yacc-subobj-nodep.sh +++ b/t/yacc-subobj-nodep.sh @@@ -1,71 -1,0 +1,71 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Ensure subdirs for subdir parsers are generated when subdir objects +# are used, even when dependency tracking is disabled. + +required='cc yacc' - . ./defs || Exit 1 ++. ./defs || exit 1 + +cat >configure.ac <Makefile.am <sub1/s1.y < Makefile.am << 'END bin_PROGRAMS = maude maude_SOURCES = sub/maude.y END - -$ACLOCAL $AUTOMAKE -a - # No rule needed, the default .y.c: inference rule is enough # (but there may be an additional dependency on a dirstamp file). - grep '^sub/maude\.c:.*maude\.y' Makefile.in && Exit 1 + grep '^sub/maude\.c:.*maude\.y' Makefile.in && exit 1 - ## Try again with per-exe flags. cat > Makefile.am << 'END' bin_PROGRAMS = maude maude_SOURCES = sub/maude.y -## A particularly trickey case. +## A particularly tricky case. maude_YFLAGS = -d END - -$ACLOCAL $AUTOMAKE -a - +grep '^sub/maude-maude\.c:.*sub/maude\.y' Makefile.in # Rule should use maude_YFLAGS. - grep 'AM_YFLAGS.*maude' Makefile.in && Exit 1 + grep 'AM_YFLAGS.*maude' Makefile.in && exit 1 - # Silly regression. - grep 'maudec' Makefile.in && Exit 1 + grep 'maudec' Makefile.in && exit 1 - # Make sure the .o file is required. grep '^am_maude_OBJECTS.*maude' Makefile.in