]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
yacc: add some tests on bison support (still xfailing)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 4 Jan 2011 22:54:50 +0000 (23:54 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 12 Apr 2011 13:52:07 +0000 (15:52 +0200)
Related to automake bug#7648 and PR automake/491.

* tests/bison-skeleton-cxx.test: New test.
* tests/bison-skeleton.test: New test.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/yacc-bison-skeleton-cxx.test [new file with mode: 0755]
tests/yacc-bison-skeleton.test [new file with mode: 0755]

index d1ebf21e576c8a85aef1a1d97abb9269f0a84521..120e385be08767488f33b62bebbbec84839c527e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: add some tests on bison support (still xfailing)
+       Related to automake bug#7648 and PR automake/491.
+       * tests/bison-skeleton-cxx.test: New test.
+       * tests/bison-skeleton.test: New test.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated.
+
 2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: test for automake bug#8485 (known regression)
index 3191922d590a335b8c253238cb91ee6eb9e92522..dddf3617af3ca62a6d125d53b1b2affdc7e8245f 100644 (file)
@@ -19,6 +19,8 @@
 XFAIL_TESTS = \
 all.test \
 auxdir2.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
 cond17.test \
 gcj6.test \
 pr8365-remake-timing.test \
@@ -835,6 +837,8 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
 yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-dist-nobuild-subdir.test \
index f06f1f751d311938dfef3aaefb030026230759c1..31320144f8638e15b399b9d43c245ab33f8c74a0 100644 (file)
@@ -275,6 +275,8 @@ top_srcdir = @top_srcdir@
 XFAIL_TESTS = \
 all.test \
 auxdir2.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
 cond17.test \
 gcj6.test \
 pr8365-remake-timing.test \
@@ -1105,6 +1107,8 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
 yacc-deleted-headers.test \
 yacc-dist-nobuild.test \
 yacc-dist-nobuild-subdir.test \
diff --git a/tests/yacc-bison-skeleton-cxx.test b/tests/yacc-bison-skeleton-cxx.test
new file mode 100755 (executable)
index 0000000..b080441
--- /dev/null
@@ -0,0 +1,100 @@
+#! /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 bison + bison's C++ skeleton + C++ works.
+# For Automake bug#7648 and PR automake/491.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.yy foo.cc
+
+# This is required even with %defines in zardoz.yy.
+AM_YFLAGS = -d
+
+BUILT_SOURCES = zardoz.hh
+EXTRA_DIST = stack.hh location.hh position.hh
+END
+
+cat > zardoz.yy << 'END'
+%skeleton "lalr1.cc"
+%defines
+
+%{
+#define YYSTYPE int
+int yylex(YYSTYPE* yylval_param);
+%}
+
+%%
+start :        /* empty */
+%%
+
+int
+yylex(YYSTYPE*)
+{
+    return 0;
+}
+
+void
+yy::parser::error(const yy::parser::location_type&, const std::string& m)
+{
+    return;
+}
+END
+
+cat > foo.cc << 'END'
+#include "zardoz.hh"
+
+using namespace std;
+
+int
+main(int argc, char** argv)
+{
+  yy::parser my_parser;
+  return my_parser.parse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try a VPATH build first.
+mkdir build
+cd build
+../configure YACC='bison -y'
+$MAKE
+cd ..
+
+# Now try an in-tree build.
+./configure YACC='bison -y'
+$MAKE
+
+# Check that distribution is self-contained, and do not require
+# bison to be built.
+env YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE -e distcheck
+
+:
diff --git a/tests/yacc-bison-skeleton.test b/tests/yacc-bison-skeleton.test
new file mode 100755 (executable)
index 0000000..cc89a3d
--- /dev/null
@@ -0,0 +1,74 @@
+#! /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 bison + bison's skeleton works.
+# For Automake bug#7648 and PR automake/491.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.y foo.c
+AM_YFLAGS = -d --skeleton glr.c
+END
+
+# Parser.
+cat > zardoz.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (const char *s) { return; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > foo.c << 'END'
+#include "zardoz.h"
+int main (void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try a VPATH build first.
+mkdir build
+cd build
+../configure YACC='bison -y'
+$MAKE
+cd ..
+
+# Now try an in-tree build.
+./configure YACC='bison -y'
+$MAKE
+
+# Check that distribution is self-contained, and do not require
+# bison to be built.
+env YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE -e distcheck
+
+: