[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] Extend, fix and improve tests on Yacc/Lex support.
From: |
Stefano Lattarini |
Subject: |
[PATCH 1/6] Extend, fix and improve tests on Yacc/Lex support. |
Date: |
Thu, 20 May 2010 12:11:59 +0200 |
User-agent: |
KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; ) |
Refactor and improve existing tests on Lex/Yacc and add a couple of new test
scripts on Lex.
---
ChangeLog | 35 +++++++++++++++
tests/Makefile.am | 2 +
tests/Makefile.in | 2 +
tests/defs.in | 7 +++
tests/lex2.test | 2 +
tests/lex3.test | 26 +++++------
tests/lex4.test | 2 +
tests/lex5.test | 19 +++------
tests/lexcpp.test | 46 ++++++++++++++++++++
tests/lexvpath.test | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/yacc.test | 7 ++-
tests/yacc2.test | 15 +++---
tests/yacc3.test | 15 +++---
tests/yacc4.test | 18 +++-----
tests/yacc5.test | 13 +++---
tests/yacc6.test | 14 +++---
tests/yacc7.test | 8 ++-
tests/yacc8.test | 21 ++++-----
tests/yaccpp.test | 21 +++++++--
tests/yaccvpath.test | 27 ++++++------
20 files changed, 316 insertions(+), 101 deletions(-)
create mode 100755 tests/lexcpp.test
create mode 100755 tests/lexvpath.test
From 7527a68002a42e3ed0ee8dbc824e239b4a198d87 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 7 May 2010 15:07:37 +0200
Subject: [PATCH 1/6] Extend, fix and improve tests on Yacc/Lex support.
* tests/lexcpp.test: New test script.
* tests/lexvpath.test: Likewise.
* tests/Makefile.am (TESTS): Update.
* tests/defs.in ($required): Better recognition of requirement
`flex'.
* tests/lex2.test: Add trailing `:'.
* tests/lex4.test: Likewise.
* tests/yacc7.test: Use trailing `:'. Enable `errexit' shell
flag earlier (just after having sourced `./defs').
* tests/yacc4.test: Likewise. Also ...
(configure.in): Use pre-populated skeleton set up by `./defs',
instead of writing one from scratch.
Other minor cosmetic changes.
* tests/yacc5.test: Likewise.
* tests/yaccvpath.test: Likewise. Also ...
($distdir): New variable.
Use it throughout.
* tests/lex5.test: Likewise. Also ...
(Makefile.am): Do not add `foreign' to `AUTOMAKE_OPTIONS'.
* yacc.test: Use stricter grepping. Add trailing `:'.
* yacc6.test: Likewise.
* yacc3.test: Likewise. Do not create unused file `Makefile.sed'.
Other minor cosmetic changes.
* yacc2.test: Use stricter grepping, and do not redirect output of
grep to /dev/null.
* tests/yacc8.test: Fixed bugs that reduced the completeness of
the tests.
(configure.in): Use pre-populated skeleton set up by `./defs',
instead of writing one from scratch.
* tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
`.yxx', rather than only `.yy'.
---
ChangeLog | 35 +++++++++++++++
tests/Makefile.am | 2 +
tests/Makefile.in | 2 +
tests/defs.in | 7 +++
tests/lex2.test | 2 +
tests/lex3.test | 26 +++++------
tests/lex4.test | 2 +
tests/lex5.test | 19 +++------
tests/lexcpp.test | 46 ++++++++++++++++++++
tests/lexvpath.test | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/yacc.test | 7 ++-
tests/yacc2.test | 15 +++---
tests/yacc3.test | 15 +++---
tests/yacc4.test | 18 +++-----
tests/yacc5.test | 13 +++---
tests/yacc6.test | 14 +++---
tests/yacc7.test | 8 ++-
tests/yacc8.test | 21 ++++-----
tests/yaccpp.test | 21 +++++++--
tests/yaccvpath.test | 27 ++++++------
20 files changed, 316 insertions(+), 101 deletions(-)
create mode 100755 tests/lexcpp.test
create mode 100755 tests/lexvpath.test
diff --git a/ChangeLog b/ChangeLog
index 71b0d9b..a22c464 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2010-05-20 Stefano Lattarini <address@hidden>
+
+ Extend, fix and improve tests on Lex and Yacc support.
+ * tests/lexcpp.test: New test script.
+ * tests/lexvpath.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ * tests/defs.in ($required): Better recognition of requirement
+ `flex'.
+ * tests/lex2.test: Add trailing `:'.
+ * tests/lex4.test: Likewise.
+ * tests/yacc7.test: Use trailing `:'. Enable `errexit' shell
+ flag earlier (just after having sourced `./defs').
+ * tests/yacc4.test: Likewise. Also ...
+ (configure.in): Use pre-populated skeleton set up by `./defs',
+ instead of writing one from scratch.
+ Other minor cosmetic changes.
+ * tests/yacc5.test: Likewise.
+ * tests/yaccvpath.test: Likewise. Also ...
+ ($distdir): New variable.
+ Use it throughout.
+ * tests/lex5.test: Likewise. Also ...
+ (Makefile.am): Do not add `foreign' to `AUTOMAKE_OPTIONS'.
+ * yacc.test: Use stricter grepping. Add trailing `:'.
+ * yacc6.test: Likewise.
+ * yacc3.test: Likewise. Do not create unused file `Makefile.sed'.
+ Other minor cosmetic changes.
+ * yacc2.test: Use stricter grepping, and do not redirect output of
+ grep to /dev/null.
+ * tests/yacc8.test: Fixed bugs that reduced the completeness of
+ the tests.
+ (configure.in): Use pre-populated skeleton set up by `./defs',
+ instead of writing one from scratch.
+ * tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
+ `.yxx', rather than only `.yy'.
+
2010-04-25 Ralf Wildenhues <address@hidden>
Warning and error message formatting cleanups.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cff34c5..24aff4d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -403,6 +403,8 @@ lex2.test \
lex3.test \
lex4.test \
lex5.test \
+lexcpp.test \
+lexvpath.test \
libexec.test \
libobj2.test \
libobj3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3ff9012..983a116 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -644,6 +644,8 @@ lex2.test \
lex3.test \
lex4.test \
lex5.test \
+lexcpp.test \
+lexvpath.test \
libexec.test \
libobj2.test \
libobj3.test \
diff --git a/tests/defs.in b/tests/defs.in
index 497b57f..16a29ff 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -110,6 +110,13 @@ do
echo "$me: running etags --version -o /dev/null"
( etags --version -o /dev/null ) || exit 77
;;
+ flex)
+ # Since flex is required, we pick LEX for ./configure.
+ LEX='flex'
+ export LEX
+ echo "$me: running flex --version"
+ ( flex --version ) || exit 77
+ ;;
GNUmake)
# Use --version AND -v, because SGI Make doesn't fail on --version.
# Also grep for GNU because newer versions of FreeBSD make do
diff --git a/tests/lex2.test b/tests/lex2.test
index d588edf..6346c71 100755
--- a/tests/lex2.test
+++ b/tests/lex2.test
@@ -34,3 +34,5 @@ END
$ACLOCAL
AUTOMAKE_fails
grep AM_PROG_LEX stderr
+
+:
diff --git a/tests/lex3.test b/tests/lex3.test
index 59146c7..a27968d 100755
--- a/tests/lex3.test
+++ b/tests/lex3.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 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
@@ -20,27 +21,22 @@
required='gcc gzip flex GNUmake'
. ./defs || Exit 1
+set -e
+
# Ignore user CFLAGS.
CFLAGS=
export CFLAGS
-cat > configure.in << 'END'
-AC_INIT
-dnl Prevent automake from looking in .. and ../..
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE(am_lex_bug, 0.1.1)
+distdir=$me-1.0
-dnl Checks for programs.
+cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_LEX
-AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = foreign
LDADD = @LEXLIB@
-
noinst_PROGRAMS = foo
foo_SOURCES = foo.l
END
@@ -60,8 +56,6 @@ main ()
}
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
@@ -71,8 +65,8 @@ echo 'This is the END' | ./foo
$MAKE distcheck
# foo.c must be shipped.
-gunzip am_lex_bug-0.1.1.tar.gz
-tar tf am_lex_bug-0.1.1.tar | $FGREP foo.c
+gunzip $distdir.tar.gz
+tar tf $distdir.tar | $FGREP foo.c
# While we are at it, make sure that foo.c is erased by
# maintainer-clean, and not by distclean.
@@ -82,3 +76,5 @@ test -f foo.c
./configure
$MAKE maintainer-clean
test ! -f foo.c
+
+:
diff --git a/tests/lex4.test b/tests/lex4.test
index fee140d..7f30531 100755
--- a/tests/lex4.test
+++ b/tests/lex4.test
@@ -38,3 +38,5 @@ $ACLOCAL
$AUTOMAKE -a
$FGREP joe.Po Makefile.in
+
+:
diff --git a/tests/lex5.test b/tests/lex5.test
index edbdf9d..ba77854 100755
--- a/tests/lex5.test
+++ b/tests/lex5.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
@@ -21,11 +21,7 @@ required='gcc GNUmake gzip flex'
set -e
-cat > configure.in << 'END'
-AC_INIT([lex5], [1.0])
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_LEX
@@ -33,10 +29,9 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = foreign subdir-objects
-LDADD = @LEXLIB@
-
-bin_PROGRAMS = foo/foo
+AUTOMAKE_OPTIONS = subdir-objects
+LDADD = @LEXLIB@
+bin_PROGRAMS = foo/foo
foo_foo_SOURCES = foo/foo.l
END
@@ -57,8 +52,6 @@ main ()
}
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
@@ -96,4 +89,4 @@ $MAKE foo/foo2.o
test -f foo/foo2.c
test -f foo/foo2.o
-Exit 0
+:
diff --git a/tests/lexcpp.test b/tests/lexcpp.test
new file mode 100755
index 0000000..4ad32fa
--- /dev/null
+++ b/tests/lexcpp.test
@@ -0,0 +1,46 @@
+#! /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/>.
+
+# Test to make sure Lex + C++ works.
+# Please keep this is sync with sister test yaccpp.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_LEX
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+foo_SOURCES = foo.l++
+bar_SOURCES = bar.lpp
+baz_SOURCES = baz.ll
+qux_SOURCES = qux.lxx
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+$FGREP ' foo.c++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' baz.cc ' mk
+$FGREP ' qux.cxx ' mk
+
+:
diff --git a/tests/lexvpath.test b/tests/lexvpath.test
new file mode 100755
index 0000000..0dd64ac
--- /dev/null
+++ b/tests/lexvpath.test
@@ -0,0 +1,117 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 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/>.
+
+# This test checks that dependent files are updated before including
+# in the distribution. `lexer.c' depends on `lexer.l'. The later is
+# updated so that `lexer.c' should be rebuild. Then we are running
+# `make' and `make distdir' and check whether the version of `lexer.c'
+# to be distributed is up to date.
+
+# Please keep this in sync with sister test `yaccvapth.test'.
+
+required='gcc flex'
+. ./defs || Exit 1
+
+set -e
+
+distdir=$me-1.0
+
+cat > lexoutroot.in << 'END'
+LEX_OUTPUT_ROOT='@LEX_OUTPUT_ROOT@'
+END
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([lexoutroot])
+AC_PROG_CC
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = lexer.l foo.c
+LDADD = $(LEXLIB)
+END
+
+# Original lexer, with a "foobar" comment
+cat > lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*foobar*/
+END
+
+cat > foo.c << 'END'
+int main () { return 0; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+
+# We must run configure early, to find out whay $LEX_OUTPUT_ROOT is.
+cd sub
+../configure
+. ./lexoutroot
+test -n "$LEX_OUTPUT_ROOT"
+cd ..
+
+$LEX lexer.l
+mv "$LEX_OUTPUT_ROOT".c lexer.c
+
+cd sub
+
+# A delay is needed to make sure that the new lexer.l is indeed newer
+# than lexer.c, i.e. the they don't have the same timestamp.
+$sleep
+
+# New lexer, with `fubar' comment.
+cat > ../lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*fubar*/
+END
+
+$MAKE
+$MAKE distdir
+$FGREP '/*fubar*/' $distdir/lexer.c
+
+#
+# Now check to make sure that `make dist' will rebuild the parser.
+#
+
+# A delay is needed to make sure that the new parse.y is indeed newer
+# than parse.c, i.e. the they don't have the same timestamp.
+$sleep
+
+# New lexer, with `maude' comment.
+cat > ../lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*maude*/
+END
+
+$MAKE distdir
+$FGREP '/*maude*/' $distdir/lexer.c
+
+:
diff --git a/tests/yacc.test b/tests/yacc.test
index bf6782f..13b7fe3 100755
--- a/tests/yacc.test
+++ b/tests/yacc.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 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
@@ -34,4 +35,6 @@ END
$ACLOCAL
$AUTOMAKE -a
-grep 'zardoz.c' Makefile.in
+$FGREP 'zardoz.c' Makefile.in
+
+:
diff --git a/tests/yacc2.test b/tests/yacc2.test
index a095edc..5eb257d 100755
--- a/tests/yacc2.test
+++ b/tests/yacc2.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2006, 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
@@ -38,7 +39,7 @@ $ACLOCAL
$AUTOMAKE -a
# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
+$FGREP 'zardoz.h' Makefile.in && Exit 1
@@ -48,7 +49,7 @@ echo 'AM_YFLAGS = -d' >> Makefile.am
$AUTOMAKE
# If zardoz.h is NOT mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null
+$FGREP 'zardoz.h' Makefile.in
@@ -58,7 +59,7 @@ echo 'AM_YFLAGS = ' >> Makefile.am
$AUTOMAKE
# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
+$FGREP 'zardoz.h' Makefile.in && Exit 1
@@ -67,11 +68,11 @@ echo 'YFLAGS = -d' >> Makefile.am
# YFLAGS is a use variable.
AUTOMAKE_fails
-grep 'YFLAGS' stderr
+$FGREP 'YFLAGS' stderr
$AUTOMAKE -Wno-gnu
# If zardoz.h is NOT mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null
+$FGREP 'zardoz.h' Makefile.in
@@ -81,6 +82,6 @@ echo 'YFLAGS = ' >> Makefile.am
$AUTOMAKE -Wno-gnu
# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
+$FGREP 'zardoz.h' Makefile.in && Exit 1
:
diff --git a/tests/yacc3.test b/tests/yacc3.test
index 86d897c..3b85fce 100755
--- a/tests/yacc3.test
+++ b/tests/yacc3.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2006, 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
@@ -37,17 +38,17 @@ END
$ACLOCAL
$AUTOMAKE -a
-$FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed
# It should not be disted here
-grep 'zardoz.h' Makefile.in && Exit 1
+$FGREP 'zardoz.h' Makefile.in && Exit 1
-cp Makefile.am Save
+cp Makefile.am Makefile.sav
# Test all available flags to make sure header is distributed with
# `-d'.
for flag in YFLAGS AM_YFLAGS zardoz_YFLAGS; do
- cp Save Makefile.am
+ cp Makefile.sav Makefile.am
echo "$flag = -d" >> Makefile.am
-
$AUTOMAKE -Wno-gnu
- grep 'zardoz.h' Makefile.in
+ $FGREP 'zardoz.h' Makefile.in
done
+
+:
diff --git a/tests/yacc4.test b/tests/yacc4.test
index 0435ec0..bb25290 100755
--- a/tests/yacc4.test
+++ b/tests/yacc4.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
@@ -19,15 +19,12 @@
required='bison gcc'
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE(foo, 0.1)
-PACKAGE=foo
-VERSION=0.1
+set -e
+
+cat >> configure.in << 'END'
AC_PROG_CC
AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
@@ -60,8 +57,6 @@ cat > foo.c << 'END'
int main () { return 0; }
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
@@ -86,6 +81,5 @@ test -f parse.c
$MAKE maintainer-clean
test ! -f bar.c
test ! -f parse.c
-:
-Exit 0
+:
diff --git a/tests/yacc5.test b/tests/yacc5.test
index 8b00ed8..77de2e9 100755
--- a/tests/yacc5.test
+++ b/tests/yacc5.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -21,13 +21,10 @@
set -e
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
-AC_OUTPUT(Makefile)
END
cat > Makefile.am << 'END'
@@ -69,8 +66,8 @@ maude_SOURCES = sub/maude.y
maude_YFLAGS = -d
END
-$ACLOCAL || Exit 1
-$AUTOMAKE -a || Exit 1
+$ACLOCAL
+$AUTOMAKE -a
# Rule should use maude_YFLAGS.
grep 'AM_YFLAGS.*maude' Makefile.in && Exit 1
@@ -80,3 +77,5 @@ grep 'maudec' Makefile.in && Exit 1
# Make sure the .o file is required.
grep '^am_maude_OBJECTS.*maude' Makefile.in
+
+:
diff --git a/tests/yacc6.test b/tests/yacc6.test
index f10effd..b9b259b 100755
--- a/tests/yacc6.test
+++ b/tests/yacc6.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -27,13 +27,13 @@ set -e
cat > configure.in << 'END'
AC_INIT([yacc6], [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])
+AC_CONFIG_FILES([Makefile sub/Makefile])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
END
@@ -89,11 +89,11 @@ $AUTOMAKE -a
test -f aux1/ylwrap
test ! -f ylwrap
test ! -f sub/ylwrap
-$FGREP '(top_srcdir)/aux1/ylwrap' sub/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
+grep '#.*line.*foo\.y' sub/foo.c
+grep '#.*line.*bar\.y' sub/bar.c
$sleep
: > z
@@ -106,3 +106,5 @@ 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/yacc7.test b/tests/yacc7.test
index 2edd15c..284ac59 100755
--- a/tests/yacc7.test
+++ b/tests/yacc7.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 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
@@ -23,6 +24,8 @@
required=bison
. ./defs || Exit 1
+set -e
+
cat >> configure.in << 'END'
AC_PROG_CC
AC_PROG_YACC
@@ -52,8 +55,6 @@ WORD: "up";
%%
END
-set -e
-
$ACLOCAL
$AUTOMAKE -a
$AUTOCONF
@@ -87,4 +88,5 @@ test -f foo.c
$MAKE maintainer-clean
test ! -f foo.h
test ! -f foo.c
+
:
diff --git a/tests/yacc8.test b/tests/yacc8.test
index 979415c..96fc45a 100755
--- a/tests/yacc8.test
+++ b/tests/yacc8.test
@@ -22,11 +22,7 @@ required="gcc bison"
set -e
-cat > configure.in << 'END'
-AC_INIT([yacc8], [1.0])
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
@@ -39,15 +35,16 @@ bin_PROGRAMS = foo/foo
foo_foo_SOURCES = foo/parse.y
AM_YFLAGS = -d
+.PHONY: obj
obj: foo/parse.$(OBJEXT)
-test1: obj
- test -f foo/parse.c
- test -f foo/parse.$(OBJEXT)
-
-test2: obj
+.PHONY: test1 test2
+test1: foo/parse.$(OBJEXT)
test -f foo/parse.c
test -f foo/parse.$(OBJEXT)
+test2: foo/parse2.$(OBJEXT)
+ test -f foo/parse2.c
+ test -f foo/parse2.$(OBJEXT)
END
mkdir foo
@@ -104,9 +101,11 @@ EXTRA_foo_foo_SOURCES = foo/parse2.y
END
$AUTOMAKE -a
-test -f ./ylwrap || Exit 1
+test -f ./ylwrap
cd sub
# Regenerate Makefile (automatic in GNU Make, but not in other Makes)
./config.status
$MAKE test2
+
+:
diff --git a/tests/yaccpp.test b/tests/yaccpp.test
index 9013f40..5c27597 100755
--- a/tests/yaccpp.test
+++ b/tests/yaccpp.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2006, 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
@@ -14,7 +15,8 @@
# 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 yacc + c++ works.
+# Test to make sure Yacc + C++ works.
+# Please keep this is sync with sister test lexcpp.test.
. ./defs || Exit 1
@@ -26,11 +28,20 @@ AC_PROG_YACC
END
cat > Makefile.am << 'END'
-bin_PROGRAMS = zardoz
-zardoz_SOURCES = zardoz.yy
+bin_PROGRAMS = foo bar baz qux
+foo_SOURCES = foo.y++
+bar_SOURCES = bar.ypp
+baz_SOURCES = baz.yy
+qux_SOURCES = qux.yxx
END
$ACLOCAL
$AUTOMAKE -a
-grep zardoz.cc Makefile.in
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+$FGREP ' foo.c++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' baz.cc ' mk
+$FGREP ' qux.cxx ' mk
+
+:
diff --git a/tests/yaccvpath.test b/tests/yaccvpath.test
index 6db5fd7..7f44671 100755
--- a/tests/yaccvpath.test
+++ b/tests/yaccvpath.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -15,23 +15,24 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This test checks that dependent files are updated before including
-# in the distribution. `parse.c' depends on `parce.y'. The later is
+# in the distribution. `parse.c' depends on `parse.y'. The later is
# updated so that `parse.c' should be rebuild. Then we are running
# `make' and `make distdir' and check whether the version of `parse.c'
# to be distributed is up to date.
+# Please keep this in sync with sister test `lexvapth.test'.
+
required='gcc bison'
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE(foo, 0.1)
-PACKAGE=foo
-VERSION=0.1
+set -e
+
+distdir=$me-1.0
+
+cat >> configure.in << 'END'
AC_PROG_CC
AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
END
cat > Makefile.am << 'END'
@@ -53,8 +54,6 @@ cat > foo.c << 'END'
int main () { return 0; }
END
-set -e
-
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
@@ -82,7 +81,7 @@ END
$MAKE
$MAKE distdir
-grep fubar foo-0.1/parse.c
+$FGREP fubar $distdir/parse.c
#
# Now check to make sure that `make dist' will rebuild the parser.
@@ -103,4 +102,6 @@ maude : 'm' 'a' 'u' 'd' 'e' {};
END
$MAKE distdir
-grep maude foo-0.1/parse.c
+$FGREP maude $distdir/parse.c
+
+:
--
1.6.5
- [PATCH 0/6] Lex, Yacc and explicit declarations of dependencies., Stefano Lattarini, 2010/05/20
- [PATCH 1/6] Extend, fix and improve tests on Yacc/Lex support.,
Stefano Lattarini <=
- [PATCH 2/6] New tests: Heirloom make and Lex/Yacc rules., Stefano Lattarini, 2010/05/20
- [PATCH 3/6] Add new tests on Lex and Yacc., Stefano Lattarini, 2010/05/20
- [PATCH 4/6] automake.in: improve declaration of dependencies in generated Makefile.in, Stefano Lattarini, 2010/05/20
- Subject: [PATCH 5/6] New tests on Lex and Yacc dependencies declarations., Stefano Lattarini, 2010/05/20
- [PATCH 6/6] More tests on AM_PROG_LEX, AC_PROG_LEX and @address@hidden, Stefano Lattarini, 2010/05/20