[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {yacc-work} coverage: test lex-generated "#line" directives postpr
From: |
Stefano Lattarini |
Subject: |
[FYI] {yacc-work} coverage: test lex-generated "#line" directives postprocessing |
Date: |
Fri, 15 Apr 2011 15:56:57 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
I've pushed the attached patch to yacc-work.
Regards,
Stefano
-*-*-
coverage: test lex-generated "#line" directives postprocessing
* tests/yacc-line.test: In heading comments, add reference to new
sister test `lex-line.test'.
* tests/lex-line.test: New test.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 8 +++
tests/Makefile.am | 1 +
tests/Makefile.in | 1 +
tests/lex-line.test | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/yacc-line.test | 1 +
5 files changed, 127 insertions(+), 0 deletions(-)
create mode 100755 tests/lex-line.test
From a0e045d60639b630b06214a3f05f9f353ed73a63 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 15 Apr 2011 15:42:42 +0200
Subject: [PATCH] coverage: test lex-generated "#line" directives postprocessing
* tests/yacc-line.test: In heading comments, add reference to new
sister test `lex-line.test'.
* tests/lex-line.test: New test.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 8 +++
tests/Makefile.am | 1 +
tests/Makefile.in | 1 +
tests/lex-line.test | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/yacc-line.test | 1 +
5 files changed, 127 insertions(+), 0 deletions(-)
create mode 100755 tests/lex-line.test
diff --git a/ChangeLog b/ChangeLog
index 7343070..663f862 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-04-14 Stefano Lattarini <address@hidden>
+ coverage: test lex-generated "#line" directives postprocessing
+ * tests/yacc-line.test: In heading comments, add reference to new
+ sister test `lex-line.test'.
+ * tests/lex-line.test: New test.
+ * tests/Makefile.am (TESTS): Update.
+
+2011-04-14 Stefano Lattarini <address@hidden>
+
tests: minor improvements to a couple of yacc tests
* tests/yacc-auxdir.test: Avoid running autoconf, it's not
needed.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2c99c97..36bfd2f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -437,6 +437,7 @@ lex4.test \
lex5.test \
lexcpp.test \
lexvpath.test \
+lex-line.test \
lex-subobj-nodep.test \
lflags.test \
lflags2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 0a6e30f..8d2f67c 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -707,6 +707,7 @@ lex4.test \
lex5.test \
lexcpp.test \
lexvpath.test \
+lex-line.test \
lex-subobj-nodep.test \
lflags.test \
lflags2.test \
diff --git a/tests/lex-line.test b/tests/lex-line.test
new file mode 100755
index 0000000..27958c8
--- /dev/null
+++ b/tests/lex-line.test
@@ -0,0 +1,116 @@
+#! /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 automake lex support ensures that lex-generated C
+# files use correct "#line" directives. Try also with the
+# `subdir-object' option enabled.
+# See also sister test `yacc-line.test'.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+mkdir dir sub sub/dir
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo bar
+LDADD = $(LEXLIB)
+bar_LFLAGS = -v
+foo_SOURCES = zardoz.l
+bar_SOURCES = dir/quux.l
+## Avoid spurious failures with Solaris make.
address@hidden@: zardoz.c
address@hidden@: bar-quux.c
+END
+
+cat > sub/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_PROGRAMS = foo bar
+## We already used $(LEXLIB) above, so try @LEXLIB@ now.
+LDADD = @LEXLIB@
+foo_LFLAGS = -v
+foo_SOURCES = zardoz.l
+bar_SOURCES = dir/quux.l
+## Avoid spurious failures with Solaris make.
address@hidden@: foo-zardoz.c
+dir/address@hidden@: dir/quux.c
+END
+
+cat > zardoz.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+int main ()
+{
+ while (yylex () != EOF)
+ ;
+ return 0;
+}
+END
+
+cp zardoz.l dir/quux.l
+cp zardoz.l sub/zardoz.l
+cp zardoz.l sub/dir/quux.l
+
+c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in : false; do
+
+ if $vpath; then
+ srcdir=..
+ mkdir build
+ cd build
+ else
+ srcdir=.
+ fi
+
+ $srcdir/configure
+ $MAKE
+
+ # For debugging,
+ ls -l . sub sub/dir
+ $FGREP '.l' $c_outputs
+
+ # Adjusted "#line" should not contain reference to the builddir.
+ $EGREP '#.*line.*(build|\.\.).*\.l' $c_outputs && Exit 1
+ # Adjusted "#line" should not contain reference to the default
+ # output file names, e.g., `lex.yy.c'.
+ $EGREP '#.*line.*lex\.yy' $c_outputs && Exit 1
+ # Don't be excessively strict in grepping, to avoid spurious failures.
+ grep '#.*line.*zardoz\.l' zardoz.c
+ grep '#.*line.*quux\.l' bar-quux.c
+ grep '#.*line.*zardoz\.l' sub/foo-zardoz.c
+ grep '#.*line.*quux\.l' sub/dir/quux.c
+ cd $srcdir
+
+done
+
+:
diff --git a/tests/yacc-line.test b/tests/yacc-line.test
index 8972a3d..f760b72 100755
--- a/tests/yacc-line.test
+++ b/tests/yacc-line.test
@@ -18,6 +18,7 @@
# Check that automake yacc support ensures that yacc-generated C
# files use correct "#line" directives. Try also with the
# `subdir-object' option enabled.
+# See also sister test `lex-line.test'.
required=yacc
. ./defs || Exit 1
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {yacc-work} coverage: test lex-generated "#line" directives postprocessing,
Stefano Lattarini <=