Skip to contentSkip to conversation

test-suite: Add -b option to ignore CR at eol on MinGW

PATCH In review Ramsay Jones 3 participants 5 messages May 21, 2013 – May 22, 2013 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 test-suite: Add -b option to ignore CR at eol on MinGW

---
 validation/test-suite | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
validation/test-suite +1 -1
index 3c011c6..ded93fc 100755
@@ -126,7 +126,7 @@ do_test()
 	actual_exit_value=$?
 
 	for stream in output error; do
-		diff -u "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff
+		diff -ub "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff
 		if [ "$?" -ne "0" ]; then
 			error "actual $stream text does not match expected $stream text."
 			error  "see $file.$stream.* for further investigation."
Signature · 1 line
1.8.2
#1 lore raw
Quoted 1 line · Ramsay Jones

-b doesn't just ignore CR at end of line; it would also ignore changes in the amount of whitespace elsewhere on the line. You might consider piping the input that has CRs through sed before storing it, to delete the CR at end of line before comparing, instead.

Quoted 24 lines
---
 validation/test-suite | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
validation/test-suite +1 -1
index 3c011c6..ded93fc 100755
@@ -126,7 +126,7 @@ do_test()
 	actual_exit_value=$?
 
 	for stream in output error; do
-		diff -u "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff
+		diff -ub "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff
 		if [ "$?" -ne "0" ]; then
 			error "actual $stream text does not match expected $stream text."
 			error  "see $file.$stream.* for further investigation."
Signature · 6 lines
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 7 lines · Josh Triplett
Quoted 1 line · Ramsay Jones

-b doesn't just ignore CR at end of line; it would also ignore changes in the amount of whitespace elsewhere on the line. You might consider piping the input that has CRs through sed before storing it, to delete the CR at end of line before comparing, instead.

Or just use --strip-trailing-cr, no? Or maybe that's not available?

johannes

#3 lore raw
Quoted 10 lines · Johannes Berg
Quoted 7 lines · Josh Triplett
Quoted 1 line · Ramsay Jones

-b doesn't just ignore CR at end of line; it would also ignore changes in the amount of whitespace elsewhere on the line. You might consider piping the input that has CRs through sed before storing it, to delete the CR at end of line before comparing, instead.

Or just use --strip-trailing-cr, no? Or maybe that's not available?

Nice, I didn't know about that one. Yes, if MinGW's diff has that, by all means use it.

- Josh Triplett

#4 lore raw
Quoted 10 lines · Josh Triplett
Quoted 9 lines · Johannes Berg
Quoted 7 lines · Josh Triplett
Quoted 1 line · Ramsay Jones

-b doesn't just ignore CR at end of line; it would also ignore changes in the amount of whitespace elsewhere on the line. You might consider piping the input that has CRs through sed before storing it, to delete the CR at end of line before comparing, instead.

Quoted 4 lines
Quoted 1 line

Or just use --strip-trailing-cr, no? Or maybe that's not available?

Nice, I didn't know about that one. Yes, if MinGW's diff has that, by all means use it.

Heh, that was the first thing I tried, but it doesn't work:

  $ diff --strip-trailing-cr sparse.c{~,}
  diff: unrecognized option `--strip-trailing-cr'
  diff: Try `diff --help' for more information.
  $ diff --version
  diff - GNU diffutils version 2.7
  $

It works just fine on cygwin and Linux, but the diff versions are newer there, for example on cygwin:

  $ diff --version
  diff (GNU diffutils) 2.8.7
  Written by Paul Eggert, Mike Haertel, David Hayes,
  Richard Stallman, and Len Tower.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $

Hmm, does it really matter that it would miss whitespace changes elsewhere in the line? (Ah, maybe some of the preprocessor tests?)

I think I would prefer to go back to the original _setmode() patch than to mess with sed. ;-)

[Also, this MinGW is the one that came from the msysgit installer from a couple of years ago. Maybe it has been updated. uname shows that the MinGW I'm using was dated Feb 2010. dunno.]

ATB,
Ramsay Jones