automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.


From: Stefano Lattarini
Subject: Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.
Date: Fri, 12 Nov 2010 20:37:14 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Friday 12 November 2010, Ralf Wildenhues wrote:
> Hi Stefano,
> 
> * Stefano Lattarini wrote on Wed, Nov 03, 2010 at 07:12:27PM CET:
> >  <http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00003.html>
> [...]
> > --- /dev/null
> > +++ b/tests/backcompat6.test
> > @@ -0,0 +1,105 @@
> 
> > +# Backward-compatibility test: try to build and distribute a package
> > +# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
> > +# This script can also serve as mild stress-testing for Automke.
> > +# See also the similar test `backcompat5.test'.
> 
> > +cat >> Makefile.am <<'END'
> > +bin_PROGRAMS = foo
> > +foo_SOURCES = quux.c
> > +DISTCLEANFILES = *.tmp
> > +check-local:
> > +   rm -f exp got
> > +   echo 'PACKAGE = nonesuch-zardoz' > exp.tmp
> > +   echo 'VERSION = nonesuch-0.1' >> exp.tmp
> > +   echo 'PACKAGE = $(PACKAGE)' > got1.tmp
> > +   echo 'VERSION = $(VERSION)' >> got1.tmp
> > +   ./foo > got2.tmp
> > +   cat exp.tmp
> > +   cat got1.tmp
> > +   cat got2.tmp
> > +   diff exp.tmp got1.tmp
> > +   diff exp.tmp got2.tmp
> > +END
> > +
> > +cat > quux.c <<'END'
> > +#include <config.h>
> > +#include <stdio.h>
> > +int main (void)
> > +{
> > +  printf("PACKAGE = %s\nVERSION = %s\n", PACKAGE, VERSION);
> > +  return 0;
> > +}
> > +END
> 
> The diff between exp.tmp and got2.tmp fails on MinGW/MSYS because the
> foo program uses w32-style CRLF newlines whereas the shell prints LF
> only.
Hmpf.
 
> The easiest fix would be to grep for the lines in question, I guess.
I agree.  What about the attached patch?  (It also makes the testcase
simpler and shorter, BTW).

Regards,
  Stefano
From e7acab2779193ae95d8cd07c24b2b0480f0d847a Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 12 Nov 2010 20:35:35 +0100
Subject: [PATCH] Fix bug in test `backcompat6.test' (MSYS portability).

* tests/backcompat6.test (Makefile.am): Grep the output from the
test program, rather than comparing it with a file generated
on-the-fly through the `echo' builtin.  This prevents a spurious
failure on MinGW/MSYS due to LF vs. CRLF line endings.

Reported by Ralf Wildenhues.
---
 ChangeLog              |    9 +++++++++
 tests/backcompat6.test |   17 +++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5bc575b..57dc968 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-12  Stefano Lattarini  <address@hidden>
+
+       Fix bug in test `backcompat6.test' (MSYS portability).
+       * tests/backcompat6.test (Makefile.am): Grep the output from the
+       test program, rather than comparing it with a file generated
+       on-the-fly through the `echo' builtin.  This prevents a spurious
+       failure on MinGW/MSYS due to LF vs. CRLF line endings.
+       Reported by Ralf Wildenhues.
+
 2010-11-09  Stefano Lattarini  <address@hidden>
 
        Fix bug in test `backcompat4.test' (stale autom4te cache).
diff --git a/tests/backcompat6.test b/tests/backcompat6.test
index 534ecb1..ca7412b 100755
--- a/tests/backcompat6.test
+++ b/tests/backcompat6.test
@@ -53,19 +53,12 @@ END
 cat >> Makefile.am <<'END'
 bin_PROGRAMS = foo
 foo_SOURCES = quux.c
-DISTCLEANFILES = *.tmp
 check-local:
-       rm -f exp got
-       echo 'PACKAGE = nonesuch-zardoz' > exp.tmp
-       echo 'VERSION = nonesuch-0.1' >> exp.tmp
-       echo 'PACKAGE = $(PACKAGE)' > got1.tmp
-       echo 'VERSION = $(VERSION)' >> got1.tmp
-       ./foo > got2.tmp
-       cat exp.tmp
-       cat got1.tmp
-       cat got2.tmp
-       diff exp.tmp got1.tmp
-       diff exp.tmp got2.tmp
+       test x'$(PACKAGE)' = x'nonesuch-zardoz'
+       test x'$(VERSION)' = x'nonesuch-0.1'
+       ./foo # for debugging
+       ./foo | grep '^PACKAGE = nonesuch-zardoz$$'
+       ./foo | echo '^VERSION = nonesuch-0\.1$$'
 END
 
 cat > quux.c <<'END'
-- 
1.7.1


reply via email to

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