On Friday 12 November 2010, Ralf Wildenhues wrote: > * Stefano Lattarini wrote on Fri, Nov 12, 2010 at 08:37:14PM CET: > > On Friday 12 November 2010, Ralf Wildenhues wrote: > > > 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). > > Leave out the $ in the grep patterns, in case grep assumes LF only. Done adding a proper comment.
> OK with that change. But you could have left the other comparisons > intact; however you like. Nah, the new way is better IMO. I've just added a `!' to the `foo' output to act as a poor-man end-of-line indicator. > Thanks, > Ralf > > > 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. > > How about > > * tests/backcompat6.test (Makefile.am): Grep output, to avoid newline > encoding differences on MSYS. How about * tests/backcompat6.test (Makefile.am): Grep the output from the test program, rather than diffing it, to avoid spurious failures on MinGW/MSYS due to LF vs. CRLF line endings. -*-*- This is what I squashed in; I will merge to master and push later (or tomorrow) if there are no further objections. diff --git a/ChangeLog b/ChangeLog index 57dc968..bf2e617 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,9 +2,8 @@ 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. + test program, rather than diffing it, to avoid spurious failures + on MinGW/MSYS due to LF vs. CRLF line endings. Reported by Ralf Wildenhues. 2010-11-09 Stefano Lattarini <stefano.lattar...@gmail.com> diff --git a/tests/backcompat6.test b/tests/backcompat6.test index ca7412b..642ffaa 100755 --- a/tests/backcompat6.test +++ b/tests/backcompat6.test @@ -57,8 +57,11 @@ check-local: 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$$' + ## Do not anchor the regexps w.r.t. the end of line, because on + ## MinGW/MSYS, grep may assume LF line endings only, while our + ## `foo' program may generate CRLF line endings. + ./foo | grep '^PACKAGE = nonesuch-zardoz!' + ./foo | echo '^VERSION = nonesuch-0\.1!' END cat > quux.c <<'END' @@ -66,7 +69,7 @@ cat > quux.c <<'END' #include <stdio.h> int main (void) { - printf("PACKAGE = %s\nVERSION = %s\n", PACKAGE, VERSION); + printf("PACKAGE = %s!\nVERSION = %s!\n", PACKAGE, VERSION); return 0; } END