linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW
@ 2013-05-21 19:18 Ramsay Jones
  2013-05-21 21:16 ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Ramsay Jones @ 2013-05-21 19:18 UTC (permalink / raw)
  To: Christopher Li; +Cc: Sparse Mailing-list


Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 validation/test-suite | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/validation/test-suite b/validation/test-suite
index 3c011c6..ded93fc 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -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."
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW
  2013-05-21 19:18 [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW Ramsay Jones
@ 2013-05-21 21:16 ` Josh Triplett
  2013-05-21 21:27   ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2013-05-21 21:16 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Christopher Li, Sparse Mailing-list

On Tue, May 21, 2013 at 08:18:21PM +0100, Ramsay Jones wrote:
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

-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.

> ---
>  validation/test-suite | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/validation/test-suite b/validation/test-suite
> index 3c011c6..ded93fc 100755
> --- a/validation/test-suite
> +++ b/validation/test-suite
> @@ -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."
> -- 
> 1.8.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW
  2013-05-21 21:16 ` Josh Triplett
@ 2013-05-21 21:27   ` Johannes Berg
  2013-05-21 21:46     ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2013-05-21 21:27 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Ramsay Jones, Christopher Li, Sparse Mailing-list

On Tue, 2013-05-21 at 14:16 -0700, Josh Triplett wrote:
> On Tue, May 21, 2013 at 08:18:21PM +0100, Ramsay Jones wrote:
> > Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> 
> -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW
  2013-05-21 21:27   ` Johannes Berg
@ 2013-05-21 21:46     ` Josh Triplett
  2013-05-22 21:19       ` Ramsay Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2013-05-21 21:46 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Ramsay Jones, Christopher Li, Sparse Mailing-list

On Tue, May 21, 2013 at 11:27:00PM +0200, Johannes Berg wrote:
> On Tue, 2013-05-21 at 14:16 -0700, Josh Triplett wrote:
> > On Tue, May 21, 2013 at 08:18:21PM +0100, Ramsay Jones wrote:
> > > Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> > 
> > -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW
  2013-05-21 21:46     ` Josh Triplett
@ 2013-05-22 21:19       ` Ramsay Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Ramsay Jones @ 2013-05-22 21:19 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Johannes Berg, Christopher Li, Sparse Mailing-list

Josh Triplett wrote:
> On Tue, May 21, 2013 at 11:27:00PM +0200, Johannes Berg wrote:
>> On Tue, 2013-05-21 at 14:16 -0700, Josh Triplett wrote:
>>> On Tue, May 21, 2013 at 08:18:21PM +0100, Ramsay Jones wrote:
>>>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>>>
>>> -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.

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-22 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 19:18 [PATCH 4/5] test-suite: Add -b option to ignore CR at eol on MinGW Ramsay Jones
2013-05-21 21:16 ` Josh Triplett
2013-05-21 21:27   ` Johannes Berg
2013-05-21 21:46     ` Josh Triplett
2013-05-22 21:19       ` Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).