[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {yacc-work} lex tests: make test on Lex dependency tracking more "
From: |
Stefano Lattarini |
Subject: |
[FYI] {yacc-work} lex tests: make test on Lex dependency tracking more "semantic" |
Date: |
Sat, 14 May 2011 20:29:12 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
* 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 | 9 +++
tests/Makefile.am | 4 +-
tests/Makefile.in | 4 +-
tests/lex-depend-cxx.test | 90 +++++++++++++++++++++++++++++
tests/{lex4.test => lex-depend-grep.test} | 16 ++++-
tests/lex-depend.test | 83 ++++++++++++++++++++++++++
6 files changed, 200 insertions(+), 6 deletions(-)
create mode 100755 tests/lex-depend-cxx.test
rename tests/{lex4.test => lex-depend-grep.test} (66%)
create mode 100755 tests/lex-depend.test
diff --git a/ChangeLog b/ChangeLog
index 57916e7..2577f14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2011-05-13 Stefano Lattarini <address@hidden>
+ 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 <address@hidden>
+
lex tests: remove erroneous check about ylwrap distribution
* tests/lex5.test: Do not check that the ylwrap script is *not*
distributed when there is only one lexer, as ylwrap is in fact
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5fef8f1..76be331 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 ab57160..c990062 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 0000000..860a96f
--- /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 <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
+
+:
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 b171160..468d313 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 <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
index 0000000..13d5554
--- /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 <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
+
+:
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {yacc-work} lex tests: make test on Lex dependency tracking more "semantic",
Stefano Lattarini <=