diff options
46 files changed, 218 insertions, 398 deletions
diff --git a/quilt.changes b/quilt.changes index a318c50..594607d 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Sat Jan 23 21:11:12 CET 2010 - jdelvare@suse.de + +- test/run, test/*.test: Separate working directory for each test + case. + +------------------------------------------------------------------- Sat Jan 23 17:59:33 CET 2010 - hertzog@debian.org - quilt/scripts/patchfns.in: Remember QUILT_PATCHES and diff --git a/test/add-filename-check.test b/test/add-filename-check.test index 306af66..2d782a3 100644 --- a/test/add-filename-check.test +++ b/test/add-filename-check.test @@ -1,6 +1,5 @@ -$ rm -rf d -$ mkdir -p d/patches -$ cd d +$ mkdir patches + $ quilt new test.diff >Patch patches/test.diff is now on top @@ -13,6 +12,3 @@ $ quilt add patches/bar $ quilt add .pc/baz > File .pc/baz is located below .pc/ - -$ cd .. -$ rm -rf d diff --git a/test/annotate.test b/test/annotate.test index 0c79471..556fa85 100644 --- a/test/annotate.test +++ b/test/annotate.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > foo < foo @@ -114,6 +112,3 @@ > 1 two > > 1 patches/patch4 - - $ cd .. - $ rm -rf d diff --git a/test/applied.test b/test/applied.test index f2fa8e8..9840404 100644 --- a/test/applied.test +++ b/test/applied.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo a > a $ echo b > b @@ -35,6 +33,3 @@ > Applying patch patches/patch > 1 out of 1 hunk FAILED > Patch patches/patch can be reverse-applied - - $ cd .. - $ rm -rf d diff --git a/test/basedir.no-test b/test/basedir.no-test index 26506a5..8799585 100644 --- a/test/basedir.no-test +++ b/test/basedir.no-test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo foo.orig > foo.orig $ echo foo > foo @@ -24,6 +22,3 @@ > Applying patch patches/foo.diff > Applying patch patches/bar.diff > Now at patch patches/bar.diff - - $ cd .. - $ rm -rf d diff --git a/test/comments.test b/test/comments.test index f6115ab..bbf34ff 100644 --- a/test/comments.test +++ b/test/comments.test @@ -1,9 +1,8 @@ Regresion test case: Empty lines in patch descriptions were accidentally removed. - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches + $ echo one > f $ cat > patches/test.diff < C1 @@ -75,6 +74,3 @@ accidentally removed. > @@ -1 +1 @@ > -one > +two - $ cd .. - $ rm -rf d - diff --git a/test/conflicts.test b/test/conflicts.test index 11f43f8..bfd66fa 100644 --- a/test/conflicts.test +++ b/test/conflicts.test @@ -2,9 +2,7 @@ This test case creates a patch and then applies that patch to a modified source file. The source file is modified until the patch doesn't apply anymore, then the patch is fixed. - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > one.txt < 1 @@ -73,7 +71,7 @@ anymore, then the patch is fixed. $ sed -e "s/4/4+/" one.x > one.txt $ rm -f one.x $ quilt diff -z | grep -v "^\\(---\\|+++\\)" - > Index: d/one.txt + >~ Index: [^/]+/one\.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- @@ -86,7 +84,7 @@ anymore, then the patch is fixed. > 7- $ quilt diff | grep -v "^\\(---\\|+++\\)" - > Index: d/one.txt + >~ Index: [^/]+/one\.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- @@ -111,7 +109,7 @@ anymore, then the patch is fixed. > Refreshed patch %{P}a.diff $ cat patches/a.diff | grep -v "^\\(---\\|+++\\)" - > Index: d/one.txt + >~ Index: [^/]+/one\.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- @@ -135,6 +133,3 @@ anymore, then the patch is fixed. $ quilt pop -q > Removing patch %{P}a.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/create-delete.test b/test/create-delete.test index fbd5543..315edb8 100644 --- a/test/create-delete.test +++ b/test/create-delete.test @@ -1,9 +1,7 @@ Check whether quilt generates patches properly so that GNU patch recognizes file creates and deletions. - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo delete > delete $ quilt new test.diff @@ -40,6 +38,3 @@ file creates and deletions. > Apply anyway? [n] > Skipping patch. > 1 out of 1 hunk ignored - - $ cd .. - $ rm -rf d diff --git a/test/delete.test b/test/delete.test index 3b71fc0..aa7ce88 100644 --- a/test/delete.test +++ b/test/delete.test @@ -1,8 +1,6 @@ Test the delete command. - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt delete > No patches in series @@ -99,6 +97,3 @@ Test the delete command. $ quilt delete test3 > Removed patch %{P}test3 - - $ cd .. - $ rm -rf d diff --git a/test/dir-a-b.test b/test/dir-a-b.test index a1713ce..d921079 100644 --- a/test/dir-a-b.test +++ b/test/dir-a-b.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo a > test.txt $ echo d > test3.txt @@ -63,6 +61,3 @@ $ quilt pop -qR > Removing patch patches/ab.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/dotglob.test b/test/dotglob.test index 3fdd2d2..b325806 100644 --- a/test/dotglob.test +++ b/test/dotglob.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new dotglob.diff > Patch patches/dotglob.diff is now on top @@ -19,6 +17,3 @@ $ quilt push -q > Applying patch patches/dotglob.diff > Now at patch patches/dotglob.diff - - $ cd .. - $ rm -rf d diff --git a/test/edit.test b/test/edit.test index ee1c1f6..1c0c500 100644 --- a/test/edit.test +++ b/test/edit.test @@ -1,6 +1,4 @@ -$ rm -rf d -$ mkdir -p d/patches d/subdir -$ cd d +$ mkdir patches subdir $ cat > editor < #! /bin/sh @@ -34,6 +32,3 @@ $ cat subdir/foo $ quilt files > foobar > subdir/foo - -$ cd ../.. -$ rm -rf d diff --git a/test/empty.test b/test/empty.test index fb57ee7..b765917 100644 --- a/test/empty.test +++ b/test/empty.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > patches/series < empty1.diff @@ -34,6 +32,3 @@ $ quilt rename -P empty3.diff empty_new.diff > Patch %{P}empty3.diff renamed to %{P}empty_new.diff - - $ cd .. - $ rm -rf d diff --git a/test/example1.test b/test/example1.test index fabb362..822741b 100644 --- a/test/example1.test +++ b/test/example1.test @@ -1,9 +1,8 @@ The text used here was taken from: http://the-tech.mit.edu/Shakespeare/midsummer/full.html - $ rm -rf example1 - $ mkdir -p example1/patches - $ cd example1 + $ mkdir patches + $ cat > Oberon.txt < Yet mark'd I where the bolt of Cupid fell: < It fell upon a little western flower, @@ -23,14 +22,14 @@ http://the-tech.mit.edu/Shakespeare/midsummer/full.html Or ``quilt edit Oberon.txt'' - $ quilt refresh + $ quilt refresh -p ab > Refreshed patch %{P}flower.diff $ cat patches/flower.diff - > Index: example1/Oberon.txt + > Index: b/Oberon.txt > =================================================================== - > --- example1.orig/Oberon.txt - > +++ example1/Oberon.txt + > --- a/Oberon.txt + > +++ b/Oberon.txt > @@ -2,3 +2,6 @@ > It fell upon a little western flower, > Before milk-white, now purple with love's wound, @@ -43,11 +42,11 @@ Or ``quilt edit Oberon.txt'' $ echo "Fetch me that flower; the herb I shew'd thee once:" >> Oberon.new $ sed -e '1,4d' Oberon.txt >> Oberon.new $ mv Oberon.new Oberon.txt - $ quilt diff -z - > Index: example1/Oberon.txt + $ quilt diff -z -p ab + > Index: b/Oberon.txt > =================================================================== - > --- example1.orig/Oberon.txt - > +++ example1/Oberon.txt + > --- a/Oberon.txt + > +++ b/Oberon.txt > @@ -2,6 +2,7 @@ > It fell upon a little western flower, > Before milk-white, now purple with love's wound, @@ -57,11 +56,11 @@ Or ``quilt edit Oberon.txt'' > Will make a man or woman madly dote > Upon the next live creature that it sees. - $ quilt diff - > Index: example1/Oberon.txt + $ quilt diff -p ab + > Index: b/Oberon.txt > =================================================================== - > --- example1.orig/Oberon.txt - > +++ example1/Oberon.txt + > --- a/Oberon.txt + > +++ b/Oberon.txt > @@ -2,3 +2,7 @@ > It fell upon a little western flower, > Before milk-white, now purple with love's wound, @@ -110,7 +109,7 @@ Or ``quilt edit Oberon.txt'' < Will make a man or woman madly dote < Upon the next live creature that it sees. - $ quilt refresh + $ quilt refresh -p ab > Refreshed patch %{P}flower.diff $ cat Oberon.txt @@ -124,10 +123,10 @@ Or ``quilt edit Oberon.txt'' > Upon the next live creature that it sees. $ cat patches/flower.diff - > Index: example1/Oberon.txt + > Index: b/Oberon.txt > =================================================================== - > --- example1.orig/Oberon.txt - > +++ example1/Oberon.txt + > --- a/Oberon.txt + > +++ b/Oberon.txt > @@ -2,3 +2,7 @@ > It fell upon a little western flower, > Before milk-white, now purple with love's wound, @@ -136,6 +135,3 @@ Or ``quilt edit Oberon.txt'' > +The juice of it on sleeping eye-lids laid > +Will make a man or woman madly dote > +Upon the next live creature that it sees. - - $ cd .. - $ rm -rf example1 diff --git a/test/failpop.test b/test/failpop.test index c627461..ac46520 100644 --- a/test/failpop.test +++ b/test/failpop.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > test.txt < This is test.txt. @@ -23,6 +21,3 @@ $ mv patches/test.new patches/test.diff $ quilt pop > Patch %{P}test.diff does not remove cleanly (refresh it or enforce with -f) - - $ cd .. - $ rm -rf d diff --git a/test/fold.test b/test/fold.test index fa84a39..aa1a79e 100644 --- a/test/fold.test +++ b/test/fold.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > patches/series < patch1.diff @@ -33,17 +31,17 @@ < @@ -0,0 +1 @@ < +This is file3.txt. - $ quilt diff - > Index: d/file1.txt + $ quilt diff -p ab + > Index: b/file1.txt > =================================================================== > --- /dev/null - > +++ d/file1.txt + > +++ b/file1.txt > @@ -0,0 +1 @@ > +This is file1.txt. - > Index: d/dir/file3.txt + > Index: b/dir/file3.txt > =================================================================== > --- /dev/null - > +++ d/dir/file3.txt + > +++ b/dir/file3.txt > @@ -0,0 +1 @@ > +This is file3.txt. @@ -56,19 +54,16 @@ < +This is file3.txt, now modified. $ cd .. - $ quilt diff - > Index: d/file1.txt + $ quilt diff -p ab + > Index: b/file1.txt > =================================================================== > --- /dev/null - > +++ d/file1.txt + > +++ b/file1.txt > @@ -0,0 +1 @@ > +This is file1.txt. - > Index: d/dir/file3.txt + > Index: b/dir/file3.txt > =================================================================== > --- /dev/null - > +++ d/dir/file3.txt + > +++ b/dir/file3.txt > @@ -0,0 +1 @@ > +This is file3.txt, now modified. - - $ cd .. - $ rm -rf d diff --git a/test/formats.test b/test/formats.test index 8fcb53c..43b3ae4 100644 --- a/test/formats.test +++ b/test/formats.test @@ -1,4 +1,6 @@ - $ rm -rf d + # We create our own working directory to be able to verify + # all patch formats, including the ones which mention the + # base directory. $ mkdir -p d/patches $ cd d @@ -116,6 +118,3 @@ > +new > 4 > 5 - - $ cd .. - $ rm -rf d diff --git a/test/half-applies.test b/test/half-applies.test index a0aba9c..258b225 100644 --- a/test/half-applies.test +++ b/test/half-applies.test @@ -1,6 +1,4 @@ -$ rm -rf d -$ mkdir -p d/patches -$ cd d +$ mkdir patches $ echo foo > foo.orig $ echo foo2 > foo @@ -40,5 +38,3 @@ $ quilt diff > @@ -1 +1 @@ > -foo > +foo2 -$ cd .. -$ rm -rf d diff --git a/test/header.test b/test/header.test index 29d89b3..0316129 100644 --- a/test/header.test +++ b/test/header.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo foo > foo $ quilt new patch @@ -10,7 +8,7 @@ > File foo added to patch patches/patch $ echo bar > foo - $ quilt refresh + $ quilt refresh -p ab > Refreshed patch patches/patch $ mv patches/patch patches/patch~ @@ -37,13 +35,10 @@ $ cat patches/patch > Header2 > Appended - > Index: d/foo + > Index: b/foo > =================================================================== - > --- d.orig/foo - > +++ d/foo + > --- a/foo + > +++ b/foo > @@ -1 +1 @@ > -foo > +bar - - $ cd .. - $ rm -rf d diff --git a/test/import.test b/test/import.test index cebbe3b..8eb40c7 100644 --- a/test/import.test +++ b/test/import.test @@ -1,7 +1,4 @@ - - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new patch1.diff > Patch %{P}patch1.diff is now on top @@ -249,6 +246,3 @@ $ cat patches/series > patch1.diff > patchR.diff - - $ cd .. - $ rm -rf d diff --git a/test/import2.test b/test/import2.test index af6a5fd..f839930 100644 --- a/test/import2.test +++ b/test/import2.test @@ -1,8 +1,6 @@ # same as import.test, but with compressed patches - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new patch1.diff > Patch %{P}patch1.diff is now on top @@ -138,6 +136,3 @@ $ quilt delete patch1.diff.gz > Patch patch1.diff.gz is not in series - - $ cd .. - $ rm -rf d diff --git a/test/mail.test b/test/mail.test index ffb35f5..cc8736a 100644 --- a/test/mail.test +++ b/test/mail.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > no-subject < Here goes a longer description of the patch, which is @@ -92,6 +90,3 @@ > Subject: [test 5/6] Subject of 5.diff > From a@b.c > Subject: [test 6/6] Must not expand * ? [abc] - - $ cd .. - $ rm -rf d diff --git a/test/merge.test b/test/merge.test index a3fa679..c64b33d 100644 --- a/test/merge.test +++ b/test/merge.test @@ -1,8 +1,6 @@ Test the patch merging functionality of `quilt diff'. - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > abc.txt < a @@ -43,7 +41,7 @@ Test the patch merging functionality of `quilt diff'. $ quilt diff -P b.diff | grep -v "^\\(---\\|+++\\)" > Warning: more recent patches modify files in patch %{P}b.diff - > Index: d/abc.txt + >~ Index: [^/]+/abc\.txt > =================================================================== > @@ -1,3 +1,3 @@ > a+ @@ -53,7 +51,7 @@ Test the patch merging functionality of `quilt diff'. $ quilt diff --combine a.diff -P b.diff | grep -v "^\\(---\\|+++\\)" > Warning: more recent patches modify files in patch %{P}b.diff - > Index: d/abc.txt + >~ Index: [^/]+/abc\.txt > =================================================================== > @@ -1,3 +1,3 @@ > -a @@ -63,7 +61,7 @@ Test the patch merging functionality of `quilt diff'. > c $ quilt diff --combine b.diff | grep -v "^\\(---\\|+++\\)" - > Index: d/abc.txt + >~ Index: [^/]+/abc\.txt > =================================================================== > @@ -1,3 +1,3 @@ > a+ @@ -73,7 +71,7 @@ Test the patch merging functionality of `quilt diff'. > +c+ $ quilt diff --combine - | grep -v "^\\(---\\|+++\\)" - > Index: d/abc.txt + >~ Index: [^/]+/abc\.txt > =================================================================== > @@ -1,3 +1,3 @@ > -a @@ -82,6 +80,3 @@ Test the patch merging functionality of `quilt diff'. > +a+ > +b+ > +c+ - - $ cd .. - $ rm -rf d diff --git a/test/missing.test b/test/missing.test index d507671..3dea09c 100644 --- a/test/missing.test +++ b/test/missing.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > patches/series < missing1.diff @@ -20,6 +18,3 @@ > Patch %{P}missing3.diff appears to be empty, removing > Patch patches/missing1.diff appears to be empty, removing > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/new-nosubdir.test b/test/new-nosubdir.test index 021ce4a..5512b41 100644 --- a/test/new-nosubdir.test +++ b/test/new-nosubdir.test @@ -1,11 +1,6 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ mkdir sub $ cd sub $ quilt new here.diff > Patch %{_P}here.diff is now on top - - $ cd ../.. - $ rm -rf d diff --git a/test/new.test b/test/new.test index f71d4ed..19633d8 100644 --- a/test/new.test +++ b/test/new.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo reject > f $ echo p.diff > patches/series @@ -33,22 +31,19 @@ > Applied patch %{P}p.diff (forced; needs refresh) $ echo new > f - $ quilt refresh + $ quilt refresh -p ab > Refreshed patch %{P}p.diff $ cat patches/p.diff - > Index: d/f + > Index: b/f > =================================================================== - > --- d.orig/f - > +++ d/f + > --- a/f + > +++ b/f > @@ -1 +1 @@ > -reject > +new - > Index: d/g + > Index: b/g > =================================================================== > --- /dev/null - > +++ d/g + > +++ b/g > @@ -0,0 +1 @@ > +added - - $ cd .. - $ rm -rf d diff --git a/test/nolink.test b/test/nolink.test index aa1efe0..e7d4173 100644 --- a/test/nolink.test +++ b/test/nolink.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches # quilt should preserve hard links and not create new ones $ echo foo > foo @@ -72,6 +70,3 @@ $ quilt pop -q > Removing patch patches/test.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/null-bug.test b/test/null-bug.test index 5ba7e4d..aa926f9 100644 --- a/test/null-bug.test +++ b/test/null-bug.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ echo file > file $ quilt new remove.diff @@ -31,6 +29,3 @@ or else patch won't know the real original filename anymore. $ quilt push -q > Applying patch patches/remove.diff > Now at patch patches/remove.diff - - $ cd .. - $ rm -r d diff --git a/test/one.test b/test/one.test index b565b20..9131d4f 100644 --- a/test/one.test +++ b/test/one.test @@ -5,9 +5,8 @@ of the installed quilt with `make check'. (To run, type `./run one.test' in this directory.) - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches + $ mkdir dir $ echo "This is file one." > dir/file1 $ quilt new patch1.diff @@ -25,19 +24,19 @@ of the installed quilt with `make check'. > Nothing in patch %{P}patch1.diff $ echo "This is file two." > file2 - $ quilt diff - > Index: d/file2 + $ quilt diff -p ab + > Index: b/file2 > =================================================================== > --- /dev/null - > +++ d/file2 + > +++ b/file2 > @@ -0,0 +1 @@ > +This is file two. - $ quilt diff -z - > Index: d/file2 + $ quilt diff -z -p ab + > Index: b/file2 > =================================================================== > --- /dev/null - > +++ d/file2 + > +++ b/file2 > @@ -0,0 +1 @@ > +This is file two. @@ -46,20 +45,20 @@ of the installed quilt with `make check'. $ quilt diff -z $ echo "Another line has been added." >> dir/file1 - $ quilt diff -z - > Index: d/dir/file1 + $ quilt diff -z -p ab + > Index: b/dir/file1 > =================================================================== - > --- d.orig/dir/file1 - > +++ d/dir/file1 + > --- a/dir/file1 + > +++ b/dir/file1 > @@ -1 +1,2 @@ > This is file one. > +Another line has been added. - $ quilt diff -z dir/file1 - > Index: d/dir/file1 + $ quilt diff -z -p ab dir/file1 + > Index: b/dir/file1 > =================================================================== - > --- d.orig/dir/file1 - > +++ d/dir/file1 + > --- a/dir/file1 + > +++ b/dir/file1 > @@ -1 +1,2 @@ > This is file one. > +Another line has been added. @@ -106,10 +105,10 @@ of the installed quilt with `make check'. > File file4 added to patch %{P}subdir/patch3.diff $ rm -f file4 - $ quilt diff - > Index: d/file4 + $ quilt diff -p ab + > Index: b/file4 > =================================================================== - > --- d.orig/file4 + > --- a/file4 > +++ /dev/null > @@ -1 +0,0 @@ > -This is file 4. @@ -125,11 +124,11 @@ of the installed quilt with `make check'. > Refreshed patch %{P}patch2.diff $ echo "Another line added." >> file2 - $ quilt diff -z -P patch1 - > Index: d/file2 + $ quilt diff -z -P patch1 -p ab + > Index: b/file2 > =================================================================== - > --- d.orig/file2 - > +++ d/file2 + > --- a/file2 + > +++ b/file2 > @@ -1 +1,2 @@ > This is file two. > +Another line added. @@ -155,6 +154,3 @@ of the installed quilt with `make check'. > Removing patch %{P}patch2.diff > Removing patch %{P}patch1.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/patch-wrapper.test b/test/patch-wrapper.test index 32c80bb..48678dd 100644 --- a/test/patch-wrapper.test +++ b/test/patch-wrapper.test @@ -1,6 +1,4 @@ -$ rm -rf d -$ mkdir -p d/somewhere -$ cd d +$ mkdir somewhere $ cat > foo.orig < 1 @@ -69,6 +67,3 @@ $ quilt pop -q > Removing patch patches/somewhere/foo.diff > No patches applied $ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc} - -$ cd .. -$ rm -rf d diff --git a/test/perms.test b/test/perms.test index db13286..7539f67 100644 --- a/test/perms.test +++ b/test/perms.test @@ -1,7 +1,6 @@ - $ rm -rf d $ umask 022 - $ mkdir -p d/patches - $ cd d + $ mkdir patches + $ echo foo > foo $ chmod 704 foo $ ls -l foo | awk '{ print $1,$NF }' @@ -55,6 +54,3 @@ the backup file. $ quilt pop -q > Removing patch %{P}test2.diff > Now at patch %{P}test.diff - - $ cd .. - $ rm -rf d diff --git a/test/refresh-z.test b/test/refresh-z.test index 7c1c264..0916e6f 100644 --- a/test/refresh-z.test +++ b/test/refresh-z.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new test.diff > Patch patches/test.diff is now on top @@ -24,6 +22,3 @@ > patches/test.diff > patches/test-2.diff > patches/baz.diff - - $ cd .. - $ rm -rf d diff --git a/test/remember-locations.test b/test/remember-locations.test index c1b340c..2631df5 100644 --- a/test/remember-locations.test +++ b/test/remember-locations.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/my/changes - $ cd d + $ mkdir -p my/changes $ export QUILT_PATCHES=my/changes $ export QUILT_SERIES=patchlist @@ -26,5 +24,4 @@ > ../my/changes/mychange1 > ../my/changes/mychange2 - $ cd ../.. - $ rm -rf d + $ cd .. diff --git a/test/rename.test b/test/rename.test index 0894893..3dcd31e 100644 --- a/test/rename.test +++ b/test/rename.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > announce.txt < A short summary of the fixes are below. @@ -57,6 +55,3 @@ $ quilt pop -q > Removing patch %{P}newsubdir/final.name.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/revert.test b/test/revert.test index 8656391..635a24e 100644 --- a/test/revert.test +++ b/test/revert.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ mkdir sub $ echo f1 > sub/f @@ -50,6 +48,3 @@ > Changes to sub/h in patch ../patches/p.diff reverted $ quilt diff -z - - $ cd ../.. - $ rm -rf d diff --git a/test/revert2.test b/test/revert2.test index d1c6bd0..b67e343 100644 --- a/test/revert2.test +++ b/test/revert2.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new revert.patch > Patch patches/revert.patch is now on top @@ -25,6 +23,3 @@ $ quilt refresh > Patch patches/revert.patch is unchanged - - $ cd .. - $ rm -rf d @@ -61,9 +61,22 @@ my $prog_line = 0; my ($tests, $failed) = (0,0); my $lineno; my $width = ($ENV{COLUMNS} || 80) >> 1; +my $origdir = getcwd; +my $workdir = "d.$$"; + +# Create a dedicated working directory +mkdir $workdir or die; +chdir $workdir or die; +$ENV{PWD} = getcwd; + +if (defined $ARGV[0]) { + open(SOURCE, "$origdir/$ARGV[0]"); +} else { + *SOURCE = *STDIN; +} for (;;) { - my $line = <>; $lineno++; + my $line = <SOURCE>; $lineno++; if (defined $line) { # Substitute %VAR and %{VAR} with environment variables. $line =~ s[%(\w+)][$ENV{$1}]eg; @@ -93,6 +106,12 @@ for (;;) { } } +close(SOURCE); + +# Clean up the mess +chdir $origdir or die; +system "rm -rf $workdir"; + my $status = sprintf("%d commands (%d passed, %d failed)", $tests, $tests-$failed, $failed); if (isatty(fileno(STDOUT))) { diff --git a/test/setup.test b/test/setup.test index e1744c7..5e09e75 100644 --- a/test/setup.test +++ b/test/setup.test @@ -1,6 +1,5 @@ -$ rm -rf d -$ mkdir -p d/dir -$ cd d +$ mkdir dir + $ echo 1 > dir/foo.orig $ echo 2 > dir/foo $ diff -u dir/foo.orig dir/foo > foo.diff @@ -48,5 +47,3 @@ $ ls -l patches series | sed -e 's:.* -> ::' $ quilt push -qa > Applying patch patches/foo.diff > Now at patch patches/foo.diff -$ cd .. -$ rm -rf d diff --git a/test/snapshot.test b/test/snapshot.test index 1d73a93..d13bff1 100644 --- a/test/snapshot.test +++ b/test/snapshot.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new snapshot > Patch %{P}snapshot is now on top @@ -35,19 +33,16 @@ > Refreshed patch %{P}snapshot-2 $ quilt diff --snapshot | grep -v "^\\(---\\|+++\\)" - > Index: d/f.txt + >~ Index: [^/]+/f\.txt > =================================================================== > @@ -1 +1,2 @@ > f.txt > +more changes - > Index: d/g.txt + >~ Index: [^/]+/g\.txt > =================================================================== > @@ -1 +0,0 @@ > -g.txt - > Index: d/h.txt + >~ Index: [^/]+/h\.txt > =================================================================== > @@ -0,0 +1 @@ > +h.txt - - $ cd .. - $ rm -rf d diff --git a/test/snapshot2.test b/test/snapshot2.test index b55ed7d..3a33109 100644 --- a/test/snapshot2.test +++ b/test/snapshot2.test @@ -1,6 +1,5 @@ - $ rm -rf d - $ mkdir -p d/patches d/d - $ cd d + $ mkdir patches d + $ quilt new snapshot > Patch %{P}snapshot is now on top @@ -35,19 +34,16 @@ > Refreshed patch %{_P}snapshot-2 $ quilt diff --snapshot | grep -v "^\\(---\\|+++\\)" - > Index: d/d/f.txt + >~ Index: [^/]+/d/f\.txt > =================================================================== > @@ -1 +1,2 @@ > f.txt > +more changes - > Index: d/d/g.txt + >~ Index: [^/]+/d/g\.txt > =================================================================== > @@ -1 +0,0 @@ > -g.txt - > Index: d/d/h.txt + >~ Index: [^/]+/d/h\.txt > =================================================================== > @@ -0,0 +1 @@ > +h.txt - - $ cd ../.. - $ rm -rf d diff --git a/test/sort.test b/test/sort.test index 4a59aec..c3a66c4 100644 --- a/test/sort.test +++ b/test/sort.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ quilt new sort.diff > Patch patches/sort.diff is now on top @@ -27,9 +25,9 @@ > f $ quilt diff | grep '^Index' - > Index: d/b - > Index: d/f - > Index: d/c + >~ Index: [^/]+/b + >~ Index: [^/]+/f + >~ Index: [^/]+/c $ quilt add z x > File z added to patch patches/sort.diff @@ -45,11 +43,11 @@ > z $ quilt diff | grep '^Index' - > Index: d/b - > Index: d/f - > Index: d/c - > Index: d/x - > Index: d/z + >~ Index: [^/]+/b + >~ Index: [^/]+/f + >~ Index: [^/]+/c + >~ Index: [^/]+/x + >~ Index: [^/]+/z $ quilt add a > File a added to patch patches/sort.diff @@ -64,42 +62,39 @@ > z $ quilt diff | grep '^Index' - > Index: d/b - > Index: d/f - > Index: d/c - > Index: d/a - > Index: d/x - > Index: d/z + >~ Index: [^/]+/b + >~ Index: [^/]+/f + >~ Index: [^/]+/c + >~ Index: [^/]+/a + >~ Index: [^/]+/x + >~ Index: [^/]+/z $ quilt refresh > Refreshed patch patches/sort.diff $ grep '^Index' patches/sort.diff - > Index: d/b - > Index: d/f - > Index: d/c - > Index: d/a - > Index: d/x - > Index: d/z + >~ Index: [^/]+/b + >~ Index: [^/]+/f + >~ Index: [^/]+/c + >~ Index: [^/]+/a + >~ Index: [^/]+/x + >~ Index: [^/]+/z $ quilt diff --sort | grep '^Index' - > Index: d/a - > Index: d/b - > Index: d/c - > Index: d/f - > Index: d/x - > Index: d/z + >~ Index: [^/]+/a + >~ Index: [^/]+/b + >~ Index: [^/]+/c + >~ Index: [^/]+/f + >~ Index: [^/]+/x + >~ Index: [^/]+/z $ quilt refresh --sort > Refreshed patch patches/sort.diff $ grep '^Index' patches/sort.diff - > Index: d/a - > Index: d/b - > Index: d/c - > Index: d/f - > Index: d/x - > Index: d/z - - $ cd .. - $ rm -rf d + >~ Index: [^/]+/a + >~ Index: [^/]+/b + >~ Index: [^/]+/c + >~ Index: [^/]+/f + >~ Index: [^/]+/x + >~ Index: [^/]+/z diff --git a/test/space-in-filenames.test b/test/space-in-filenames.test index bbefe23..335877a 100644 --- a/test/space-in-filenames.test +++ b/test/space-in-filenames.test @@ -1,6 +1,5 @@ -$ rm -rf d -$ mkdir -p d/patches -$ cd d +$ mkdir patches + $ quilt new test.diff >Patch patches/test.diff is now on top @@ -38,6 +37,3 @@ $quilt remove "foo bar" $ quilt files > foo - -$ cd .. -$ rm -rf d diff --git a/test/subdir.test b/test/subdir.test index fa60b9c..7310616 100644 --- a/test/subdir.test +++ b/test/subdir.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ mkdir subdir $ cat > subdir/file @@ -39,29 +37,26 @@ > + subdir/file2 > - subdir/file3 - $ quilt diff - > Index: d/subdir/file + $ quilt diff -p ab + > Index: b/subdir/file > =================================================================== - > --- d.orig/subdir/file - > +++ d/subdir/file + > --- a/subdir/file + > +++ b/subdir/file > @@ -1 +1 @@ > -old file > +new contents - > Index: d/subdir/file2 + > Index: b/subdir/file2 > =================================================================== > --- /dev/null - > +++ d/subdir/file2 + > +++ b/subdir/file2 > @@ -0,0 +1 @@ > +another file - > Index: d/subdir/file3 + > Index: b/subdir/file3 > =================================================================== - > --- d.orig/subdir/file3 + > --- a/subdir/file3 > +++ /dev/null > @@ -1 +0,0 @@ > -yet another file $ quilt refresh > Refreshed patch %{_P}test.patch - - $ cd ../.. - $ rm -rf d diff --git a/test/three.test b/test/three.test index ca90e07..d35a402 100644 --- a/test/three.test +++ b/test/three.test @@ -1,7 +1,4 @@ - - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ touch e $ quilt annotate e @@ -137,17 +134,17 @@ $ quilt push > File series fully applied, ends at patch patches/patch2.diff - $ quilt diff --combine patch1 -P patch2 - > Index: d/f + $ quilt diff --combine patch1 -P patch2 -p ab + > Index: b/f > =================================================================== > --- /dev/null - > +++ d/f + > +++ b/f > @@ -0,0 +1 @@ > +f - > Index: d/g + > Index: b/g > =================================================================== > --- /dev/null - > +++ d/g + > +++ b/g > @@ -0,0 +1 @@ > +g @@ -168,6 +165,3 @@ $ quilt pop patch4.diff > Patch patch4.diff is not in series - - $ cd .. - $ rm -rf d diff --git a/test/trailing-ws.test b/test/trailing-ws.test index 45d1c36..7043872 100644 --- a/test/trailing-ws.test +++ b/test/trailing-ws.test @@ -1,6 +1,4 @@ - $ rm -rf d - $ mkdir -p d/patches - $ cd d + $ mkdir patches $ cat > a < a @@ -77,6 +75,3 @@ $ quilt pop -q > Removing patch patches/test2.diff > No patches applied - - $ cd .. - $ rm -rf d diff --git a/test/two.test b/test/two.test index 5770724..10588a1 100644 --- a/test/two.test +++ b/test/two.test @@ -1,8 +1,7 @@ (To run, type `./run two.test' in this directory.) - $ rm -rf d - $ mkdir -p d/patches d/d - $ cd d + $ mkdir patches d + $ quilt new patch1.diff > Patch %{P}patch1.diff is now on top @@ -21,19 +20,19 @@ > Nothing in patch %{_P}patch1.diff $ echo "This is file two." > file2 - $ quilt diff - > Index: d/d/file2 + $ quilt diff -p ab + > Index: b/d/file2 > =================================================================== > --- /dev/null - > +++ d/d/file2 + > +++ b/d/file2 > @@ -0,0 +1 @@ > +This is file two. - $ quilt diff -z - > Index: d/d/file2 + $ quilt diff -z -p ab + > Index: b/d/file2 > =================================================================== > --- /dev/null - > +++ d/d/file2 + > +++ b/d/file2 > @@ -0,0 +1 @@ > +This is file two. @@ -42,21 +41,21 @@ $ quilt diff -z $ echo "Another line has been added." >> dir/file1 - $ quilt diff -z - > Index: d/d/dir/file1 + $ quilt diff -z -p ab + > Index: b/d/dir/file1 > =================================================================== - > --- d.orig/d/dir/file1 - > +++ d/d/dir/file1 + > --- a/d/dir/file1 + > +++ b/d/dir/file1 > @@ -1 +1,2 @@ > This is file one. > +Another line has been added. $ cd dir - $ quilt diff -z file1 - > Index: d/d/dir/file1 + $ quilt diff -z file1 -p ab + > Index: b/d/dir/file1 > =================================================================== - > --- d.orig/d/dir/file1 - > +++ d/d/dir/file1 + > --- a/d/dir/file1 + > +++ b/d/dir/file1 > @@ -1 +1,2 @@ > This is file one. > +Another line has been added. @@ -109,10 +108,10 @@ > File d/file4 added to patch %{_P}subdir/patch3.diff $ rm -f file4 - $ quilt diff - > Index: d/d/file4 + $ quilt diff -p ab + > Index: b/d/file4 > =================================================================== - > --- d.orig/d/file4 + > --- a/d/file4 > +++ /dev/null > @@ -1 +0,0 @@ > -This is file 4. @@ -128,11 +127,11 @@ > Refreshed patch %{_P}patch2.diff $ echo "Another line added." >> file2 - $ quilt diff -z -P patch1 - > Index: d/d/file2 + $ quilt diff -z -P patch1 -p ab + > Index: b/d/file2 > =================================================================== - > --- d.orig/d/file2 - > +++ d/d/file2 + > --- a/d/file2 + > +++ b/d/file2 > @@ -1 +1,2 @@ > This is file two. > +Another line added. @@ -158,6 +157,3 @@ > Removing patch %{_P}patch2.diff > Removing patch %{_P}patch1.diff > No patches applied - - $ cd ../.. - $ rm -rf d |