From b5608285e9f430d51498e70bf37c1bf8520fb1c0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 14 Mar 2019 16:46:50 +0100 Subject: test: Don't hard-code .pc 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 --- 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(-) diff --git a/Makefile.in b/Makefile.in index 21ad6c1..40d316f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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)),) diff --git a/test/add-filename-check.test b/test/add-filename-check.test index d61225b..5228fc8 100644 --- a/test/add-filename-check.test +++ b/test/add-filename-check.test @@ -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}/ diff --git a/test/delete.test b/test/delete.test index e9a3a1c..24c82b5 100644 --- a/test/delete.test +++ b/test/delete.test @@ -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 diff --git a/test/import.test b/test/import.test index dd4247a..e9cc85b 100644 --- a/test/import.test +++ b/test/import.test @@ -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) diff --git a/test/import2.test b/test/import2.test index dc8aa96..72c38d0 100644 --- a/test/import2.test +++ b/test/import2.test @@ -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) diff --git a/test/nolink.test b/test/nolink.test index 47b8d51..e805297 100644 --- a/test/nolink.test +++ b/test/nolink.test @@ -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 diff --git a/test/patch-wrapper.test b/test/patch-wrapper.test index 69b41d1..8bc8183 100644 --- a/test/patch-wrapper.test +++ b/test/patch-wrapper.test @@ -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.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}} $ 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}} diff --git a/test/project-settings.test b/test/project-settings.test index 0f6ba3f..c012253 100644 --- a/test/project-settings.test +++ b/test/project-settings.test @@ -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 diff --git a/test/remember-locations.test b/test/remember-locations.test index 4e30c27..1e39ac7 100644 --- a/test/remember-locations.test +++ b/test/remember-locations.test @@ -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 -- cgit