quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] test: Don't hard-code .pc


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] test: Don't hard-code .pc
Date: Wed, 13 Mar 2019 13:11:53 +0100

Use a variable (QUILT_PC) instead of hard-coding ".pc" as the name of
the directory where quilt stores the state of the working tree
throughout the test suite. We still set that variable to ".pc" to
make it easier to investigate failed test cases, but at least this
allows us to promptly test that QUILT_PC can actually be set to any
other value and quilt still works.

Signed-off-by: Jean Delvare <address@hidden>
---
 Makefile.in                  |    1 +
 test/add-filename-check.test |    4 ++--
 test/delete.test             |   18 +++++++++---------
 test/import.test             |   10 +++++-----
 test/import2.test            |    2 +-
 test/nolink.test             |    6 +++---
 test/patch-wrapper.test      |   14 +++++++-------
 test/project-settings.test   |    8 ++++----
 test/remember-locations.test |    6 +++---
 9 files changed, 35 insertions(+), 34 deletions(-)

--- quilt.orig/Makefile.in      2017-05-09 17:02:08.875519939 +0200
+++ quilt/Makefile.in   2019-03-13 12:56:50.019219927 +0100
@@ -400,6 +400,7 @@ test/.depend : Makefile $(TESTS)
 ifneq ($(shell . $(QUILTRC) ;  echo $$QUILT_PATCHES_PREFIX),)
 CHECK_ENV := P=patches/; _P=../patches/; export P _P;
 endif
+CHECK_ENV += QUILT_PC=.pc; export QUILT_PC;
 
 # Each tests dependencies are stored in test/.depend
 ifneq ($(findstring check-,$(MAKECMDGOALS)),)
--- quilt.orig/test/add-filename-check.test     2017-05-09 16:54:48.098357009 
+0200
+++ quilt/test/add-filename-check.test  2019-03-13 12:47:56.069708474 +0100
@@ -10,5 +10,5 @@ $ quilt add foo
 $ quilt add patches/bar
 > File patches/bar is located below patches/
 
-$ quilt add .pc/baz
-> File .pc/baz is located below .pc/
+$ quilt add %{QUILT_PC}/baz
+> File %{QUILT_PC}/baz is located below %{QUILT_PC}/
--- quilt.orig/test/delete.test 2017-05-09 17:02:08.875519939 +0200
+++ quilt/test/delete.test      2019-03-13 12:54:16.142359487 +0100
@@ -70,10 +70,10 @@ Test the delete command.
 
        # Force the pop operaton to fail
        $ echo "test3" > patches/series
-       $ echo "test3" > .pc/applied-patches
-       $ mkdir -p .pc/test3/dir
-       $ touch .pc/test3/dir/file
-       $ chmod a-rx .pc/test3/dir
+       $ echo "test3" > %{QUILT_PC}/applied-patches
+       $ mkdir -p %{QUILT_PC}/test3/dir
+       $ touch %{QUILT_PC}/test3/dir/file
+       $ chmod a-rx %{QUILT_PC}/test3/dir
 
        # Note that this will succeed (instead of the expected failure) if
        # running as root, but you shouldn't do that anyway.
@@ -81,12 +81,12 @@ Test the delete command.
        > Removing patch %{P}test3
        >~ .*find: [`']?\./dir'?: Permission denied
 
-       $ chmod a+rx .pc/test3/dir
+       $ chmod a+rx %{QUILT_PC}/test3/dir
 
-       $ find .pc/test3
-       > .pc/test3
-       > .pc/test3/dir
-       > .pc/test3/dir/file
+       $ find %{QUILT_PC}/test3
+       > %{QUILT_PC}/test3
+       > %{QUILT_PC}/test3/dir
+       > %{QUILT_PC}/test3/dir/file
 
        $ quilt applied
        > No patches applied
--- quilt.orig/test/import.test 2017-05-09 17:02:08.875519939 +0200
+++ quilt/test/import.test      2019-03-13 12:54:17.873380662 +0100
@@ -43,7 +43,7 @@
        $ mv patches/patchRp0.diff t/patchRp0.diff
 
        # test importing into an empty series
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import t/patch1.diff
        > Importing patch t/patch1.diff (stored as %{P}patch1.diff)
@@ -157,7 +157,7 @@
        > Patch patch1.diff is not in series
 
        # test importing a reverse patch
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import -R t/patchR.diff
        > Importing patch t/patchR.diff (stored as %{P}patchR.diff)
@@ -194,7 +194,7 @@
        > No patches applied
 
        # test importing a reverse patch with strip level
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import -R -p0 t/patchRp0.diff
        > Importing patch t/patchRp0.diff (stored as %{P}patchRp0.diff)
@@ -226,7 +226,7 @@
        > No patches applied
 
        # Test importing multiple patches at once
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import t/patch1.diff t/patchR.diff
        > Importing patch t/patch1.diff (stored as %{P}patch1.diff)
@@ -236,7 +236,7 @@
        > patch1.diff
        > patchR.diff
 
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import t/patchR.diff
        > Importing patch t/patchR.diff (stored as %{P}patchR.diff)
--- quilt.orig/test/import2.test        2017-05-09 17:02:08.875519939 +0200
+++ quilt/test/import2.test     2019-03-13 12:54:19.471400209 +0100
@@ -24,7 +24,7 @@
        $ rm -f patches/patch1.diff
 
        # test importing into an empty series
-       $ rm -rf patches/ .pc/
+       $ rm -rf patches/ %{QUILT_PC}/
        $ mkdir patches
        $ quilt import t/patch1.diff.gz
        > Importing patch t/patch1.diff.gz (stored as %{P}patch1.diff.gz)
--- quilt.orig/test/nolink.test 2017-05-09 16:54:48.102357056 +0200
+++ quilt/test/nolink.test      2019-03-13 12:54:21.239421836 +0100
@@ -15,7 +15,7 @@
        $ ls -l foo | awk '{ print $2 }'
        > 1
 
-       $ ls -l .pc/test.diff/foo | awk '{ print $2 }'
+       $ ls -l %{QUILT_PC}/test.diff/foo | awk '{ print $2 }'
        > 2
 
        $ echo "foo changed" > foo
@@ -31,7 +31,7 @@
        $ ls -l foo | awk '{ print $2 }'
        > 1
 
-       $ ls -l .pc/test2.diff/foo | awk '{ print $2 }'
+       $ ls -l %{QUILT_PC}/test2.diff/foo | awk '{ print $2 }'
        > 1
 
        $ echo "foo changed again" > foo
@@ -45,7 +45,7 @@
        $ ls -l foo | awk '{ print $2 }'
        > 1
 
-       $ ls -l .pc/test.diff/foo | awk '{ print $2 }'
+       $ ls -l %{QUILT_PC}/test.diff/foo | awk '{ print $2 }'
        > 2
 
        $ quilt pop -q
--- quilt.orig/test/patch-wrapper.test  2017-05-09 16:54:48.103357068 +0200
+++ quilt/test/patch-wrapper.test       2019-03-13 12:54:22.876441861 +0100
@@ -15,7 +15,7 @@ $ patch-wrapper -s -p0 < foo.diff
 $ quilt pop -q
 > Removing patch %{P}foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ mkdir ${QUILT_PATCHES:-patches}
 $ patch-wrapper --backup -B xxx/ -s -p0 < foo.diff
@@ -24,14 +24,14 @@ $ find xxx -type f
 $ quilt pop -q
 > Removing patch %{P}foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ mkdir ${QUILT_PATCHES:-patches}
 $ patch-wrapper -s -p0 -i foo.diff
 $ quilt pop -q
 > Removing patch %{P}foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ mkdir ${QUILT_PATCHES:-patches}
 $ patch-wrapper -p0 < foo.diff
@@ -39,7 +39,7 @@ $ patch-wrapper -p0 < foo.diff
 $ quilt pop -q
 > Removing patch %{P}foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ mv foo.diff somewhere/
 $ mkdir ${QUILT_PATCHES:-patches}
@@ -48,7 +48,7 @@ $ patch-wrapper -p0 < somewhere/foo.diff
 $ quilt pop -q
 > Removing patch %{P}somewhere/foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ mkdir ${QUILT_PATCHES:-patches}
 $ patch-wrapper -p0 -i somewhere/foo.diff
@@ -56,7 +56,7 @@ $ patch-wrapper -p0 -i somewhere/foo.dif
 $ quilt pop -q
 > Removing patch %{P}somewhere/foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
 
 $ sed -e 's/5/5b/' foo > foo.new
 $ mv foo.new foo
@@ -73,4 +73,4 @@ $ cat foo.orig
 $ quilt pop -q
 > Removing patch %{P}somewhere/foo.diff
 > No patches applied
-$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-.pc}
+$ rm -rf ${QUILT_PATCHES:-patches} ${QUILT_PC:-%{QUILT_PC}}
--- quilt.orig/test/project-settings.test       2017-05-09 16:54:53.853424408 
+0200
+++ quilt/test/project-settings.test    2019-03-13 12:54:24.642463463 +0100
@@ -3,10 +3,10 @@ $ export QUILT_PATCHES=my_patches
 $ export QUILT_SERIES=my_series
 
 $ mkdir quilt_patches
-$ mkdir .pc
-$ echo 2 > .pc/.version
-$ echo quilt_patches > .pc/.quilt_patches
-$ echo quilt_series > .pc/.quilt_series
+$ mkdir %{QUILT_PC}
+$ echo 2 > %{QUILT_PC}/.version
+$ echo quilt_patches > %{QUILT_PC}/.quilt_patches
+$ echo quilt_series > %{QUILT_PC}/.quilt_series
 $ echo create.patch > quilt_patches/quilt_series
 
 $ cat > quilt_patches/create.patch
--- quilt.orig/test/remember-locations.test     2017-05-09 16:54:53.853424408 
+0200
+++ quilt/test/remember-locations.test  2019-03-13 12:54:26.372484625 +0100
@@ -6,9 +6,9 @@
        >~ Patch (my/changes/)?mychange1 is now on top
        $ unset QUILT_PATCHES
        $ unset QUILT_SERIES
-       $ cat .pc/.quilt_patches
+       $ cat %{QUILT_PC}/.quilt_patches
        > my/changes
-       $ cat .pc/.quilt_series
+       $ cat %{QUILT_PC}/.quilt_series
        > patchlist
        $ cat my/changes/patchlist
        > mychange1
@@ -18,7 +18,7 @@
        $ quilt new mychange2
        >~ Patch (my/changes/)?mychange2 is now on top
        # Verify that the root directory can be identified even
-       # without QUILT_PATCHES with the .pc directory
+       # without QUILT_PATCHES with the QUILT_PC directory
        $ cd my
        $ quilt applied
        >~ (../my/changes/)?mychange1


-- 
Jean Delvare
SUSE L3 Support



reply via email to

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