automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {yacc-work} coverage: more on 'yacc -d' and recovery from delete


From: Stefano Lattarini
Subject: [PATCH] {yacc-work} coverage: more on 'yacc -d' and recovery from deleted headers
Date: Fri, 28 Jan 2011 17:01:11 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

OK for the 'yacc-work' branch?  I will push in 72 hours if
there's no objection.

Regards,
   Stefano

-*-*-

coverage: more on 'yacc -d' and recovery from deleted headers

* tests/yacc-deleted-headers.test: New test.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                       |    6 ++
 tests/Makefile.am               |    1 +
 tests/Makefile.in               |    1 +
 tests/yacc-deleted-headers.test |  154 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 tests/yacc-deleted-headers.test

From 530c4c8fb6b35c190d6ed5a296abc275882199a0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 28 Jan 2011 16:57:05 +0100
Subject: [PATCH] coverage: more on 'yacc -d' and recovery from deleted headers

* tests/yacc-deleted-headers.test: New test.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                       |    6 ++
 tests/Makefile.am               |    1 +
 tests/Makefile.in               |    1 +
 tests/yacc-deleted-headers.test |  154 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 tests/yacc-deleted-headers.test

diff --git a/ChangeLog b/ChangeLog
index 4470c28..f015452 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-28   Stefano Lattarini  <address@hidden>
+
+       coverage: more on 'yacc -d' and recovery from deleted headers
+       * tests/yacc-deleted-headers.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-01-22   Stefano Lattarini  <address@hidden>
 
        configure: look for a yacc program to be used by the testsuite
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e639b6c..905fc15 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -807,6 +807,7 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-nodist.test \
 yaccpp.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 25fc4a8..65a6e71 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1075,6 +1075,7 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-nodist.test \
 yaccpp.test \
diff --git a/tests/yacc-deleted-headers.test b/tests/yacc-deleted-headers.test
new file mode 100644
index 0000000..f47b70e
--- /dev/null
+++ b/tests/yacc-deleted-headers.test
@@ -0,0 +1,154 @@
+#! /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/>.
+
+# Tests that we can recover from deleted headers generated by `yacc -d'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = p1 p2 p3 p4
+p1_SOURCES = parse1.y main1.c
+p2_SOURCES = parse2.y main2.c
+p3_SOURCES = parse3.y main3.c parse3.h
+p4_SOURCES = parse4.y
+AM_YFLAGS = -d
+p2_YFLAGS = -d
+BUILT_SOURCES = parse1.h p2-parse2.h
+.PHONY: clean-p3 build-p3
+build-p3: p3$(EXEEXT)
+clean-p3:
+       rm -f p3$(EXEEXT)
+END
+
+cat > parse1.y << 'END'
+%{
+#include "parse1.h"
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token ZARDOZ
+%%
+x : 'x' {};
+%%
+END
+
+cat > main1.c << 'END'
+#include "parse1.h"
+int main (void)
+{
+  return ZARDOZ + yyparse ();
+}
+END
+
+sed 's/"parse1\.h"/"p2-parse2.h"/' parse1.y > parse2.y
+sed 's/"parse1\.h"/"p2-parse2.h"/' main1.c > main2.c
+
+sed 's/"parse1\.h"/"parse3.h"/' parse1.y > parse3.y
+sed 's/"parse1\.h"/"parse3.h"/' main1.c > main3.c
+
+cat > parse4.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%%
+x : 'x' {};
+%%
+int main (void)
+{
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
+headers='parse1.h p2-parse2.h parse3.h parse4.h'
+
+# Check that we remake only the necessary headers.
+
+rm -f $headers
+$MAKE parse1.h
+test -f parse1.h
+test ! -r p2-parse2.h
+test ! -r parse3.h
+test ! -r parse4.h
+
+rm -f $headers
+$MAKE p2-parse2.h
+test ! -r parse1.h
+test -f p2-parse2.h
+test ! -r parse3.h
+test ! -r parse4.h
+
+rm -f $headers
+$MAKE parse3.h
+test ! -r parse1.h
+test ! -r p2-parse2.h
+test -f parse3.h
+test ! -r parse4.h
+# Since we declared parse3.h into $(p3_SOURCES), make should be
+# able to rebuild it automatically before remaking `p3'.
+rm -f $headers
+$MAKE clean-p3
+test ! -f parse3.h # Sanity check.
+$MAKE build-p3
+test -f parse3.h
+
+$MAKE
+
+rm -f $headers
+$MAKE parse4.h
+test ! -r parse1.h
+test ! -r p2-parse2.h
+test ! -r parse3.h
+test -f parse4.h
+
+# Now remake all the headers together.
+
+rm -f $headers
+$MAKE $headers
+test -f parse1.h
+test -f p2-parse2.h
+test -f parse3.h
+test -f parse4.h
+
+# Most headers should be remade by "make all".
+
+rm -f $headers
+$MAKE all
+test -f parse1.h
+test -f p2-parse2.h
+test -f parse3.h
+# parse4.h is not declared in any *_SOURCES variable, nor
+# #included by any C source file, so that it shouldn't be
+# rebuilt by "make all".
+test ! -r parse4.h
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]