From: Stefano Lattarini Date: Fri, 13 May 2011 14:09:10 +0000 (+0200) Subject: lex tests: make test on Lex dependency tracking more "semantic" X-Git-Tag: ylwrap-refactor-abandoned-branch~17^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b67712acad6d2b0be448687c76e69a43b71e27b4;p=thirdparty%2Fautomake.git lex tests: make test on Lex dependency tracking more "semantic" * tests/lex4.test: Renamed ... * tests/lex-depend-grep.test: ... to this, and extended. * tests/lex-depend.test, tests/lex-depend-cxx.test: ... these new tests. * tests/Makefile.am (TESTS): Update. --- diff --git a/ChangeLog b/ChangeLog index 57916e79f..2577f1428 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-05-13 Stefano Lattarini + + lex tests: make test on Lex dependency tracking more "semantic" + * tests/lex4.test: Renamed ... + * tests/lex-depend-grep.test: ... to this, and extended. + * tests/lex-depend.test, tests/lex-depend-cxx.test: ... these + new tests. + * tests/Makefile.am (TESTS): Update. + 2011-05-13 Stefano Lattarini lex tests: remove erroneous check about ylwrap distribution diff --git a/tests/Makefile.am b/tests/Makefile.am index 5fef8f1fe..76be331b2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -442,10 +442,12 @@ ldflags.test \ lex.test \ lex2.test \ lex3.test \ -lex4.test \ lex5.test \ lexcpp.test \ lexvpath.test \ +lex-depend.test \ +lex-depend-cxx.test \ +lex-depend-grep.test \ lex-line.test \ lex-subobj-nodep.test \ lflags.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index ab57160b3..c99006207 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -713,10 +713,12 @@ ldflags.test \ lex.test \ lex2.test \ lex3.test \ -lex4.test \ lex5.test \ lexcpp.test \ lexvpath.test \ +lex-depend.test \ +lex-depend-cxx.test \ +lex-depend-grep.test \ lex-line.test \ lex-subobj-nodep.test \ lflags.test \ diff --git a/tests/lex-depend-cxx.test b/tests/lex-depend-cxx.test new file mode 100755 index 000000000..860a96f3a --- /dev/null +++ b/tests/lex-depend-cxx.test @@ -0,0 +1,90 @@ +#! /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 . + +# Test to make sure dependencies work with Lex/C++. +# Test synthesized from PR automake/6. + +required=lex +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CXX +AM_PROG_LEX +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_PROGRAMS = joe moe +joe_SOURCES = joe.ll +moe_SOURCES = moe.l++ +LDADD = $(LEXLIB) + +.PHONY: test-deps-exist +test-deps-exist: + ls -l $(DEPDIR) ;: For debugging. + test -f $(DEPDIR)/joe.Po + test -f $(DEPDIR)/moe.Po + +.PHONY: test-obj-updated +test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT) + stat older my-hdr.hxx joe.$(OBJEXT) moe.$(OBJEXT) || : + test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT) + test `ls -t older moe.$(OBJEXT) | sed 1q` = moe.$(OBJEXT) +END + +cat > joe.ll << 'END' +%% +"foo" return EOF; +. +%% +#include "my-hdr.hxx" +int main (int argc, char **argv) +{ + printf("Hello, World!\n"); + return 0; +} +END + +cp joe.ll moe.l++ + +cat > my-hdr.hxx <<'END' +// This header contains deliberetly invalid C (but valid C++) +#include +using namespace std; +END + +$ACLOCAL +$AUTOMAKE -a + +$FGREP joe.Po Makefile.in +$FGREP moe.Po Makefile.in + +$AUTOCONF +# Try to enable dependency tracking if possible, even if that means +# using slow dependency extractors. +./configure --enable-dependency-tracking + +$MAKE test-deps-exist +$MAKE + +: > older +$sleep +touch my-hdr.hxx +$MAKE test-obj-updated + +: diff --git a/tests/lex4.test b/tests/lex-depend-grep.test similarity index 66% rename from tests/lex4.test rename to tests/lex-depend-grep.test index b171160dc..468d31314 100755 --- a/tests/lex4.test +++ b/tests/lex-depend-grep.test @@ -15,8 +15,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test to make sure dependencies work with .ll files. -# Test synthesized from PR automake/6. +# Test to make sure dependencies for Lex and C/C++ does not break +# in obvious ways. See PR automake/6, and related semantic tests +# `lex-depend.test' and `lex-depend-cxx.test'. . ./defs || Exit 1 @@ -29,13 +30,20 @@ AM_PROG_LEX END cat > Makefile.am << 'END' -bin_PROGRAMS = zoo +bin_PROGRAMS = zoo foo zoo_SOURCES = joe.ll +foo_SOURCES = moe.l +noinst_PROGRAMS = zardoz +zardoz_SOURCES = _0.l _1.ll _2.lxx _3.l++ _4.lpp END $ACLOCAL $AUTOMAKE -a -$FGREP joe.Po Makefile.in +$EGREP '([mj]oe|_[01234]|include|\.P)' Makefile.in # For debugging. + +for x in joe moe _0 _1 _2 _3 _4; do + grep "include.*$x\.Po" Makefile.in +done : diff --git a/tests/lex-depend.test b/tests/lex-depend.test new file mode 100755 index 000000000..13d5554df --- /dev/null +++ b/tests/lex-depend.test @@ -0,0 +1,83 @@ +#! /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 . + +# Test to make sure automatic dependency tracking work with Lex/C. +# Test suggested by PR automake/6. + +required=lex +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AM_PROG_LEX +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = zoo +zoo_SOURCES = joe.l +LDADD = $(LEXLIB) + +.PHONY: test-deps-exist +test-deps-exist: + ls -l $(DEPDIR) ;: For debugging. + test -f $(DEPDIR)/joe.Po + +.PHONY: test-obj-updated +test-obj-updated: joe.$(OBJEXT) + stat older my-hdr.h joe.$(OBJEXT) || : For debugging. + test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT) +END + +cat > joe.l << 'END' +%% +"foo" return EOF; +. +%% +#include "my-hdr.h" +int main (void) +{ + printf("%s\n", MESSAGE); + return 0; +} +END + +cat > my-hdr.h <<'END' +#include +#define MESSAGE "Hello, World!" +END + +$ACLOCAL +$AUTOMAKE -a + +$FGREP joe.Po Makefile.in + +$AUTOCONF +# Try to enable dependency tracking if possible, even if that means +# using slow dependency extractors. +./configure --enable-dependency-tracking + +$MAKE test-deps-exist +$MAKE + +: > older +$sleep +touch my-hdr.h +$MAKE test-obj-updated + +: