* tests/lexlib.test: New test, checks on @LEXLIB@ and $(LEXLIB). * tests/lex12.test: New test, checks on AC_PROG_LEX and AM_PROG_LEX. * tests/lex13.test: New test, checks on AM_PROG_LEX. * tests/lex3.test (configure.in): Use AC_PROG_LEX, not AM_PROG_LEX. * tests/lex5.test: Likewise. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 10 +++++++ tests/Makefile.am | 3 ++ tests/Makefile.in | 3 ++ tests/lex12.test | 49 +++++++++++++++++++++++++++++++++++++ tests/lex13.test | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/lex3.test | 2 +- tests/lex5.test | 2 +- tests/lexlib.test | 56 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 193 insertions(+), 2 deletions(-) create mode 100755 tests/lex12.test create mode 100755 tests/lex13.test create mode 100755 tests/lexlib.test
From 8f38e1144c282d359a9fa967cbc6eb6f0eb75f40 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Wed, 19 May 2010 22:32:31 +0200 Subject: [PATCH 6/6] More tests on AM_PROG_LEX, AC_PROG_LEX and @lex...@.
* tests/lexlib.test: New test, checks on @LEXLIB@ and $(LEXLIB). * tests/lex12.test: New test, checks on AC_PROG_LEX and AM_PROG_LEX. * tests/lex13.test: New test, checks on AM_PROG_LEX. * tests/lex3.test (configure.in): Use AC_PROG_LEX, not AM_PROG_LEX. * tests/lex5.test: Likewise. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 10 +++++++ tests/Makefile.am | 3 ++ tests/Makefile.in | 3 ++ tests/lex12.test | 49 +++++++++++++++++++++++++++++++++++++ tests/lex13.test | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/lex3.test | 2 +- tests/lex5.test | 2 +- tests/lexlib.test | 56 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 193 insertions(+), 2 deletions(-) create mode 100755 tests/lex12.test create mode 100755 tests/lex13.test create mode 100755 tests/lexlib.test diff --git a/ChangeLog b/ChangeLog index 2c87601..4094f7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2010-05-20 Stefano Lattarini <stefano.lattar...@gmail.com> + More tests on AM_PROG_LEX, AC_PROG_LEX and @lex...@. + * tests/lexlib.test: New test, checks on @LEXLIB@ and $(LEXLIB). + * tests/lex12.test: New test, checks on AC_PROG_LEX and + AM_PROG_LEX. + * tests/lex13.test: New test, checks on AM_PROG_LEX. + * tests/lex3.test (configure.in): Use AC_PROG_LEX, not + AM_PROG_LEX. + * tests/lex5.test: Likewise. + * tests/Makefile.am (TESTS): Update. + New tests on Lex and Yacc dependencies declarations. * tests/lex10.test: New test script. * tests/lex11.test: Likewise. diff --git a/tests/Makefile.am b/tests/Makefile.am index 793e041..ca3f4d9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -413,7 +413,10 @@ lex8.test \ lex9.test \ lex10.test \ lex11.test \ +lex12.test \ +lex13.test \ lexcpp.test \ +lexlib.test \ lexvpath.test \ libexec.test \ libobj2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 48f23e3..5c4be1e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -650,7 +650,10 @@ lex8.test \ lex9.test \ lex10.test \ lex11.test \ +lex12.test \ +lex13.test \ lexcpp.test \ +lexlib.test \ lexvpath.test \ libexec.test \ libobj2.test \ diff --git a/tests/lex12.test b/tests/lex12.test new file mode 100755 index 0000000..e2078e0 --- /dev/null +++ b/tests/lex12.test @@ -0,0 +1,49 @@ +#! /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/>. + +# Checks on AC_PROG_LEX and AM_PROG_LEX. + +. ./defs || Exit 1 + +set -e + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.l +END + +mv configure.in configure.stub + +: > ylwrap + +# Both AC_PROG_LEX and AM_PROG_LEX must do AC_SUBST'ing and setting +# of LEX, LEX_OUTPUT_ROOT and LEXLIB. And while they might generate +# different code in configure, they shouldn't cause differences in +# the Makefile.in. +for x in AC AM; do + cp configure.stub configure.in + echo "${x}_PROG_LEX" >>configure.in + $ACLOCAL + $AUTOMAKE + mv Makefile.in Makefile-$x + for var in LEX LEX_OUTPUT_ROOT LEXLIB; do + test 1 = `grep -c "^$var *= *...@$var@ *$" Makefile-$x` + done +done + +diff Makefile-AC Makefile-AM + +: diff --git a/tests/lex13.test b/tests/lex13.test new file mode 100755 index 0000000..cbb76c2 --- /dev/null +++ b/tests/lex13.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 <http://www.gnu.org/licenses/>. + +# Check that AM_PROG_LEX brin in the `missing' script if lex is not +# found. + +. ./defs || Exit 1 + +set -e + +cat >>configure.in <<'END' +AM_PROG_LEX +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.l +END + +# This is a deliberately invalid input for lex. +cat > foo.l <<'END' +%% +"x +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +# AC_PROG_LEX sets $LEX to `:' if it can't found a working lex program. +# so the `LEX=:' assignment tricks AM_PROG_LEX into thinking that we lack +# a lex program. +./configure LEX=: + +grep '^LEX *=.*/missing --run flex *$' Makefile + +# Since the script `missing' always tries to run the desired program, and +# since we cannot sanely remove it from $PATH, we override it with scripts +# simulating "version mismatch", for which `missing' is gonna taking +# appropriate actions. +mkdir fakebin +cat >fakebin/flex <<'END' +#!/bin/sh +# Exit code 63 means version mismatch. +exit 63 +END +cp fakebin/flex fakebin/lex +chmod a+x fakebin/flex fakebin/lex +PATH=`pwd`/fakebin:$PATH; export PATH + +# Now let's verify that the script `missing' is truly called. +$MAKE >out 2>&1 && { cat out; Exit 1; } +cat out +grep 'WARNING:.* is probably too old' out + +: diff --git a/tests/lex3.test b/tests/lex3.test index a27968d..5378b2a 100755 --- a/tests/lex3.test +++ b/tests/lex3.test @@ -31,7 +31,7 @@ distdir=$me-1.0 cat >> configure.in << 'END' AC_PROG_CC -AM_PROG_LEX +AC_PROG_LEX AC_OUTPUT END diff --git a/tests/lex5.test b/tests/lex5.test index ba77854..98813e5 100755 --- a/tests/lex5.test +++ b/tests/lex5.test @@ -24,7 +24,7 @@ set -e cat >> configure.in << 'END' AC_PROG_CC AM_PROG_CC_C_O -AM_PROG_LEX +AC_PROG_LEX AC_OUTPUT END diff --git a/tests/lexlib.test b/tests/lexlib.test new file mode 100755 index 0000000..806ab2f --- /dev/null +++ b/tests/lexlib.test @@ -0,0 +1,56 @@ +#! /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/>. + +# Tests on @LEXLIB@ and $(LEXLIB). + +required='flex gcc' +. ./defs || Exit 1 + +set -e + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.l +foo_LDADD = @LEXLIB@ +END + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_LEX +AC_OUTPUT +END + +cat > foo.l << 'END' +%% +"END" return EOF; +. +%% +main(){} +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +grep '^LEXLIB *=' Makefile.in + +./configure +$FGREP @LEXLIB@ Makefile && Exit 1 + +$MAKE +$MAKE distcheck + +: -- 1.6.5