summaryrefslogtreecommitdiffstats
path: root/t/t0070-fundamental.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-15 20:13:39 +0200
committerJunio C Hamano <gitster@pobox.com>2018-06-15 20:20:08 +0200
commit037714252f74ae77e816018e43b2504a1b057246 (patch)
treeb50cad99709711c60d673be889481447226930e3 /t/t0070-fundamental.sh
parentGit 2.17.1 (diff)
downloadgit-037714252f74ae77e816018e43b2504a1b057246.tar.xz
git-037714252f74ae77e816018e43b2504a1b057246.zip
tests: clean after SANITY tests
Some of our tests try to make sure Git behaves sensibly in a read-only directory, by dropping 'w' permission bit before doing a test and then restoring it after it is done. The latter is needed for the test framework to clean after itself without leaving a leftover directory that cannot be removed. Ancient parts of tests however arrange the above with chmod a-w . && ... do the test ... status=$? chmod 775 . (exit $status) which obviously would not work if the test somehow dies before it has the chance to do "chmod 775". Rewrite them by following a more robust pattern recently written tests use, which is test_when_finished "chmod 775 ." && chmod a-w . && ... do the test ... Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0070-fundamental.sh')
-rwxr-xr-xt/t0070-fundamental.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 991ed2a48d..60e3de7b7b 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -19,8 +19,8 @@ test_expect_success 'mktemp to nonexistent directory prints filename' '
test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' '
mkdir cannotwrite &&
- chmod -w cannotwrite &&
test_when_finished "chmod +w cannotwrite" &&
+ chmod -w cannotwrite &&
test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
grep "cannotwrite/test" err
'