]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
lex tests: make test on Lex dependency tracking more "semantic"
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 13 May 2011 14:09:10 +0000 (16:09 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 13 May 2011 19:15:53 +0000 (21:15 +0200)
* 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.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/lex-depend-cxx.test [new file with mode: 0755]
tests/lex-depend-grep.test [moved from tests/lex4.test with 66% similarity]
tests/lex-depend.test [new file with mode: 0755]

index 57916e79f73cae0ad1b5209e8139e3b08ddd52bb..2577f14281006c663ccc8eaf6e155911a8cb76ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        lex tests: remove erroneous check about ylwrap distribution
index 5fef8f1fece29b5615b9a4d8b56de3c26d2315fe..76be331b2d22a916ccc4313ecdba02ee8a14f9d9 100644 (file)
@@ -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 \
index ab57160b35e82a7cfe73ae5e34a3979b63f78909..c99006207b9e02e6b9570c0ba6696fa72f56d7bd 100644 (file)
@@ -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 (executable)
index 0000000..860a96f
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 <cstdio>
+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
+
+:
similarity index 66%
rename from tests/lex4.test
rename to tests/lex-depend-grep.test
index b171160dc006dbf3be8d8079f50749cb1960c5cb..468d3131466a8a2a46df0697b5fef13a44781b4a 100755 (executable)
@@ -15,8 +15,9 @@
 # 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 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 (executable)
index 0000000..13d5554
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 <stdio.h>
+#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
+
+: