automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {master} tests: fix spurious failures due to missing 'yywrap()'


From: Stefano Lattarini
Subject: [PATCH] {master} tests: fix spurious failures due to missing 'yywrap()' function (was: Re: testsuite on master)
Date: Tue, 25 Oct 2011 09:38:14 +0200
User-agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; )

Hi Jim, sorry for the delay.

On Thursday 20 October 2011, Jim Meyering wrote:
> Stefano Lattarini wrote:
> > On Thursday 20 October 2011, Jim Meyering wrote:
> >> Stefano Lattarini wrote:
> >>
> >> > Feel free to push the patch to master.
> >>
> >> Done.
> >>
> > Thank you.
> >
> >> I saw 5 other "make check" failures on master this morning.
> >> I suppose it's not worth investigating them, given how much
> >> is happening in testsuite-work.
> >>
> > If you want to report them, I'll take a look.
> 
> Thanks.
> Here you go, this is with the very latest autoconf early in my path,
> but that seems not to matter.  These are all due to lack of yylex.
>
Of yywrap, actually :-)

Could you try the attached patch to see if it fixes the spurious
failures?

Thanks,
  Stefano
From 16cb4465bf836b25d61be4ae7cf21dab6f928186 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Mon, 24 Oct 2011 23:18:34 +0200
Subject: [PATCH] tests: fix spurious failures due to missing 'yywrap()' function

The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
the "lex library" expected to provide a `yywrap' function (function
which is required to link most lex-generated programs).  On the
contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
fail, configure declares that no lex library is needed, and simply
proceeds with the configuration process -- only for the build to
possibly fail later, at make time.

This behaviour is intended; the Autoconf manual reads:
 ``You are encouraged to use Flex in your sources, since it is
   both more pleasant to use than plain Lex and the C source it
   produces is portable.  In order to ensure portability, however,
   you must either provide a function `yywrap' or, if you don't use
   it (e.g., your scanner has no `#include'-like feature), simply
   include a `%noyywrap' statement in the scanner's source.''

This AC_PROG_LEX behaviour is causing some spurious failures of the
Automake testsuite in environments which lack a proper library
providing `yywrap' (this happens for example on 64 bits Red Hat
Linux).   The proper workaround is to simply provide a fall-back
implementation of `yywrap' in our lexers.

See also partially-overlapping commit `v1.11-871-geb147a1' (from
the 'testsuite-work' branch), which was motivated by similar
spurious failures experienced when cross-compiling.

Reported by Jim Meyering:
<http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>

* tests/cond35.test: Provide a dummy `yywrap' function.
* tests/lex3.test: Likewise.
* tests/lexvpath.test: Likewise.
* tests/silent-lex-generic.test: Likewise.
* tests/silent-lex-gcc.test: Likewise.
---
 ChangeLog                     |   39 +++++++++++++++++++++++++++++++++++++++
 tests/cond35.test             |    6 ++++++
 tests/lex3.test               |    6 ++++++
 tests/lexvpath.test           |    5 +++++
 tests/silent-lex-gcc.test     |    3 +++
 tests/silent-lex-generic.test |    3 +++
 6 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8dea9eb..fc9b728 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2011-10-14  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failures due to missing 'yywrap()' function
+
+       The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
+       the "lex library" expected to provide a `yywrap' function (function
+       which is required to link most lex-generated programs).  On the
+       contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
+       fail, configure declares that no lex library is needed, and simply
+       proceeds with the configuration process -- only for the build to
+       possibly fail later, at make time.
+
+       This behaviour is intended; the Autoconf manual reads:
+        ``You are encouraged to use Flex in your sources, since it is
+          both more pleasant to use than plain Lex and the C source it
+          produces is portable.  In order to ensure portability, however,
+          you must either provide a function `yywrap' or, if you don't use
+          it (e.g., your scanner has no `#include'-like feature), simply
+          include a `%noyywrap' statement in the scanner's source.''
+
+       This AC_PROG_LEX behaviour is causing some spurious failures of the
+       Automake testsuite in environments which lack a proper library
+       providing `yywrap' (this happens for example on 64 bits Red Hat
+       Linux).   The proper workaround is to simply provide a fall-back
+       implementation of `yywrap' in our lexers.
+
+       See also partially-overlapping commit `v1.11-871-geb147a1' (from
+       the 'testsuite-work' branch), which was motivated by similar
+       spurious failures experienced when cross-compiling.
+
+       Reported by Jim Meyering:
+       
<http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>
+
+       * tests/cond35.test: Provide a dummy `yywrap' function.
+       * tests/lex3.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise.
+
 2011-10-18  Stefano Lattarini  <address@hidden>
 
        tests: fix spurious failure with FreeBSD make and Yacc in VPATH
diff --git a/tests/cond35.test b/tests/cond35.test
index c3c5f0b..776c9e1 100755
--- a/tests/cond35.test
+++ b/tests/cond35.test
@@ -59,6 +59,12 @@ test `grep tparse.h: Makefile.in | wc -l` = 1
 cat > tscan.l << 'END'
 %%
 "END"   return EOF;
+%%
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 cat > tparse.y << 'END'
diff --git a/tests/lex3.test b/tests/lex3.test
index f702864..4714472 100755
--- a/tests/lex3.test
+++ b/tests/lex3.test
@@ -53,6 +53,12 @@ main ()
   else
     return 1;
 }
+
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 $ACLOCAL
diff --git a/tests/lexvpath.test b/tests/lexvpath.test
index 300a476..65565f6 100755
--- a/tests/lexvpath.test
+++ b/tests/lexvpath.test
@@ -53,6 +53,11 @@ END
 
 cat > foo.c << 'END'
 int main () { return 0; }
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 $ACLOCAL
diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test
index a55f358..5ab5ecd 100755
--- a/tests/silent-lex-gcc.test
+++ b/tests/silent-lex-gcc.test
@@ -55,6 +55,9 @@ cat > foo.l <<'EOF'
 "END"   return EOF;
 .
 %%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+int   main (void) { return 0; }
 EOF
 cp foo.l sub/bar.l
 
diff --git a/tests/silent-lex-generic.test b/tests/silent-lex-generic.test
index a619698..582f529 100755
--- a/tests/silent-lex-generic.test
+++ b/tests/silent-lex-generic.test
@@ -55,6 +55,9 @@ cat > foo.l <<'EOF'
 "END"   return EOF;
 .
 %%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+int   main (void) { return 0; }
 EOF
 cp foo.l sub/bar.l
 
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]