On Saturday 22 January 2011, Ralf Wildenhues wrote: > * Stefano Lattarini wrote on Sat, Jan 22, 2011 at 02:38:55PM CET: > > > or add an XFAILing test that exposes this change? > > > > > Well, to make amend, I can add a bunch of tests verifying that the > > idiom holds for the whole lot of *FLAGS variables. Attached is my > > attempt for YFLAGS. Should I add the checks for the other *FLAGS > > variables in separate tests, or in the same one (properly renaming > > it then, obviously)? > > Why not all in one test, since you don't need any extra tools to > test them. > I agree. Done in the attached patch.
> specflg11.test comes to mind as name, although I'm sure you > won't like it. ;-) > Indeed. But maybe `specflg-dummy.test' is a good compromise :-) > Thanks! > Ralf > Regards, Stefano
From ffebc5ac5b1ae7339ff6d17ff61343b70125e8aa Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sat, 22 Jan 2011 18:09:51 +0100 Subject: [PATCH] coverage: test semantics of "dummy" per-object flags * tests/specflg-dummy.test: Check that we can "fool" automake into thinking that per-object CFLAGS are used by simply doing `foo_CFLAGS = $(AM_CFLAGS)', even if AM_CFLAGS is undefined. Similarly for other *FLAGS variables (such as CXXFLAGS, YFLAGS, LDFLAGS, ...). * tests/Makefile.am (TESTS): Update. Suggestion by Ralf Wildenhues. --- ChangeLog | 11 ++ tests/Makefile.am | 3 +- tests/Makefile.in | 3 +- tests/specflg-dummy.test | 245 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+), 2 deletions(-) create mode 100755 tests/specflg-dummy.test diff --git a/ChangeLog b/ChangeLog index 7c42b84..28666e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-01-22 Stefano Lattarini <stefano.lattar...@gmail.com> + coverage: test semantics of "dummy" per-object flags + * tests/specflg-dummy.test: Check that we can "fool" automake + into thinking that per-object CFLAGS are used by simply doing + `foo_CFLAGS = $(AM_CFLAGS)', even if AM_CFLAGS is undefined. + Similarly for other *FLAGS variables (such as CXXFLAGS, YFLAGS, + LDFLAGS, ...). + * tests/Makefile.am (TESTS): Update. + Suggestion by Ralf Wildenhues. + +2011-01-22 Stefano Lattarini <stefano.lattar...@gmail.com> + tests: fix spurious failures in yflags*.test * tests/yflags.test: Remove 'YACC' from the environment, so that it won't be erroneously picked up by `make -e'. diff --git a/tests/Makefile.am b/tests/Makefile.am index 713dd92..78bacf2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to create Makefile.in # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -668,6 +668,7 @@ specflg7.test \ specflg8.test \ specflg9.test \ specflg10.test \ +specflg-dummy.test \ spell.test \ spell2.test \ spell3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 45adb04..18cb337 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -16,7 +16,7 @@ @SET_MAKE@ # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -935,6 +935,7 @@ specflg7.test \ specflg8.test \ specflg9.test \ specflg10.test \ +specflg-dummy.test \ spell.test \ spell2.test \ spell3.test \ diff --git a/tests/specflg-dummy.test b/tests/specflg-dummy.test new file mode 100755 index 0000000..bdabb49 --- /dev/null +++ b/tests/specflg-dummy.test @@ -0,0 +1,245 @@ +#! /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 <http://www.gnu.org/licenses/>. + +# Check that we can "fool" automake into thinking that per-object +# CFLAGS are used by simply doing `foo_CFLAGS = $(AM_CFLAGS)', even +# if AM_CFLAGS is undefined. Similarly for other *FLAGS variables +# (CXXFLAGS, YFLAGS, LDFLAGS, ...) + +. ./defs || Exit 1 + +set -e + +# Disable shell globbing if possible. +(set +f) >/dev/null 2>&1 && set +f + +oIFS=$IFS +nl=' +' + +matches= +add_match () +{ + matches="$matches$nl$1" +} + +do_check () +{ + IFS=$nl + for string in $matches; do + IFS=$oIFS + $FGREP "$string" Makefile.in + done + IFS=$oIFS +} + +# Fake libtool presence, so that we won't have to require it. +cat > acinclude.m4 <<END +AC_DEFUN([AC_PROG_LIBTOOL], [AC_SUBST([LIBTOOL], [dummy])]) +END +: > ltmain.sh + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_CXX +AC_PROG_YACC +AC_PROG_LEX +AC_PROG_F77 +AC_PROG_FC +AM_PROG_GCJ +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AM_PROG_UPC +AC_PROG_OBJC +AM_PROG_CC_C_O +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = +lib_LIBRARIES = +lib_LTLIBRARIES = +END + +$ACLOCAL + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog1 +prog1_SOURCES = source1.c +prog1_CFLAGS = $(AM_CFLAGS) +END + +add_match 'prog1-source1.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog2 +prog2_SOURCES = source2.c +prog2_CPPFLAGS = $(AM_CPPFLAGS) +END + +add_match 'prog2-source2.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog3 +prog3_SOURCES = source3.cxx +prog3_CXXFLAGS = $(AM_CXXFLAGS) +END + +add_match 'prog3-source3.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog4 +prog4_SOURCES = source4.c++ +prog4_CPPFLAGS = $(AM_CPPFLAGS) +END + +add_match 'prog4-source4.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog5 +prog5_SOURCES = source5.f +prog5_FFLAGS = $(AM_FFLAGS) +END + +add_match 'prog5-source5.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog6 +prog6_SOURCES = source6.f90 +prog6_FCFLAGS = $(AM_FCFLAGS) +END + +add_match 'prog6-source6.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog7 +prog7_SOURCES = source7.r +prog7_RFLAGS = $(AM_RFLAGS) +END + +add_match 'prog7-source7.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog8 +prog8_SOURCES = source8.java +prog8_GCJFLAGS = $(AM_GCJFLAGS) +END + +add_match 'prog8-source8.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog9 +prog9_SOURCES = source9.upc +prog9_UPCFLAGS = $(AM_UPCFLAGS) +END + +add_match 'prog9-source9.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += prog10 +prog10_SOURCES = source10.m +prog10_OBJCFLAGS = $(AM_OBJCFLAGS) +END + +add_match 'prog10-source10.$(OBJEXT)' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += linkprog +linkprog_SOURCES = linkprog.c +linkprog_LDFLAGS = $(AM_LDFLAGS) +END + +add_match 'linkprog_LINK =' + +cat >> Makefile.am <<'END' +lib_LIBRARIES += lib-static.a +lib_static_a_SOURCES = static123.c +lib_static_a_CFLAGS = $(AM_CFLAGS) +END + +add_match 'lib_static_a-static123.$(OBJEXT)' + +cat >> Makefile.am <<'END' +lib_LTLIBRARIES += lib-shared1.la +lib_shared1_la_SOURCES = shared1.c +lib_shared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) +END + +add_match 'lib_shared1_la-shared1.lo' + +cat >> Makefile.am <<'END' +lib_LTLIBRARIES += lib-shared2.la +lib_shared2_la_SOURCES = shared2.cc +lib_shared2_la_CXXFLAGS = $(AM_CXXFLAGS) +END + +add_match 'lib_shared2_la-shared2.lo' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += parse1 +parse1_SOURCES = parse.y +parse1_YFLAGS = $(AM_YFLAGS) +END + +add_match 'parse1-parse.c' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += parse2 +parse2_SOURCES = parse.ypp +parse2_YFLAGS = $(AM_YFLAGS) +END + +add_match 'parse2-parse.cpp' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += lexer1 +lexer1_SOURCES = lex.l +lexer1_LFLAGS = $(AM_YFLAGS) +END + +add_match 'lexer1-lex.c' + +cat >> Makefile.am <<'END' +bin_PROGRAMS += lexer2 +lexer2_SOURCES = lexer.ll +lexer2_LFLAGS = $(AM_YFLAGS) +END + +add_match 'lexer2-lexer.cc' + +# For debugging. +cat Makefile.am + +$AUTOMAKE -a +do_check + +sed 's|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|' Makefile.am >> t1 +sed 's|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|' t1 >> t2 +sed 's|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|' t2 >> t3 +sed 's|^\(.*\)FLAGS *=|sub_\1FLAGS =|' t3 >> t4 + +cat - t4 > Makefile.am <<'END' +AUTOMAKE_OPTIONS = subdir-objects +END + +rm -f t[0-9] + +# For debugging. +cat Makefile.am + +$AUTOMAKE +do_check + +: -- 1.7.2.3