From 6bceecd1b429f661ecca3e819051149d3be6af90 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 20 Oct 2011 11:55:01 +0200 Subject: [PATCH] coverage: undistributed '.am' and '.m4' files are diagnosed The stub rules emitted to work around the "deleted header problem" for `.m4' files (included by autoconf in e.g., configure.ac) and for `.am' files (included by automake in e.g., Makefile.am) should not prevent "make" from correctly complaining when such a required file is missing from a distribution tarball. * tests/dist-missing-am.test: New test. * tests/dist-missing-m4.test: Likewise. * tests/dist-missing-included-m4.test: Likewise. * tests/Makefile.am (TESTS): Add them. Suggestion by Ralf Wildenhues. --- ChangeLog | 14 ++++++++ tests/dist-missing-am.test | 70 ++++++++++++++++++++++++++++++++++++ tests/dist-missing-included-m4.test | 70 ++++++++++++++++++++++++++++++++++++ tests/dist-missing-m4.test | 72 +++++++++++++++++++++++++++++++++++++ 4 files changed, 226 insertions(+) create mode 100755 tests/dist-missing-am.test create mode 100755 tests/dist-missing-included-m4.test create mode 100755 tests/dist-missing-m4.test diff --git a/ChangeLog b/ChangeLog index 01a5997..51d2dd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-11-22 Stefano Lattarini + coverage: undistributed '.am' and '.m4' files are diagnosed + The stub rules emitted to work around the "deleted header problem" + for `.m4' files (included by autoconf in e.g., configure.ac) and + for `.am' files (included by automake in e.g., Makefile.am) should + not prevent "make" from correctly complaining when such a required + file is missing from a distribution tarball. + * tests/dist-missing-am.test: New test. + * tests/dist-missing-m4.test: Likewise. + * tests/dist-missing-included-m4.test: Likewise. + * tests/Makefile.am (TESTS): Add them. + Suggestion by Ralf Wildenhues. + +2011-11-22 Stefano Lattarini + coverage: required but missing '.am' and '.m4' files are diagnosed The stub rules emitted to work around the "deleted header problem" for `.m4' files (included by autoconf in e.g., configure.ac) and diff --git a/tests/dist-missing-am.test b/tests/dist-missing-am.test new file mode 100755 index 0000000..49e82aa --- /dev/null +++ b/tests/dist-missing-am.test @@ -0,0 +1,70 @@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# The stub rules emitted to work around the "deleted header problem" +# for `.am' files shouldn't prevent "make" from diagnosing a missing +# required `.am' file from a distribution tarball. +# See discussion about automake bug#9768. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'END' +include $(srcdir)/foobar.am +include $(srcdir)/zardoz.am +END + +: > foobar.am +: > zardoz.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.am' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/zardoz.am # Sanity check. + rm -f $distdir/zardoz.am + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#10111. + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output +# FIXME: enable this stricter grepping, once bug#9768 has been taken +# FIXME: care of. +# # 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. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: diff --git a/tests/dist-missing-included-m4.test b/tests/dist-missing-included-m4.test new file mode 100755 index 0000000..56ba24c --- /dev/null +++ b/tests/dist-missing-included-m4.test @@ -0,0 +1,70 @@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# The stub rules emitted to work around the "deleted header problem" +# for `.m4' files shouldn't prevent "make" from diagnosing a missing +# required `.m4' file from a distribution tarball. +# See discussion about automake bug#9768. +# See also sister test `dist-missing-m4.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +m4_include([foobar.m4]) +m4_include([zardoz.m4]) +AC_OUTPUT +END + +: > foobar.m4 +: > zardoz.m4 + +: > Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.m4' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/zardoz.m4 # Sanity check. + rm -f $distdir/zardoz.m4 + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#10111. + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output + # 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. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: diff --git a/tests/dist-missing-m4.test b/tests/dist-missing-m4.test new file mode 100755 index 0000000..a2618e9 --- /dev/null +++ b/tests/dist-missing-m4.test @@ -0,0 +1,72 @@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# The stub rules emitted to work around the "deleted header problem" +# for `.m4' files shouldn't prevent "make" from diagnosing a missing +# required `.m4' file from a distribution tarball. +# See discussion about automake bug#9768. +# See also sister test `dist-missing-included-m4.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +m4_pattern_forbid([^MY_]) +MY_FOOBAR || exit 1 +MY_ZARDOZ || exit 1 +AC_OUTPUT +END + +mkdir m4 +echo 'AC_DEFUN([MY_FOOBAR], [:])' > m4/foobar.m4 +echo 'AC_DEFUN([MY_ZARDOZ], [:])' > m4/zardoz.m4 + +echo 'ACLOCAL_AMFLAGS = -I m4' > Makefile.am + +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.m4' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/m4/zardoz.m4 # Sanity check. + rm -f $distdir/m4/zardoz.m4 + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#10111. + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output + # 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. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: -- 2.7.4