New tests, for bugs in Yacc/Lex AM_FLAGS and FLAGS precedence.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 8 Jun 2010 14:32:40 +0000 (16:32 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 21 Jun 2010 18:36:58 +0000 (20:36 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/lflags.test [new file with mode: 0755]
tests/lflags2.test [new file with mode: 0755]
tests/yflags.test [new file with mode: 0755]
tests/yflags2.test [new file with mode: 0755]

index c05f61a..79fa7dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        Modernize, improve and extend tests `suffix*.test'.
index b61e71b..20ce6e2 100644 (file)
@@ -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)
index 0edcd5b..46ea92f 100644 (file)
@@ -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 (executable)
index 0000000..5027f1c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 (executable)
index 0000000..e50678e
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 (executable)
index 0000000..d7d3fca
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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 (executable)
index 0000000..5d5be1c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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++
+
+: