From 3d461fdcefdb9fcb1d4cfafc0226906c00ff77a3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 8 Jun 2010 16:32:40 +0200 Subject: [PATCH] New tests, for bugs in Yacc/Lex AM_FLAGS and FLAGS precedence. * tests/lflags.test: New test, check that user $(LFLAGS) takes precedence over automake (AM_LFLAGS) and (foo_LFLAGS). Still xfailing. * tests/lflags2.test: Likewise. * tests/yflags.test: New test, check that user $(YFLAGS) takes precedence over automake (AM_YFLAGS) and (foo_YFLAGS). Still xfailing. * tests/yflags2.test: Likewise. * tests/Makefile.am (TESTS, XFAIL_TESTS): Extended accordingly. Signed-off-by: Ralf Wildenhues --- ChangeLog | 14 +++++++++++ tests/Makefile.am | 10 +++++++- tests/Makefile.in | 10 +++++++- tests/lflags.test | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/lflags2.test | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/yflags.test | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/yflags2.test | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 310 insertions(+), 2 deletions(-) create mode 100755 tests/lflags.test create mode 100755 tests/lflags2.test create mode 100755 tests/yflags.test create mode 100755 tests/yflags2.test diff --git a/ChangeLog b/ChangeLog index c05f61a..79fa7dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-06-21 Stefano Lattarini + + New tests, exposing bugs in Automake Yacc/Lex support w.r.t. + $(AM_FLAGS) and $(FLAGS) precedence. + * tests/lflags.test: New test, check that user $(LFLAGS) takes + precedence over automake (AM_LFLAGS) and (foo_LFLAGS). Still + xfailing. + * tests/lflags2.test: Likewise. + * tests/yflags.test: New test, check that user $(YFLAGS) takes + precedence over automake (AM_YFLAGS) and (foo_YFLAGS). Still + xfailing. + * tests/yflags2.test: Likewise. + * tests/Makefile.am (TESTS, XFAIL_TESTS): Extended accordingly. + 2010-06-20 Stefano Lattarini Modernize, improve and extend tests `suffix*.test'. diff --git a/tests/Makefile.am b/tests/Makefile.am index b61e71b..20ce6e2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,7 +21,11 @@ all.test \ auxdir2.test \ cond17.test \ gcj6.test \ -txinfo5.test +txinfo5.test \ +lflags.test \ +lflags2.test \ +yflags.test \ +yflags2.test include $(srcdir)/parallel-tests.am @@ -394,6 +398,8 @@ lex2.test \ lex3.test \ lex4.test \ lex5.test \ +lflags.test \ +lflags2.test \ libexec.test \ libobj2.test \ libobj3.test \ @@ -769,6 +775,8 @@ yacc7.test \ yacc8.test \ yaccpp.test \ yaccvpath.test \ +yflags.test \ +yflags2.test \ $(parallel_tests) EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 0edcd5b..46ea92f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -248,7 +248,11 @@ all.test \ auxdir2.test \ cond17.test \ gcj6.test \ -txinfo5.test +txinfo5.test \ +lflags.test \ +lflags2.test \ +yflags.test \ +yflags2.test parallel_tests = \ check-p.test \ @@ -632,6 +636,8 @@ lex2.test \ lex3.test \ lex4.test \ lex5.test \ +lflags.test \ +lflags2.test \ libexec.test \ libobj2.test \ libobj3.test \ @@ -1007,6 +1013,8 @@ yacc7.test \ yacc8.test \ yaccpp.test \ yaccvpath.test \ +yflags.test \ +yflags2.test \ $(parallel_tests) EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS) diff --git a/tests/lflags.test b/tests/lflags.test new file mode 100755 index 0000000..5027f1c --- /dev/null +++ b/tests/lflags.test @@ -0,0 +1,70 @@ +#! /bin/sh +# Copyright (C) 2010 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 . + +# Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and +# $(foo_LFLAGS). +# Please keep this in sync with the sister tests lflags2.test, yflags.test +# and yflags2.test + +. ./defs || Exit 1 + +set -e + +cat >fake-lex <<'END' +#!/bin/sh +echo '/*' "$*" '*/' >lex.yy.c +END +chmod a+x fake-lex + +cat >> configure.in <<'END' +AC_PROG_CC +# Simulate presence of Lex using our fake-lex script. +AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex]) +AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy]) +AC_SUBST([LEXLIB], ['']) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo bar +foo_SOURCES = main.c foo.l +bar_SOURCES = main.c bar.l +AM_LFLAGS = __am_flags__ +bar_LFLAGS = __bar_flags__ +END + +$ACLOCAL +$AUTOMAKE -a + +grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && Exit 1 +grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && Exit 1 + +echo 'int main(void){ return 0; }' > main.c +: > foo.l +: > bar.l + +$AUTOCONF +./configure +$MAKE LFLAGS=__user_flags__ + +ls -l + +cat foo.c +grep '__am_flags__.*__user_flags__' foo.c +cat bar-bar.c +grep '__bar_flags__.*__user_flags__' bar-bar.c + +: diff --git a/tests/lflags2.test b/tests/lflags2.test new file mode 100755 index 0000000..e50678e --- /dev/null +++ b/tests/lflags2.test @@ -0,0 +1,71 @@ +#! /bin/sh +# Copyright (C) 2010 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 . + +# Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and +# $(foo_LFLAGS). +# Please keep this in sync with the sister tests lflags.test, yflags.test +# and yflags2.test + +required=g++ # FIXME: any working C++ compiler should be OK +. ./defs || Exit 1 + +set -e + +cat >fake-lex <<'END' +#!/bin/sh +echo '/*' "$*" '*/' >lex.yy.c +END +chmod a+x fake-lex + +cat >> configure.in <<'END' +AC_PROG_CXX +# Simulate presence of Lex using our fake-lex script. +AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex]) +AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy]) +AC_SUBST([LEXLIB], ['']) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo bar +foo_SOURCES = main.cc foo.ll +bar_SOURCES = main.cc bar.l++ +AM_LFLAGS = __am_flags__ +bar_LFLAGS = __bar_flags__ +END + +$ACLOCAL +$AUTOMAKE -a + +grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && Exit 1 +grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && Exit 1 + +echo 'int main(void) { return 0; }' > main.cc +: > foo.ll +: > bar.l++ + +$AUTOCONF +./configure +$MAKE LFLAGS=__user_flags__ + +ls -l + +cat foo.cc +grep '__am_flags__.*__user_flags__' foo.cc +cat bar-bar.c++ +grep '__bar_flags__.*__user_flags__' bar-bar.c++ + +: diff --git a/tests/yflags.test b/tests/yflags.test new file mode 100755 index 0000000..d7d3fca --- /dev/null +++ b/tests/yflags.test @@ -0,0 +1,68 @@ +#! /bin/sh +# Copyright (C) 2010 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 . + +# Check that $(YFLAGS) takes precedence over both $(AM_YFLAGS) and +# $(foo_YFLAGS). +# Please keep this in sync with the sister tests yflags2.test, lflags.test +# and lflags2.test + +. ./defs || Exit 1 + +set -e + +cat >fake-yacc <<'END' +#!/bin/sh +echo '/*' "$*" '*/' >y.tab.c +END +chmod a+x fake-yacc + +cat >> configure.in <<'END' +AC_PROG_CC +# Simulate presence of Yacc using our fake-yacc script. +AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo bar +foo_SOURCES = main.c foo.y +bar_SOURCES = main.c bar.y +AM_YFLAGS = __am_flags__ +bar_YFLAGS = __bar_flags__ +END + +$ACLOCAL +$AUTOMAKE -a + +grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && Exit 1 +grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && Exit 1 + +echo 'int main(void){ return 0; }' > main.c +: > foo.y +: > bar.y + +$AUTOCONF +./configure +$MAKE YFLAGS=__user_flags__ + +ls -l + +cat foo.c +grep '__am_flags__.*__user_flags__' foo.c +cat bar-bar.c +grep '__bar_flags__.*__user_flags__' bar-bar.c + +: diff --git a/tests/yflags2.test b/tests/yflags2.test new file mode 100755 index 0000000..5d5be1c --- /dev/null +++ b/tests/yflags2.test @@ -0,0 +1,69 @@ +#! /bin/sh +# Copyright (C) 2010 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 . + +# Check that $(YFLAGS) takes precedence over both $(AM_YFLAGS) and +# $(foo_YFLAGS). +# Please keep this in sync with the sister tests yflags.test, lflags.test +# and lflags2.test + +required=g++ # FIXME: any working C++ compiler should be OK +. ./defs || Exit 1 + +set -e + +cat >fake-yacc <<'END' +#!/bin/sh +echo '/*' "$*" '*/' >y.tab.c +END +chmod a+x fake-yacc + +cat >> configure.in <<'END' +AC_PROG_CXX +# Simulate presence of Yacc using our fake-yacc script. +AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo bar +foo_SOURCES = main.cc foo.yy +bar_SOURCES = main.cc bar.y++ +AM_YFLAGS = __am_flags__ +bar_YFLAGS = __bar_flags__ +END + +$ACLOCAL +$AUTOMAKE -a + +grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && Exit 1 +grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && Exit 1 + +echo 'int main(void) { return 0; }' > main.cc +: > foo.yy +: > bar.y++ + +$AUTOCONF +./configure +$MAKE YFLAGS=__user_flags__ + +ls -l + +cat foo.cc +grep '__am_flags__.*__user_flags__' foo.cc +cat bar-bar.c++ +grep '__bar_flags__.*__user_flags__' bar-bar.c++ + +: -- 2.7.4