bug-automake
[Top][All Lists]
Advanced

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

bug#14493: MSYS line ending problem in t/cxx-demo.sh


From: Peter Rosin
Subject: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 15:39:14 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 2013-05-29 10:57, Stefano Lattarini wrote:
> On 05/29/2013 01:43 AM, Peter Rosin wrote:
>> Hi!
>>
>> I have this interesting log snippet from a failed run of t/cxx-demo.sh
>> on the master branch (commit baf8a1c22acce0908):
>>
> And as you noted in your follow-up message, the problem is the same on
> the micro branch (87e49f4f040c8ab))
> 
>>
>> + for p in play work
>> + ./play
>> + cat exp.play
>> We are playing :-)
>> Howdy, play!
>> + cat got.play
>> We are playing :-)
>> Howdy, play!
>> + diff exp.play got.play
>> 1,2c1,2
>> < We are playing :-)
>> < Howdy, play!
>> ---
>>> We are playing :-)
>>> Howdy, play!
>> + am_exit_trap 1
>> + exit_status=1
>>
>>
>> This is on MSYS, and I strongly suspect a line ending discrepancy.
>> The output from ./play is likely to have CRNL line endings, while
>> exp.play is likely to have NL line endings. diff then barfs.
>>
> Any suggestion on how to easily fix this?
> 
> If not, I have a utterly untested idea:
> 
>   - Add a new helper function to t/ax/am-test-lib.sh that tells whether
>     we are running on MinGW or no (you can steal existing code from the
>     'require_tool()' function).
> 
>   - Use it in cxx-demo.sh to determine whether we are running under
>     MinGW.
> 
>   - If that's the case, use perl to normalize the line endings (turning
>     all CR-LF into simple LF).
> 
> Is this doable?

Yes, but why not always zap all CR characters? Shouldn't weaken the test
by much...

Something like the below change perhaps? (perl seemed a bit heavy)

Cheers,
Peter


diff --git a/t/cxx-demo.sh b/t/cxx-demo.sh
index f6d568d..27d18e1 100644
--- a/t/cxx-demo.sh
+++ b/t/cxx-demo.sh
@@ -165,7 +165,7 @@ END
     Good morning, work.
 END
   for p in play work; do
-    ./$p > got.$p || { cat got.$p; exit 1; }
+    ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
     cat exp.$p
     cat got.$p
     diff exp.$p got.$p







reply via email to

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