I've pushed the attached patch to yacc-work. The new testcases should correctly capture and expose the missing features in bison support; to ensure this, I've tested them with an experimental patch series I'm writing to add those features: the tests passed.
Regards, Stefano
From 395e5abd368bba4ecd6a1934ad5ceeebc73ba4b3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Tue, 4 Jan 2011 23:54:50 +0100 Subject: [PATCH] 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): Update. --- ChangeLog | 8 +++ tests/Makefile.am | 4 ++ tests/Makefile.in | 4 ++ tests/yacc-bison-skeleton-cxx.test | 100 ++++++++++++++++++++++++++++++++++++ tests/yacc-bison-skeleton.test | 74 ++++++++++++++++++++++++++ 5 files changed, 190 insertions(+), 0 deletions(-) create mode 100755 tests/yacc-bison-skeleton-cxx.test create mode 100755 tests/yacc-bison-skeleton.test diff --git a/ChangeLog b/ChangeLog index d1ebf21..120e385 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-04-12 Stefano Lattarini <stefano.lattar...@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.lattar...@gmail.com> + coverage: test for automake bug#8485 (known regression) * tests/yacc-dist-nobuild-subdir.test: New test. * tests/Makefile.am (TESTS, XFAIL_TESTS): Update. diff --git a/tests/Makefile.am b/tests/Makefile.am index 3191922..dddf361 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f06f1f7..3132014 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 0000000..b080441 --- /dev/null +++ b/tests/yacc-bison-skeleton-cxx.test @@ -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 index 0000000..cc89a3d --- /dev/null +++ b/tests/yacc-bison-skeleton.test @@ -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 + +: -- 1.7.2.3