automake-patches
[Top][All Lists]
Advanced

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

[PATCH] {yacc-work} tests: split yacc6.test, for better separation and c


From: Stefano Lattarini
Subject: [PATCH] {yacc-work} tests: split yacc6.test, for better separation and coverage
Date: Mon, 11 Apr 2011 23:40:33 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

This patch should have been tested quite thouroughly with Bison 2.4
and Heirloom Yacc, GNU make, FreeBSD and NetBSD make (Debian ports)
and Heirloom make.

OK for yacc-work?  I will push in 72 hours if there is no objection.

Regards,
  Stefano

-*-*-

* tests/yacc6.test: Test removed, its content extended and split
into ...
* tests/yacc-auxdir.test, tests/yacc-depend.test,
tests/yacc-line.test: ... these new tests.
* tests/yacc-depend2.test: New test, exposes the failure that
FreeBSD used to encounter in yacc6.test.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                              |   11 +++
 tests/Makefile.am                      |    5 +-
 tests/Makefile.in                      |    5 +-
 tests/{yacc6.test => yacc-auxdir.test} |   74 ++++------------------
 tests/yacc-depend.test                 |   85 ++++++++++++++++++++++++
 tests/yacc-depend2.test                |   89 +++++++++++++++++++++++++
 tests/yacc-line.test                   |  111 ++++++++++++++++++++++++++++++++
 7 files changed, 316 insertions(+), 64 deletions(-)
 rename tests/{yacc6.test => yacc-auxdir.test} (51%)
 create mode 100755 tests/yacc-depend.test
 create mode 100755 tests/yacc-depend2.test
 create mode 100755 tests/yacc-line.test
From 7c0d9cbbffbbe11bf1d863b7fe2c63cd6e86b584 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 11 Apr 2011 16:35:59 +0200
Subject: [PATCH] tests: split yacc6.test, for better separation and coverage

* tests/yacc6.test: Test removed, its content extended and split
into ...
* tests/yacc-auxdir.test, tests/yacc-depend.test,
tests/yacc-line.test: ... these new tests.
* tests/yacc-depend2.test: New test, exposes the failure that
FreeBSD used to encounter in yacc6.test.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                              |   11 +++
 tests/Makefile.am                      |    5 +-
 tests/Makefile.in                      |    5 +-
 tests/{yacc6.test => yacc-auxdir.test} |   74 ++++------------------
 tests/yacc-depend.test                 |   85 ++++++++++++++++++++++++
 tests/yacc-depend2.test                |   89 +++++++++++++++++++++++++
 tests/yacc-line.test                   |  111 ++++++++++++++++++++++++++++++++
 7 files changed, 316 insertions(+), 64 deletions(-)
 rename tests/{yacc6.test => yacc-auxdir.test} (51%)
 create mode 100755 tests/yacc-depend.test
 create mode 100755 tests/yacc-depend2.test
 create mode 100755 tests/yacc-line.test

diff --git a/ChangeLog b/ChangeLog
index c0495d5..08d7bc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-04-11  Stefano Lattarini  <address@hidden>
+
+       tests: split yacc6.test, for better separation and coverage
+       * tests/yacc6.test: Test removed, its content extended and split
+       into ...
+       * tests/yacc-auxdir.test, tests/yacc-depend.test,
+       tests/yacc-line.test: ... these new tests.
+       * tests/yacc-depend2.test: New test, exposes the failure that
+       FreeBSD used to encounter in yacc6.test.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-04-10  Stefano Lattarini  <address@hidden>
 
        coverage: test mixed C/C++ yacc-generated parsers in the same dir
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3878ac9..f14636e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -830,10 +830,13 @@ yacc.test \
 yacc2.test \
 yacc4.test \
 yacc5.test \
-yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-auxdir.test \
+yacc-line.test \
+yacc-depend.test \
+yacc-depend2.test \
 yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-nodist.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index ab0b4ee..9839cb4 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1100,10 +1100,13 @@ yacc.test \
 yacc2.test \
 yacc4.test \
 yacc5.test \
-yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-auxdir.test \
+yacc-line.test \
+yacc-depend.test \
+yacc-depend2.test \
 yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-nodist.test \
diff --git a/tests/yacc6.test b/tests/yacc-auxdir.test
similarity index 51%
rename from tests/yacc6.test
rename to tests/yacc-auxdir.test
index bbb587e..973a338 100755
--- a/tests/yacc6.test
+++ b/tests/yacc-auxdir.test
@@ -15,96 +15,46 @@
 # 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 ylwrap put in right location.
+# Test to make sure ylwrap is put in right location.
 # Report from Tim Van Holder.
-# Also make sure depcomp does not needlessly update headers.
-# Report from Paolo Bonzini.
 
-required='gcc yacc GNUmake'
 . ./defs || Exit 1
 
 set -e
 
-cat > configure.in << 'END'
-AC_INIT([yacc6], [1.0])
-# `aux' is not an acceptable file/directory name on Windows systems
+mkdir aux1 sub
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+# 'aux' is not an acceptable file/directory name on Windows systems
 AC_CONFIG_AUX_DIR([aux1])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile sub/Makefile])
 AC_PROG_CC
-AM_PROG_CC_C_O
 AC_PROG_YACC
-AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
-
-test-time-unchanged:
-       test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z
-test-time-changed:
-       test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT)
+bin_PROGRAMS = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y
 END
 
-mkdir aux1 sub
-
 cat > sub/Makefile.am << 'END'
-bin_PROGRAMS = foo bar
+bin_PROGRAMS = bar
 AM_YFLAGS = -d
-foo_SOURCES = foo.y main.c
-foo_CPPFLAGS = -DFOO
 bar_SOURCES = bar.y main.c
-BUILT_SOURCES = foo.h bar.h
 END
 
-cat > sub/foo.y << 'END'
-%{
-int yylex () {return 0;}
-void yyerror (char *s) {}
-%}
-%token TOKEN
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-cp sub/foo.y sub/bar.y
-
-cat >sub/main.c <<'EOF'
-#ifdef FOO
-#  include "foo.h"
-#else
-#  include "bar.h"
-#endif
-
-int
-main()
-{
-  return 0;
-}
-EOF
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 test -f aux1/ylwrap
 test ! -f ylwrap
 test ! -f sub/ylwrap
+grep -i 'ylwrap' Makefile.in sub/Makefile.in # For debugging.
+$FGREP '$(top_srcdir)/aux1/ylwrap' Makefile.in
 $FGREP '$(top_srcdir)/aux1/ylwrap' sub/Makefile.in
-./configure
-$MAKE
-grep '#.*line.*foo\.y' sub/foo.c
-grep '#.*line.*bar\.y' sub/bar.c
-
-$sleep
-: > z
-$sleep
-touch sub/bar.y
-$MAKE
-$MAKE test-time-unchanged
-$sleep
-sed s/TOKEN/TEKON/g sub/bar.y >sub/bar.yt
-mv -f sub/bar.yt sub/bar.y
-$MAKE
-$MAKE test-time-changed
 
 :
diff --git a/tests/yacc-depend.test b/tests/yacc-depend.test
new file mode 100755
index 0000000..2f708ec
--- /dev/null
+++ b/tests/yacc-depend.test
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010, 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/>.
+
+# Make sure depcomp does not needlessly update headers for yacc rules.
+# Report from Paolo Bonzini.
+
+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 = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y main.c
+BUILT_SOURCES = foo.h
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token TOKEN
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+
+cat > main.c << 'END'
+#include "foo.h"
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+$MAKE
+ls -l # For debugging.
+
+# Make sure foo.h is not updated if not really needed.
+$sleep
+: > my-timestamp
+$sleep
+touch foo.y
+$MAKE
+stat my-timestamp foo.* || : # For debugging.
+is_newest my-timestamp foo.h
+
+# Make sure foo.h is updated if needed.
+$sleep
+sed 's/TOKEN/TEKON/g' foo.y > t
+mv -f t foo.y
+$MAKE
+stat my-timestamp foo.* || : # For debugging.
+is_newest foo.h my-timestamp
+
+:
diff --git a/tests/yacc-depend2.test b/tests/yacc-depend2.test
new file mode 100755
index 0000000..51c1fe1
--- /dev/null
+++ b/tests/yacc-depend2.test
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010, 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/>.
+
+# Make sure depcomp does not needlessly update headers and objects
+# for yacc rules.  This test still fails with FreeBSD make (but passes
+# with NetBSD make).
+
+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 = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y main.c
+BUILT_SOURCES = foo.h
+.PHONY: debug-info test-time-unchanged test-time-changed
+debug-info:
+       ls -l
+       stat *.[ch] *.$(OBJEXT) my-timestamp || :
+test-time-unchanged: debug-info
+       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = my-timestamp
+test-time-changed: debug-info
+       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = main.$(OBJEXT)
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token TOKEN
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+
+cat > main.c << 'END'
+#include "foo.h"
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+$MAKE
+ls -l # For debugging.
+
+$sleep
+: > my-timestamp
+$sleep
+touch foo.y
+$MAKE
+$MAKE test-time-unchanged
+$sleep
+sed 's/TOKEN/TEKON/g' foo.y > t
+mv -f t foo.y
+$MAKE
+$MAKE test-time-changed
+
+:
diff --git a/tests/yacc-line.test b/tests/yacc-line.test
new file mode 100755
index 0000000..ae6dbcf
--- /dev/null
+++ b/tests/yacc-line.test
@@ -0,0 +1,111 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010, 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 yacc support ensures that yacc-generated C
+# files use correct "#line" directives.  Try also with the
+# `subdir-object' option enabled.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+mkdir dir sub sub/dir
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo bar
+AM_YFLAGS = -d
+bar_YFLAGS =
+foo_SOURCES = zardoz.y
+bar_SOURCES = dir/quux.y
+## 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
+foo_YFLAGS = -d
+foo_SOURCES = zardoz.y
+bar_SOURCES = dir/quux.y
+## Avoid spurious failures with Solaris make.
address@hidden@: foo-zardoz.c
+dir/address@hidden@: dir/quux.c
+END
+
+cat > zardoz.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%%
+x : 'x' {};
+%%
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+cp zardoz.y dir/quux.y
+cp zardoz.y sub/zardoz.y
+cp zardoz.y sub/dir/quux.y
+
+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 '.y' $c_outputs
+
+  $EGREP '#.*line.*(build|\.\.).*\.y' $c_outputs && Exit 1
+  # Don't be excessively strict in grepping, to avoid spurious failures.
+  grep '#.*line.*zardoz\.y' zardoz.c
+  grep '#.*line.*quux\.y' bar-quux.c
+  grep '#.*line.*zardoz\.y' sub/foo-zardoz.c
+  grep '#.*line.*quux\.y' sub/dir/quux.c
+  cd $srcdir
+
+done
+
+:
-- 
1.7.2.3


reply via email to

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