Since I was fiddling with other patches tonight... Fixed a couple of typos in commit message (and ChangeLog entry accordingly), make some stderr grepping less paranoid (in ansi11.test and ansi8.tesat), and rebased against latest maint.
Regards, Stefano
From 3f918137b0e904afe26950741cab8b5c26c637b4 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] Tests `ansi*.test': some improvements and extensions. * tests/ansi2.test: Add a trailing `:' command. * tests/ansi9.test: Likewise. * tests/ansi10.test: Likewise. * tests/ansi3.test: Make grepping of Automake's stderr stricter. Do not exported CC=gg to configure, that's already done in ./defs since we have gcc in $required. Improve comments about sync with sister test ansi3b.test. Add a trailing `:' command. * tests/ansi3b.btest: Likewise, and improve syncing with sister test ansi3.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). Do not exported CC=gg to configure, as that's already done in ./defs (since we have gcc in $required). Make sed-driven editing of some files stricter. Add a trailing `:' command. (configure.in): Use the stub created by ./defs rather than writing it from scratch, and avoid to use obsoleted forms of macros. * tests/ansi6.test: Move the call to `set -e' earlier (just after the inclusion of ./defs). Improve comments about sync with sister test ansi7.test. Add a trailing `:' command. (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 his test should be kept in sync with... * tests/ansi11.test: New test, sister test of ansi8.test. * tests/Makefile.am (TESTS): Updated. --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/ansi10.test | 4 +++- tests/ansi11.test | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/ansi2.test | 2 ++ tests/ansi3.test | 11 +++++++++-- tests/ansi3b.test | 22 +++++++++++++++------- tests/ansi4.test | 3 ++- tests/ansi5.test | 21 +++++++++++---------- tests/ansi6.test | 17 +++++++++-------- tests/ansi7.test | 18 +++++++++--------- tests/ansi8.test | 9 +++++++-- tests/ansi9.test | 4 +++- 14 files changed, 147 insertions(+), 41 deletions(-) create mode 100755 tests/ansi11.test diff --git a/ChangeLog b/ChangeLog index b5f1433..0834c41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2010-06-18 Stefano Lattarini <stefano.lattar...@gmail.com> + + Tests `ansi*.test': some improvements and extensions. + * tests/ansi2.test: Add a trailing `:' command. + * tests/ansi9.test: Likewise. + * tests/ansi10.test: Likewise. + * tests/ansi3.test: Make grepping of Automake's stderr stricter. + Do not exported CC=gg to configure, that's already done in ./defs + since we have gcc in $required. Improve comments about sync with + sister test ansi3b.test. Add a trailing `:' command. + * tests/ansi3b.btest: Likewise, and improve syncing with sister + test ansi3.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). Do not exported CC=gg to configure, as + that's already done in ./defs (since we have gcc in $required). + Make sed-driven editing of some files stricter. Add a trailing + `:' command. + (configure.in): Use the stub created by ./defs rather than writing + it from scratch, and avoid to use obsoleted forms of macros. + * tests/ansi6.test: Move the call to `set -e' earlier (just after + the inclusion of ./defs). Improve comments about sync with sister + test ansi7.test. Add a trailing `:' command. + (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 his test + should be kept in sync with... + * tests/ansi11.test: New test, sister test of ansi8.test. + * tests/Makefile.am (TESTS): Updated. + 2010-06-13 Stefano Lattarini <stefano.lattar...@gmail.com> Add useful comment in test script obsolete.test. diff --git a/tests/Makefile.am b/tests/Makefile.am index 2771a66..8683f20 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -106,6 +106,7 @@ ansi7.test \ ansi8.test \ ansi9.test \ ansi10.test \ +ansi11.test \ ar.test \ ar2.test \ asm.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index db53cfb..0b137fc 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -317,6 +317,7 @@ ansi7.test \ ansi8.test \ ansi9.test \ ansi10.test \ +ansi11.test \ ar.test \ ar2.test \ asm.test \ diff --git a/tests/ansi10.test b/tests/ansi10.test index 88b8618..c6176e7 100755 --- a/tests/ansi10.test +++ b/tests/ansi10.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2006 Free Software Foundation, Inc. +# 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 @@ -72,3 +72,5 @@ test ! -f dir/hello_.c ./configure $MAKE test ! -f dir/hello_.c + +: diff --git a/tests/ansi11.test b/tests/ansi11.test new file mode 100755 index 0000000..f89008b --- /dev/null +++ b/tests/ansi11.test @@ -0,0 +1,42 @@ +#! /bin/sh +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Check that AM_C_PROTOTYPES is required by ansi2knr +# Keep this in sync with sister test 'ansi8.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_CC_STDC +AM_PROG_CC_C_O +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = ansi2knr +bin_PROGRAMS = hello +END + +$ACLOCAL +AUTOMAKE_fails -a +grep 'Makefile\.am:1:.* option .*ansi2knr.* used .*ANSI2KNR.* undefined' stderr +grep 'Makefile\.am:1:.* add .*AM_C_PROTOTYPES' stderr +grep 'Makefile\.am:1:.*ANSI2KNR.*AM_C_PROTOTYPES' stderr + +: diff --git a/tests/ansi2.test b/tests/ansi2.test index 77ca2c6..426c5e0 100755 --- a/tests/ansi2.test +++ b/tests/ansi2.test @@ -38,3 +38,5 @@ $ACLOCAL $AUTOMAKE grep '^all[-a-z]*:.*ANSI2KNR' Makefile.in + +: diff --git a/tests/ansi3.test b/tests/ansi3.test index e1e0c42..4b1e1fa 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -17,6 +17,9 @@ # Actual test of ansi2knr functionality. Relies on existence # of working gcc. +# 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). required=gcc . ./defs || Exit 1 @@ -54,7 +57,11 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 -grep 'Makefile.am:1:.*ansi2knr\.c' stderr -CC='gcc' ./configure +grep 'Makefile\.am:1: installing.*ansi2knr\.c' stderr +grep 'Makefile\.am:1: installing.*ansi2knr\.1' stderr + +./configure ANSI2KNR=./ansi2knr U=_ $MAKE -e ./hello + +: diff --git a/tests/ansi3b.test b/tests/ansi3b.test index ad222ff..6b3c25f 100755 --- a/tests/ansi3b.test +++ b/tests/ansi3b.test @@ -16,16 +16,18 @@ # 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. +# of working gcc. +# Please keep this in sync with sister test 'ansi3.test' (which is +# basically the same test, but with automake options defined in +# Makefile.am by AUTOMAKE_OPTIONS). required=gcc . ./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 +35,9 @@ AC_CONFIG_FILES([Makefile]) AC_OUTPUT END -echo 'bin_PROGRAMS = hello' > Makefile.am +cat > Makefile.am << 'END' +bin_PROGRAMS = hello +END cat > hello.c << 'END' #include <stdio.h> @@ -55,7 +59,11 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 -grep 'configure.in:2:.*ansi2knr\.1' stderr -CC='gcc' ./configure +grep 'configure\.in:2: installing.*ansi2knr\.c' stderr +grep 'configure\.in:2: installing.*ansi2knr\.1' stderr + +./configure ANSI2KNR=./ansi2knr U=_ $MAKE -e ./hello + +: 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..8d55de0 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 @@ -19,12 +19,13 @@ required=gcc . ./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]) +AC_OUTPUT END cat > Makefile.am << 'END' @@ -63,29 +64,29 @@ main (int argc, char *argv[]) } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a # Ignore user CFLAGS. CFLAGS= export CFLAGS -CC=gcc ./configure +./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//'`" + 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 +sed 's|^ANSI2KNR *=.*|ANSI2KNR = ./ansi2knr|' <one/Makefile.old >one/Makefile U=_ $MAKE -e ./one/joe ./two/maude + +: diff --git a/tests/ansi6.test b/tests/ansi6.test index 10196ea..d30c838 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 @@ -16,17 +16,18 @@ # Check ansi2knr on a source file in subdirectory. # From Kevin Ryde. +# Please keep this in sync with sister test 'ansi7.test' (which is +# basically the same test, with subdir-objects option). required=gcc . ./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) AC_OUTPUT END @@ -58,8 +59,6 @@ foo () } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a @@ -71,7 +70,7 @@ test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 $MAKE test -f hello_.c -test -f dir_.c # Must be in current directory. +test -f dir_.c # Must be in current directory, unlike ansi7.test. test ! -f sub/dir_.c $MAKE distclean test ! -f hello_.c @@ -83,3 +82,5 @@ test ! -f dir_.c ./configure $MAKE + +: diff --git a/tests/ansi7.test b/tests/ansi7.test index e97f517..fccd7bf 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,20 @@ # 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. +# Please keep this in sync with sister test 'ansi6.test' (which is +# basically the same test, without subdir-objects option). required=gcc . ./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) AC_OUTPUT END @@ -60,8 +60,6 @@ foo () } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a @@ -73,7 +71,7 @@ test `grep -c ac_cv_prog_cc_stdc configure` -gt 1 $MAKE test -f hello_.c -test -f sub/dir_.c # Must be in sub directory, unlike ansi6.test. +test -f sub/dir_.c # Must be in sub directory, unlike ansi6.test. test ! -f dir_.c $MAKE distclean test ! -f hello_.c @@ -85,3 +83,5 @@ test ! -f sub/dir_.c ./configure $MAKE + +: diff --git a/tests/ansi8.test b/tests/ansi8.test index 33f17dc..5b3ac6d 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.* used .*ANSI2KNR.* undefined' stderr +grep 'Makefile\.am:1:.* add .*AM_C_PROTOTYPES' stderr +grep 'Makefile\.am:1:.*ANSI2KNR.*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 + +: -- 1.7.1