Hi Stefano, * Stefano Lattarini wrote on Mon, Sep 13, 2010 at 10:59:22AM CEST: > But since we are at it, we can do better, extending coverage and > making existing tests more "semantic". See the attached patch (for > maint).
ansi2knr is a really dying (and ugly) feature; when have we last seen a compiler that does not support C89? I'm not sure if it's time to deprecate it yet, but it is definitely not worth putting a lot of effort into. That said, I did a review of this patch; please read it and apply it to other testsuite patches. I don't think we actually need this particular patch unless we can find an actual use case from, let's say, the last four years. Sorry for letting you do the work. Cheers, Ralf > From 9e325c40fcd0d768eb3f30ba906406202f4870d7 Mon Sep 17 00:00:00 2001 > From: Stefano Lattarini <stefano.lattar...@gmail.com> > Date: Sat, 19 Jun 2010 09:01:45 +0200 > Subject: [PATCH] Improve and extend tests on de-ansification support. > > * tests/ansi.test: Make less sensitive to automake internal > details. Run also "make distcheck". > * tests/ansi9.test: Add a trailing `:' command. > * tests/ansi2.test: Likewise. Also, relax grepping of generated > Makefile.in slighty w.r.t. white spaces, and improve and extend slightly > comments. > * tests/ansi2a.test: New test, "semantic" counterpart of test > ansi2.test. > * tests/ansi2b.test: Likewise (and sister test of ansi2a.test). > * tests/ansi3.test: Rename to ... > * tests/ansi3a.test: ... this, for consistency. Remove grepping > of Automake's stderr w.r.t. notices about the installation of > ansi2knr.c and ansi2knr.1. Do not exported CC=gcc to configure, > that's already done in ./defs since we have gcc in $required. > Remove some obsoleted comments. Check that source files are truly > de-ansificated. Run "make check" and "make distcheck". Test that > distclean works as expected. Also try a run without forcing > de-ansification. Add a trailing `:' command. Improve and extend > heading comments. > * tests/ansi3b.test: Likewise. > * tests/ansi3c.test, ansi3d.test: New sister tests, related to > ansi3a.test and ansi3b.test. > * tests/ansi4.test: Do not create useless dummy source file > `hello.c'. Add a trailing `:' command. > * tests/ansi5.test: Move the call to `set -e' earlier (just after > the inclusion of ./defs). Use the `configure.in' stub created by > ./defs rather than writing it from scratch, and avoid obsoleted > constructs. Do not export CC=gcc to configure, that is already > done in ./defs (since we have gcc in $required). Use a much > lesser hackish way to force de-ansification. Add more checks (in > Makefile.am). Also run "make distcheck". Add a trailing `:' > command. > * tests/ansi10.test: Move more checks in Makefile.am. Run also > "make distcheck". Output slighty improved w.r.t. debugging > information. Add a trailing `:' command. Improve comments w.r.t. > related tests. Other minor related and unrelated changes. > * tests/ansi6.test: Likewise. Also, move the call to `set -e' > earlier (just after the inclusion of ./defs), and ... > (configure.in): .. use the stub created by ./defs rather than > writing it from scratch, and avoid to use obsoleted forms of > macros. > * tests/ansi7.test: Likewise. > * tests/ansi8.test: Make grepping of Automake's stderr stricter. > Add a trailing `:' command. Add comment telling that this test > should be kept in sync with... > * tests/ansi11.test: ... this new test, sister of ansi8.test. > * tests/ansi12.test: New test, for more coverage. Currently > xfailing. In this test, it is not clear which part makes it xfail. > * tests/ansi1.test: New test, from removed parts of ansi3.test. No new tests with oldish test names, please. Think of serial numbers that do not decrease. > Check that automake can install ansi2knr.c and ansi2knr.1, and > that it informs about this action. > * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated. > --- a/tests/ansi.test > +++ b/tests/ansi.test > -$AUTOCONF > ./configure > -$MAKE test1 > -$MAKE test2 > + > +$MAKE check > +$MAKE distcheck A distcheck is not necessary here, brings no extra value AFAICS, so costs only time. I'm not just being grumpy here, testsuite slowness is a real problem, with running time of roughly two days on the MSYS system I have available to test ATM, we should not be wasting another day just because we were lazy to check whether a distcheck brings in any additional value. > --- a/tests/ansi10.test > +++ b/tests/ansi10.test > @@ -15,8 +15,9 @@ > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > # Make sure ansi2knr works with $(LIBOBJS). > +# See also related tests `ansi6.test' and `ansi7.test'. > > -required=gcc > +required=gcc # FIXME: any C compiler should be ok! > . ./defs || Exit 1 > > set -e > @@ -28,11 +29,24 @@ AM_C_PROTOTYPES > AC_PROG_RANLIB > AC_LIBOBJ([hello]) > AC_CONFIG_FILES([dir/Makefile]) > +# Makefiles need to know wheter we are de-ansifing. whether ansifying, if you must use the term. For what it's worth, vim has a good and extensible spell checker, that can check comments and literals only. If you use vim anyway, you can pretty much leave it on all the time (or per filetype, with ftplugin functionality). > +AC_SUBST([ac_cv_prog_cc_stdc]) > AC_OUTPUT > END > > cat > Makefile.am << 'END' > SUBDIRS = dir > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) $(srcdir)/dir || : > + test x'$(srcdir)' = x'.' || ls -l . dir || : > + @echo; echo 'ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"'; echo > +check-local: debug-info > + if test x'$(ac_cv_prog_cc_stdc)' = x'no'; then \ > + test -f dir/hello_.c || exit 1; \ > + else \ > + test ! -r dir/hello_.c || exit 1; \ > + fi > END > > mkdir dir > @@ -59,16 +73,20 @@ $AUTOCONF > $AUTOMAKE -a > > # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > -test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > > +# Run forcing ansi2knr. > ./configure ac_cv_prog_cc_stdc=no > -$MAKE > -test -f dir/hello_.c > +$MAKE check > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' > $MAKE distclean > test ! -f dir/hello_.c > > # Also run without forcing ansi2knr, so we make sure the > # rules work with ANSI compilers. > ./configure > -$MAKE > -test ! -f dir/hello_.c > +$MAKE check > +$MAKE distcheck See above. > rename from tests/ansi3.test > rename to tests/ansi11.test > index e1e0c42..7e70ee5 100755 > --- a/tests/ansi3.test > +++ b/tests/ansi11.test > @@ -1,6 +1,5 @@ > #! /bin/sh > -# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software > -# Foundation, Inc. > +# Copyright (C) 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -15,46 +14,29 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > -# Actual test of ansi2knr functionality. Relies on existence > -# of working gcc. > +# Check that AM_C_PROTOTYPES is required by ansi2knr > +# Keep this in sync with sister test 'ansi8.test'. > > -required=gcc > . ./defs || Exit 1 > > set -e > > cat >> configure.in << 'END' > AC_PROG_CC > -AM_C_PROTOTYPES > +AC_PROG_CC_STDC > +AM_PROG_CC_C_O > AC_OUTPUT > END > > cat > Makefile.am << 'END' > -AUTOMAKE_OPTIONS = ansi2knr no-dependencies > -bin_PROGRAMS = hello > +AUTOMAKE_OPTIONS = dir/ansi2knr > +noinst_PROGRAMS = hello > END > > -cat > hello.c << 'END' > -#include <stdio.h> > -int > -main (int argc, char *argv[]) > -{ > - printf ("yeah, yeah\n"); > - return 0; > -} > -END > - > -# Ignore user CFLAGS. > -CFLAGS= > -export CFLAGS > - > -# We use gcc and not gcc -traditional as the latter fails on some > -# Linux boxes (Red Hat 5.1 in particular). > $ACLOCAL > -$AUTOCONF > -$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } > -cat stderr >&2 > -grep 'Makefile.am:1:.*ansi2knr\.c' stderr > -CC='gcc' ./configure > -ANSI2KNR=./ansi2knr U=_ $MAKE -e > -./hello > +AUTOMAKE_fails -a > +grep 'Makefile\.am:1:.*option.*ansi2knr' stderr > +grep 'Makefile\.am:1:.*ANSI2KNR.*undefined' stderr > +grep 'Makefile\.am:1:.* add.*AM_C_PROTOTYPES' stderr > + > +: > diff --git a/tests/ansi12.test b/tests/ansi12.test > new file mode 100755 > index 0000000..9c07297 > --- /dev/null > +++ b/tests/ansi12.test > @@ -0,0 +1,63 @@ > +#! /bin/sh > +# Copyright (C) 2002, 2006, 2010 Free Software Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Make sure generated *_.c files get removed if ansi2knr fails. > +# FIXME: The Makefiles generated by the current utomake fails to do so automake > +# at the moment! So this test is xfailing. > + > +required=gcc # FIXME: any C compiler should be ok! > +. ./defs || Exit 1 > + > +set -e > + > +cat >> configure.in << 'END' > +AC_PROG_CC > +AC_PROG_CC_STDC > +AM_C_PROTOTYPES > +AC_OUTPUT > +END > + > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr > +EXTRA_PROGRAMS = foo > +foo_SOURCES = foo.c > +END > + > +: > foo.c > + > +: > ansi2knr.1 > + > +cat > ansi2knr.c << 'END' > +int main(void) > +{ > + return 1; > +} > +END > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE -a > + > +# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > +grep ac_cv_prog_cc_stdc configure > +test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 > + > +./configure ac_cv_prog_cc_stdc=yes > +$MAKE -n foo_.c # make should know how to create it > +$MAKE foo_.c && Exit 1 # but should fail when actually trying create it > +test ! -r foo_.c # and should not leave it around after failing > + > +: > diff --git a/tests/ansi2.test b/tests/ansi2.test > index 77ca2c6..ff8fa41 100755 > --- a/tests/ansi2.test > +++ b/tests/ansi2.test > @@ -15,7 +15,11 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > -# Test to make sure ansi2knr built at the right time. > +# Try to check sure ansi2knr built at the right time. This is an older > +# "grepping check", kept mostly for backward-copmatibility. It might compatibility > +# require updating when automake internals are changed. Just relax or > +# remove if it becomes too fragile. > +# See also related "semantic" tests `ansi2a.test' and `ansi2b.test'. > > . ./defs || Exit 1 > > @@ -37,4 +41,6 @@ END > $ACLOCAL > $AUTOMAKE > > -grep '^all[-a-z]*:.*ANSI2KNR' Makefile.in > +grep '^ *all[-a-z]*:.*ANSI2KNR' Makefile.in > + > +: > diff --git a/tests/ansi2a.test b/tests/ansi2a.test > new file mode 100755 > index 0000000..6643686 > --- /dev/null > +++ b/tests/ansi2a.test > @@ -0,0 +1,73 @@ > +#! /bin/sh > +# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010 Free Software > +# Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Test to make sure ansi2knr built at the right time. > +# See also sister test "semantic" `ansi2b.test' and related "grepping" > +# test `ansi2.test'. > + > +required=gcc # FIXME: any C compiler should be ok! > +. ./defs || Exit 1 > + > +set -e > + > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr > +# required to set in motion all the ansi2knr machinery > +EXTRA_PROGRAMS = joe > +check-local: > + $(ANSI2KNR) | grep 'Hello, Brian and Dennis!' > +END > + > +cat >> configure.in << 'END' > +AC_PROG_CC > +AC_PROG_CC_STDC > +AM_C_PROTOTYPES > +AC_OUTPUT > +END > + > +: > ansi2knr.1 > + > +cat > ansi2knr.c << 'END' > +#include <stdio.h> > +int main(void) > +{ > + printf("Hello, Brian and Dennis!\n"); > + return 0; > +} > +END > + > +echo '#error "this file should not be compiled"' > joe.c > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE > + > +# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > + > +./configure ac_cv_prog_cc_stdc=no > + > +$MAKE > +# The $(ANSI2KNR) program should have been built. > +test -f ansi2knr > +$MAKE check > + > +# Test the distribution (this alos do a VPATH check for free). also > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' > + > +: > diff --git a/tests/ansi2b.test b/tests/ansi2b.test > new file mode 100755 > index 0000000..f0faad8 > --- /dev/null > +++ b/tests/ansi2b.test > @@ -0,0 +1,74 @@ > +#! /bin/sh > +# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010 Free Software > +# Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Test to make sure ansi2knr built at the right time. > +# See also sister test "semantic" `ansi2a.test' and related "grepping" > +# test `ansi2.test'. > + > +. ./defs || Exit 1 > + > +set -e > + > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr > +# Required to set in motion all the ansi2knr machinery. > +EXTRA_PROGRAMS = joe > +my-ansi2knr.sh: > + rm -f $@ $...@-t > + echo '#!/bin/sh' > $...@-t > + echo 'echo "Hello," "Brian" "and" "Dennis!"' >> $...@-t > + chmod a+x $...@-t && mv -f $...@-t $@ > +check-local: > + $(ANSI2KNR) | grep 'Hello, Brian and Dennis!' > +## FIXME! Cleanup code in `lib/am/ans2knr.am' remove `ansi2knr' directly. > +## So we require the following. Wouldn't it be better to remove $(ANSI2KNR) > +## instead in `lib/am/ans2knr.am'? > +CLEANFILES = my-ansi2knr.sh > +END > + > +cat >> configure.in << 'END' > +AC_PROG_CC > +AM_C_PROTOTYPES > +# We need this hack to verride $(ANSI2KNR). Trying to doing that from > +# the configure command line doesn't work. > +ANSI2KNR='./my-ansi2knr.sh' > +AC_OUTPUT > +END > + > +: > ansi2knr.1 > +: > ansi2knr.c > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE > + > +echo '#error "this file should not be compiled"' > joe.c > + > +# Unfortunately, we cannot override in the configure call, so we'll have > +# to do that later in each make invocation. > +./configure > + > +$MAKE > +# Our fake $(ANSI2KNR) program should have been built. > +test -f my-ansi2knr.sh > + > +$MAKE check > + > +# Test the distribution (this also do a VPATH check for free). > +$MAKE distcheck > + > +: > diff --git a/tests/ansi3a.test b/tests/ansi3a.test > new file mode 100755 > index 0000000..ad121b3 > --- /dev/null > +++ b/tests/ansi3a.test > @@ -0,0 +1,93 @@ > +#! /bin/sh > +# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software > +# Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Actual test of ansi2knr functionality, by forcing de-ansification > +# at make time. > +# Please keep this in sync with sister test `ansi3b.test' (which is > +# basically the same test, but with automake options defined in > +# configure.in by AM_INIT_AUTOMAKE). > +# See also related tests `ansi3c.test' and `ansi3d.test'. > + > +required=gcc # FIXME: any C compiler should be ok! > +. ./defs || Exit 1 > + > +set -e > + > +cat >> configure.in << 'END' > +AC_PROG_CC > +AM_C_PROTOTYPES > +AC_OUTPUT > +END > + > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr no-dependencies > +bin_PROGRAMS = hello > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) > + test x'$(srcdir)' = x'.' || ls -l $(builddir) > + @echo ' --- $@ ---' > + @echo ' ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo ' ANSI2KNR=$(ANSI2KNR)"' > + @echo ' U="$(U)"' > + @echo '---' Please, stick to GNU Coding Standards style output. You keep making up new kinds of "this output must stick out more from the rest" stuff, and in different ways each time, that looks incoherent when seen as a whole. Let's please move away from that in any new patches. Thanks. > +check-local: debug-info > + if test x'$(U)' = x''; then \ > + test ! -f hello_.c && test ! -r hello_.c || exit 1; \ > + else \ > + sed 's/^/ | /' hello_.c | tail -n 20; \ > + grep '^main *( *argc, *argv *)' hello_.c || exit 1; \ > + grep 'int argc;' hello_.c || exit 1; \ > + grep 'char \*argv[[]];' hello_.c || exit 1; \ > + fi > + ./hello ./hello$(EXEEXT), for GNU/Linux -> w32 cross compile with wine. > +END > + > +cat > hello.c << 'END' > +#include <stdio.h> > +int > +main (int argc, char *argv[]) > +{ > + printf ("yeah, yeah\n"); > + return 0; > +} > +END > + > +# Ignore user CFLAGS. > +CFLAGS= > +export CFLAGS > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE -a > + > +# Try to force de-ansification at make time. > +./configure > +ANSI2KNR=./ansi2knr U=_ $MAKE -e check > +ANSI2KNR=./ansi2knr U=_ $MAKE -e distcheck > + > +# Check that distclean remove de-ansificated sources. > +ANSI2KNR=./ansi2knr U=_ $MAKE -e distclean > +test ! -r hello_.c > + > +# Now try without forcing de-ansification. > +./configure > +$MAKE check > +$MAKE distcheck See above. > --- a/tests/ansi3b.test > +++ b/tests/ansi3b.test > @@ -15,17 +15,20 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > -# Actual test of ansi2knr functionality. Relies on existence > -# of working gcc. Same as ansi3.test, but with AUTOMAKE_OPTIONS > -# defined in configure.in. > +# Actual test of ansi2knr functionality, by forcing de-ansification > +# at make time. > +# Please keep this in sync with sister test `ansi3a.test' (which is > +# basically the same test, but with automake options defined in > +# Makefile.am by AUTOMAKE_OPTIONS). > +# See also related tests `ansi3c.test' and `ansi3d.test'. > > -required=gcc > +required=gcc # FIXME: any C compiler should be ok! > . ./defs || Exit 1 > > set -e > > -cat > configure.in << 'END' > -AC_INIT([hello], [0.24]) > +cat > configure.in << END > +AC_INIT([$me], [1.0]) > AM_INIT_AUTOMAKE([ansi2knr no-dependencies]) > AC_PROG_CC > AM_C_PROTOTYPES > @@ -33,7 +36,30 @@ AC_CONFIG_FILES([Makefile]) > AC_OUTPUT > END > > -echo 'bin_PROGRAMS = hello' > Makefile.am > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr no-dependencies > +bin_PROGRAMS = hello > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) > + test x'$(srcdir)' = x'.' || ls -l $(builddir) > + @echo ' --- $@ ---' > + @echo ' ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo ' ANSI2KNR=$(ANSI2KNR)"' > + @echo ' U="$(U)"' > + @echo '---' > +check-local: debug-info > + if test x'$(U)' = x''; then \ > + test ! -f hello_.c && test ! -r hello_.c || exit 1; \ > + else \ > + sed 's/^/ | /' hello_.c | tail -n 20; \ tail might not grok -n. (/usr/bin/tail on Solaris) > + grep '^main *( *argc, *argv *)' hello_.c || exit 1; \ > + grep 'int argc;' hello_.c || exit 1; \ > + grep 'char \*argv[[]];' hello_.c || exit 1; \ > + fi > + ./hello > +END > > cat > hello.c << 'END' > #include <stdio.h> > @@ -49,13 +75,22 @@ END > CFLAGS= > export CFLAGS > > -# We use gcc and not gcc -traditional as the latter fails on some > -# Linux boxes (Red Hat 5.1 in particular). > $ACLOCAL > $AUTOCONF > -$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } > -cat stderr >&2 > -grep 'configure.in:2:.*ansi2knr\.1' stderr > -CC='gcc' ./configure > -ANSI2KNR=./ansi2knr U=_ $MAKE -e > -./hello > +$AUTOMAKE -a > + > +# Try to force de-ansification at make time. > +./configure > +ANSI2KNR=./ansi2knr U=_ $MAKE -e check > +ANSI2KNR=./ansi2knr U=_ $MAKE -e distcheck > + > +# Check that distclean remove de-ansificated sources. > +ANSI2KNR=./ansi2knr U=_ $MAKE -e distclean > +test ! -r hello_.c > + > +# Now try without forcing de-ansification. > +./configure > +$MAKE check > +$MAKE distcheck > + > +: > diff --git a/tests/ansi3c.test b/tests/ansi3c.test > new file mode 100755 > index 0000000..e38c067 > --- /dev/null > +++ b/tests/ansi3c.test > @@ -0,0 +1,102 @@ > +#! /bin/sh > +# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software > +# Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Actual test of ansi2knr functionality, by forcing de-ansification > +# at configure time. Why do these "at configure time"/"at make time" have to be in separate tests? The setup overhead seems to dominate. > +# Please keep this in sync with sister test `ansi3d.test' (which is > +# basically the same test, but with automake options defined in > +# configure.in by AM_INIT_AUTOMAKE). > +# See also related tests `ansi3a.test' and `ansi3b.test'. > + > +required=gcc # FIXME: any C compiler should be ok! > +. ./defs || Exit 1 > + > +set -e > + > +cat >> configure.in << 'END' > +AC_PROG_CC > +AC_PROG_CC_STDC > +AM_C_PROTOTYPES > +# Makefiles need to know wheter we are de-ansifing. > +AC_SUBST([ac_cv_prog_cc_stdc]) > +AC_OUTPUT > +END > + > +cat > Makefile.am << 'END' > +AUTOMAKE_OPTIONS = ansi2knr > +bin_PROGRAMS = hello > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) > + test x'$(srcdir)' = x'.' || ls -l $(builddir) > + @echo ' --- $@ ---' > + @echo ' ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo ' ANSI2KNR=$(ANSI2KNR)"' > + @echo ' U="$(U)"' > + @echo '---' > +check-local: debug-info > + if test x'$(ac_cv_prog_cc_stdc)' != x'no'; then \ > + test x'$(U)' = x; \ > + test ! -f hello_.c && test ! -r hello_.c || exit 1; \ > + else \ > + test x'$(U)' = x'_'; \ > + sed 's/^/ | /' hello_.c | tail -n 20; \ > + grep '^main *( *argc, *argv *)' hello_.c || exit 1; \ > + grep 'int argc;' hello_.c || exit 1; \ > + grep 'char \*argv[[]];' hello_.c || exit 1; \ > + fi > + ./hello > +END > + > +cat > hello.c << 'END' > +#include <stdio.h> > +int > +main (int argc, char *argv[]) > +{ > + printf ("yeah, yeah\n"); > + return 0; > +} > +END > + > +# Ignore user CFLAGS. > +CFLAGS= > +export CFLAGS > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE -a > + > +# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > + > +# Try to force de-ansification at configure time. > +./configure ac_cv_prog_cc_stdc=no > +$MAKE check > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' maintainer-check clean? > +# Check that distclean remove de-ansificated sources. > +$MAKE distclean > +test ! -r hello_.c > + > +# Now try without forcing de-ansification. > +./configure > +$MAKE check > +$MAKE distcheck > + > +: > diff --git a/tests/ansi3d.test b/tests/ansi3d.test > new file mode 100755 > index 0000000..1053674 > --- /dev/null > +++ b/tests/ansi3d.test > @@ -0,0 +1,104 @@ > +#! /bin/sh > +# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software > +# Foundation, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2, or (at your option) > +# any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# Actual test of ansi2knr functionality, by forcing de-ansification > +# at configure time. > +# Please keep this in sync with sister test `ansi3b.test' (which is > +# basically the same test, but with automake options defined in > +# Makefile.am by AUTOMAKE_OPTIONS). > +# See also related tests `ansi3a.test' and `ansi3b.test'. > + > +required=gcc # FIXME: any C compiler should be ok! > +. ./defs || Exit 1 > + > +set -e > + > +cat > configure.in << END > +AC_INIT([$me], [1.0]) > +AM_INIT_AUTOMAKE([ansi2knr]) > +AC_PROG_CC > +AC_PROG_CC_STDC > +AM_C_PROTOTYPES > +# Makefiles need to know wheter we are de-ansifing. > +AC_SUBST([ac_cv_prog_cc_stdc]) > +AC_CONFIG_FILES([Makefile]) > +AC_OUTPUT > +END > + > +cat > Makefile.am << 'END' > +bin_PROGRAMS = hello > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) > + test x'$(srcdir)' = x'.' || ls -l $(builddir) > + @echo ' --- $@ ---' > + @echo ' ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo ' ANSI2KNR=$(ANSI2KNR)"' > + @echo ' U="$(U)"' > + @echo '---' > +check-local: debug-info > + if test x'$(ac_cv_prog_cc_stdc)' != x'no'; then \ > + test x'$(U)' = x; \ > + test ! -f hello_.c && test ! -r hello_.c || exit 1; \ > + else \ > + test x'$(U)' = x'_'; \ > + sed 's/^/ | /' hello_.c | tail -n 20; \ > + grep '^main *( *argc, *argv *)' hello_.c || exit 1; \ > + grep 'int argc;' hello_.c || exit 1; \ > + grep 'char \*argv[[]];' hello_.c || exit 1; \ > + fi > + ./hello > +END > + > +cat > hello.c << 'END' > +#include <stdio.h> > +int > +main (int argc, char *argv[]) > +{ > + printf ("yeah, yeah\n"); > + return 0; > +} > +END > + > +# Ignore user CFLAGS. > +CFLAGS= > +export CFLAGS > + > +$ACLOCAL > +$AUTOCONF > +$AUTOMAKE -a > + > +# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > + > +# Try to force de-ansification at configure time. > +./configure ac_cv_prog_cc_stdc=no > +$MAKE check > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' > + > +# Check that distclean remove de-ansificated sources. > +$MAKE distclean > +test ! -r hello_.c > + > +# Now try without forcing de-ansification. > +./configure > +$MAKE check > +$MAKE distcheck > + > +: > diff --git a/tests/ansi4.test b/tests/ansi4.test > index 63250a9..5672ed0 100755 > --- a/tests/ansi4.test > +++ b/tests/ansi4.test > @@ -34,9 +34,10 @@ END > > : > ansi2knr.1 > : > ansi2knr.c > -: > hello.c > > $ACLOCAL > $AUTOMAKE > > $FGREP 'ansi2knr.$(' Makefile.in > + > +: > diff --git a/tests/ansi5.test b/tests/ansi5.test > index 2652cb7..1e96b6d 100755 > --- a/tests/ansi5.test > +++ b/tests/ansi5.test > @@ -1,5 +1,5 @@ > #! /bin/sh > -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. > +# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -16,19 +16,35 @@ > > # Test for ansi2knr in another directory. > > -required=gcc > +required=gcc # FIXME: any C compiler should be ok! > . ./defs || Exit 1 > > -cat > configure.in << 'END' > -AC_INIT(one/joe.c) > -AM_INIT_AUTOMAKE(liver, 0.23) > +set -e > + > +cat >> configure.in << 'END' > AC_PROG_CC > AM_C_PROTOTYPES > -AC_OUTPUT(Makefile one/Makefile two/Makefile) > +AC_CONFIG_FILES([one/Makefile two/Makefile]) > +# Unconditionally force de-ansification. > +ANSI2KNR=./ansi2knr U=_ > +AC_OUTPUT > END > > cat > Makefile.am << 'END' > SUBDIRS = one two > +check-local: > + ## Check tha only one ans2knr program was created, in the > + ## expected location. > + test -f ./one/ansi2knr > + test ! -r ./ansi2knr > + test ! -r ./two/ansi2knr > + ## Check that de-ansification was used. The directory where > + ## the de-ansified files are put is an implementation detail. > + f=`find . -name joe_.c` && test x"$$f" != x && grep :joe: $$f > + f=`find . -name maude_.c` && test x"$$f" != x && grep :maude: $$f > + ## Check that the propgrams were built as expected. > + ./one/joe | grep :joe: > + ./two/maude | grep :maude: > END > > mkdir one two > @@ -48,7 +64,7 @@ cat > one/joe.c << 'END' > int > main (int argc, char *argv[]) > { > - printf ("joe\n"); > + printf (":joe:\n"); > return 0; > } > END > @@ -58,34 +74,21 @@ cat > two/maude.c << 'END' > int > main (int argc, char *argv[]) > { > - printf ("maude\n"); > + printf (":maude:\n"); > return 0; > } > END > > -set -e > - > $ACLOCAL > $AUTOCONF > $AUTOMAKE -a > + > # Ignore user CFLAGS. > CFLAGS= > export CFLAGS > -CC=gcc ./configure > - > -# This is ugly! If we set U at make time then the "wrong" file gets > -# included. > -find . -name '*.Po' -print \ > -| while read file; do > - base="`echo $file | sed -e 's/\.Po//'`" > - mv $file ${base}_.Po > -done > > -# So is this! If we set ANSI2KNR on the make command line then the > -# wrong value is passed to two's Makefile. > -mv one/Makefile one/Makefile.old > -sed -e 's,ANSI2KNR =,ANSI2KNR = ./ansi2knr,' < one/Makefile.old > > one/Makefile > +./configure > +$MAKE check > +$MAKE distcheck > > -U=_ $MAKE -e > -./one/joe > -./two/maude > +: > diff --git a/tests/ansi6.test b/tests/ansi6.test > index 10196ea..6a400ba 100755 > --- a/tests/ansi6.test > +++ b/tests/ansi6.test > @@ -1,5 +1,5 @@ > #! /bin/sh > -# Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc. > +# Copyright (C) 2002, 2006, 2008, 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -15,18 +15,21 @@ > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > # Check ansi2knr on a source file in subdirectory. > -# From Kevin Ryde. > +# From Kevin Ryde. Extended thanks to a report from Andreas Schwab. > +# Please keep this in sync with sister test 'ansi7.test' (which is > +# basically the same test, with subdir-objects option). > > -required=gcc > +required=gcc # FIXME: any C compiler should be ok! > . ./defs || Exit 1 > > -cat > configure.in << 'END' > -AC_INIT(ansi6, 1.0) > -AM_INIT_AUTOMAKE > +set -e > + > +cat >> configure.in << 'END' > AC_PROG_CC > AC_PROG_CC_STDC > AM_C_PROTOTYPES > -AC_CONFIG_FILES(Makefile) > +# Makefiles need to know wheter we are de-ansifing. see above > +AC_SUBST([ac_cv_prog_cc_stdc]) > AC_OUTPUT > END > > @@ -34,6 +37,27 @@ cat > Makefile.am << 'END' > AUTOMAKE_OPTIONS = ansi2knr > bin_PROGRAMS = hello > hello_SOURCES = hello.c sub/dir.c > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) $(srcdir)/sub || : > + test x'$(srcdir)' = x'.' || ls -l . sub || : > + @echo > + @echo 'ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo 'ANSI2KNR=$(ANSI2KNR)"' > + @echo 'U="(U)"' > + @echo > +check-local: debug-info > + if test x'$(ac_cv_prog_cc_stdc)' = x'no'; then \ > + test x'$(U)' = x'_'; \ > + test -f hello_.c || exit 1; \ > + : must be in current directory, unlike ansi7.test; \ > + test -f dir_.c || exit 1; \ > + else \ > + test x'$(U)' = x; \ > + test ! -r hello_.c || exit 1; \ > + test ! -r dir_.c || exit 1; \ > + fi > END > > cat > hello.c << 'END' > @@ -58,28 +82,26 @@ foo () > } > END > > -set -e > - > $ACLOCAL > $AUTOCONF > $AUTOMAKE -a > > # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > -test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > > +# Run forcing ansi2knr. > ./configure ac_cv_prog_cc_stdc=no > -$MAKE > - > -test -f hello_.c > -test -f dir_.c # Must be in current directory. > -test ! -f sub/dir_.c > +$MAKE check > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' > $MAKE distclean > -test ! -f hello_.c > -test ! -f dir_.c > +test ! -r hello_.c > +test ! -r dir_.c > > # Also run without forcing ansi2knr, so we make sure the > # rules work with ANSI compilers. > -# Report from Andreas Schwab. > - > ./configure > -$MAKE > +$MAKE check > +$MAKE distcheck > + > +: > diff --git a/tests/ansi7.test b/tests/ansi7.test > index e97f517..6f328ed 100755 > --- a/tests/ansi7.test > +++ b/tests/ansi7.test > @@ -1,5 +1,5 @@ > #! /bin/sh > -# Copyright (C) 2002, 2008 Free Software Foundation, Inc. > +# Copyright (C) 2002, 2008, 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -15,20 +15,22 @@ > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > # Check ansi2knr on a source file in subdirectory. > -# ansi6.test is the same test without subdir-objects. > -# From Kevin Ryde. > +# From Kevin Ryde. Extended thanks to a report from Andreas Schwab. > +# Please keep this in sync with sister test 'ansi6.test' (which is > +# basically the same test, without subdir-objects option). > > -required=gcc > +required=gcc # FIXME: any C compiler should be ok! > . ./defs || Exit 1 > > -cat > configure.in << 'END' > -AC_INIT(ansi6, 1.0) > -AM_INIT_AUTOMAKE > +set -e > + > +cat >> configure.in << 'END' > AC_PROG_CC > AC_PROG_CC_STDC > AM_PROG_CC_C_O > AM_C_PROTOTYPES > -AC_CONFIG_FILES(Makefile) > +# Makefiles need to know wheter we are de-ansifing. > +AC_SUBST([ac_cv_prog_cc_stdc]) > AC_OUTPUT > END > > @@ -36,6 +38,27 @@ cat > Makefile.am << 'END' > AUTOMAKE_OPTIONS = ansi2knr subdir-objects > bin_PROGRAMS = hello > hello_SOURCES = hello.c sub/dir.c > + > +.PHONY: debug-info > +debug-info: > + ls -l $(srcdir) $(srcdir)/sub || : > + test x'$(srcdir)' = x'.' || ls -l . sub || : > + @echo > + @echo 'ac_cv_prog_cc_stdc="$(ac_cv_prog_cc_stdc)"' > + @echo 'ANSI2KNR=$(ANSI2KNR)"' > + @echo 'U="(U)"' > + @echo > +check-local: debug-info > + if test x'$(ac_cv_prog_cc_stdc)' = x'no'; then \ > + test x'$(U)' = x'_'; \ > + test -f hello_.c || exit 1; \ > + : must be in subdirectory, unlike ansi6.test; \ > + test -f sub/dir_.c || exit 1; \ > + else \ > + test x'$(U)' = x; \ > + test ! -r hello_.c || exit 1; \ > + test ! -r sub/dir_.c || exit 1; \ > + fi > END > > cat > hello.c << 'END' > @@ -60,28 +83,26 @@ foo () > } > END > > -set -e > - > $ACLOCAL > $AUTOCONF > $AUTOMAKE -a > > # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do. > -test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 > +$FGREP 'ac_cv_prog_cc_stdc' configure # for debugging > +$FGREP 'ac_cv_prog_cc_stdc=' configure > > +# Run forcing ansi2knr. > ./configure ac_cv_prog_cc_stdc=no > -$MAKE > - > -test -f hello_.c > -test -f sub/dir_.c # Must be in sub directory, unlike ansi6.test. > -test ! -f dir_.c > +$MAKE check > +$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='ac_cv_prog_cc_stdc=no' > $MAKE distclean > -test ! -f hello_.c > -test ! -f sub/dir_.c > +test ! -r hello_.c > +test ! -r sub/dir_.c > > # Also run without forcing ansi2knr, so we make sure the > # rules work with ANSI compilers. > -# Report from Andreas Schwab. > - > ./configure > -$MAKE > +$MAKE check > +$MAKE distcheck > + > +: > diff --git a/tests/ansi8.test b/tests/ansi8.test > index 33f17dc..5b457b8 100755 > --- a/tests/ansi8.test > +++ b/tests/ansi8.test > @@ -1,5 +1,5 @@ > #! /bin/sh > -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. > +# Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -15,6 +15,7 @@ > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > # Check that AM_C_PROTOTYPES is required by ansi2knr > +# Keep this in sync with sister test 'ansi11.test'. > > . ./defs || Exit 1 > > @@ -27,4 +28,8 @@ END > > $ACLOCAL > AUTOMAKE_fails -a > -grep AM_C_PROTOTYPES stderr > +grep 'Makefile\.am:1:.*option.*ansi2knr' stderr > +grep 'Makefile\.am:1:.*ANSI2KNR.*undefined' stderr > +grep 'Makefile\.am:1:.* add.*AM_C_PROTOTYPES' stderr > + > +: > diff --git a/tests/ansi9.test b/tests/ansi9.test > index 4eb1820..e596c3b 100755 > --- a/tests/ansi9.test > +++ b/tests/ansi9.test > @@ -1,5 +1,5 @@ > #! /bin/sh > -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. > +# Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -60,3 +60,5 @@ $FGREP 'sub/sub$U.o: sub/sub$U.c' Makefile.in && Exit 1 > # Force ansi2knr's use, regardless of the compiler. > ./configure ac_cv_prog_cc_stdc=no > $MAKE sub/sub_.c > + > +: