quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] [PATCH] Fix test for GNU patch version


From: Jean Delvare
Subject: Re: [Quilt-dev] [PATCH] Fix test for GNU patch version
Date: Thu, 24 Mar 2011 21:27:23 +0100
User-agent: KMail/1.12.4 (Linux/2.6.32.29-0.3-pae; KDE/4.3.5; i686; ; )

On Tuesday 22 March 2011 11:09:22 pm Jean Delvare wrote:
> If the readability of the test cases worries you to this degree, I
>  guess it would be possible to have the test runner ignore all quotes
>  in reply to commands? Either unconditionally, or after testing for
>  the presence of an old version of GNU patch not honoring
>  QUOTING_STYLE?

Something like this?

From: Jean Delvare <address@hidden>
Subject: Improve test suite readability

The different quoting style of old versions of GNU patch forces us
to use regexp matching in various places in the test suite. Simply
stripping the quotes in question would let us make the test suite
more readable.

Signed-off-by: Jean Delvare <address@hidden>
---
 Makefile.in             |    2 +-
 test/comments.test      |    2 +-
 test/conflicts.test     |    2 +-
 test/create-delete.test |    4 ++--
 test/example1.test      |    8 ++++----
 test/half-applies.test  |   12 ++++++------
 test/import.test        |    6 +++---
 test/import2.test       |    2 +-
 test/new.test           |   12 ++++++------
 test/one.test           |    2 +-
 test/run                |   11 +++++++++--
 test/two.test           |    2 +-
 12 files changed, 36 insertions(+), 29 deletions(-)

--- a/test/run
+++ b/test/run
@@ -40,12 +40,12 @@ use strict;
 use FileHandle;
 use Getopt::Std;
 use POSIX qw(isatty setuid getcwd);
-use vars qw($opt_l $opt_q $opt_v %output);
+use vars qw($opt_l $opt_q $opt_v $opt_i %output);
 
 no warnings qw(taint);
 
 $opt_l = ~0;  # a really huge number
-getopts('l:qv');
+getopts('l:qvi');
 
 my ($OK, $FAILED) = ("ok", "failed");
 if (isatty(fileno(STDOUT))) {
@@ -148,6 +148,13 @@ sub process_test($$$$) {
                $out->[$n] =~ s/^~ //g;
           }
 
+           # If option -i is used, strip quotes before comparing outputs.
+           # This is needed for old versions of GNU patch which don't
+           # honor the QUOTING_STYLE environment variable.
+           if ($opt_i) {
+               $result->[$n] =~ s/`([^`']*)'/$1/g;
+           }
+
            if (!defined($out->[$n]) || !defined($result->[$n]) ||
                (!$use_re && $result->[$n] ne $out->[$n]) ||
                ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
--- a/Makefile.in
+++ b/Makefile.in
@@ -413,7 +413,7 @@ endif
        export LANG LC_ALL;                                             \
        $(CHECK_ENV);                                                   \
        cd $(@D);                                                       \
-       ./run -q $(<F)
+       ./run -q -i $(<F)
        @touch $@
 
 clean :
--- a/test/create-delete.test
+++ b/test/create-delete.test
@@ -28,12 +28,12 @@ file creates and deletions.
        $ echo create > create
        $ rm -f delete
        $ patch -p1 --dry-run < patches/test.diff
-       >~ The next patch would create the file `?create'?,
+       > The next patch would create the file create,
        > which already exists!  Assume -R? [n] 
        > Apply anyway? [n] 
        > Skipping patch.
        >~ 1 out of 1 hunk ignored( -- saving rejects to( file)? create.rej)?
-       >~ The next patch would delete the file `?delete'?,
+       > The next patch would delete the file delete,
        > which does not exist!  Assume -R? [n] 
        > Apply anyway? [n] 
        > Skipping patch.
--- a/test/half-applies.test
+++ b/test/half-applies.test
@@ -11,18 +11,18 @@ $ mv bar.orig bar
 $ echo foorab.diff -p0 > patches/series
 $ quilt push
 > Applying patch patches/foorab.diff
->~ patching file `?foo'?
->~ patching file `?bar'?
+> patching file foo
+> patching file bar
 > Hunk #1 FAILED at 1.
->~ 1 out of 1 hunk FAILED -- rejects in file `?bar'?
+> 1 out of 1 hunk FAILED -- rejects in file bar
 > Patch patches/foorab.diff does not apply (enforce with -f)
 
 $ quilt push
 > Applying patch patches/foorab.diff
->~ patching file `?foo'?
->~ patching file `?bar'?
+> patching file foo
+> patching file bar
 > Hunk #1 FAILED at 1.
->~ 1 out of 1 hunk FAILED -- rejects in file `?bar'?
+> 1 out of 1 hunk FAILED -- rejects in file bar
 > Patch patches/foorab.diff does not apply (enforce with -f)
 
 $ quilt push -qf
--- a/test/comments.test
+++ b/test/comments.test
@@ -22,7 +22,7 @@ accidentally removed.
 
        $ quilt push
        > Applying patch %{P}test.diff
-       >~ patching file `?f'?
+       > patching file f
        >
        > Now at patch %{P}test.diff
 
--- a/test/conflicts.test
+++ b/test/conflicts.test
@@ -64,7 +64,7 @@ anymore, then the patch is fixed.
 
        $ quilt push -qf
        > Applying patch %{P}a.diff
-       >~ 1 out of 2 hunks FAILED -- saving rejects to (file )?`?one.txt.rej'?
+       >~ 1 out of 2 hunks FAILED -- saving rejects to (file )?one.txt.rej
        > Applied patch %{P}a.diff (forced; needs refresh)
 
        $ mv one.txt one.x
--- a/test/example1.test
+++ b/test/example1.test
@@ -91,16 +91,16 @@ Or ``quilt edit Oberon.txt''
        $ mv Oberon.new Oberon.txt
        $ quilt push
        > Applying patch %{P}flower.diff
-       >~ patching file `?Oberon.txt'?
+       > patching file Oberon.txt
        > Hunk #1 FAILED at 2.
-       >~ 1 out of 1 hunk FAILED -- rejects in file `?Oberon.txt'?
+       > 1 out of 1 hunk FAILED -- rejects in file Oberon.txt
        > Patch %{P}flower.diff does not apply (enforce with -f)
 
        $ quilt push -f
        > Applying patch %{P}flower.diff
-       >~ patching file `?Oberon.txt'?
+       > patching file Oberon.txt
        > Hunk #1 FAILED at 2.
-       >~ 1 out of 1 hunk FAILED -- saving rejects to (file 
)?`?Oberon.txt.rej'?
+       >~ 1 out of 1 hunk FAILED -- saving rejects to (file )?Oberon.txt.rej
        > Applied patch %{P}flower.diff (forced; needs refresh)
 
        $ cat >> Oberon.txt
--- a/test/import.test
+++ b/test/import.test
@@ -50,7 +50,7 @@
 
        $ quilt push
        > Applying patch patches/patch1.diff
-       >~ patching file `?f'?
+       > patching file f
        >
        > Now at patch patches/patch1.diff
 
@@ -164,7 +164,7 @@
 
        $ quilt push
        > Applying patch patches/patchR.diff
-       >~ patching file `?f'?
+       > patching file f
        >
        > Now at patch patches/patchR.diff
 
@@ -201,7 +201,7 @@
 
        $ quilt push
        > Applying patch patches/patchRp0.diff
-       >~ patching file `?f'?
+       > patching file f
        >
        > Now at patch patches/patchRp0.diff
 
--- a/test/import2.test
+++ b/test/import2.test
@@ -31,7 +31,7 @@
 
        $ quilt push
        > Applying patch %{P}patch1.diff.gz
-       >~ patching file `?f'?
+       > patching file f
        >
        > Now at patch %{P}patch1.diff.gz
 
--- a/test/new.test
+++ b/test/new.test
@@ -16,18 +16,18 @@
 
        $ quilt push
        > Applying patch %{P}p.diff
-       >~ patching file `?f'?
+       > patching file f
        > Hunk #1 FAILED at 1.
-       >~ 1 out of 1 hunk FAILED -- rejects in file `?f'?
-       >~ patching file `?g'?
+       > 1 out of 1 hunk FAILED -- rejects in file f
+       > patching file g
        > Patch %{P}p.diff does not apply (enforce with -f)
 
        $ quilt push -f
        > Applying patch %{P}p.diff
-       >~ patching file `?f'?
+       > patching file f
        > Hunk #1 FAILED at 1.
-       >~ 1 out of 1 hunk FAILED -- saving rejects to (file )?`?f.rej'?
-       >~ patching file `?g'?
+       >~ 1 out of 1 hunk FAILED -- saving rejects to (file )?f.rej
+       > patching file g
        > Applied patch %{P}p.diff (forced; needs refresh)
 
        $ echo new > f
--- a/test/one.test
+++ b/test/one.test
@@ -94,7 +94,7 @@ of the installed quilt with `make check'
 
        $ quilt push
        > Applying patch %{P}patch2.diff
-       >~ patching file `?dir/file3'?
+       > patching file dir/file3
        >
        > Now at patch %{P}patch2.diff
 
--- a/test/two.test
+++ b/test/two.test
@@ -95,7 +95,7 @@
 
        $ quilt push
        > Applying patch %{_P}patch2.diff
-       >~ patching file `?d/dir/file3'?
+       > patching file d/dir/file3
        >
        > Now at patch %{_P}patch2.diff
 

-- 
Jean Delvare
Suse L3



reply via email to

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