summaryrefslogtreecommitdiff
path: root/t/t1509-root-worktree.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-03-05 13:12:52 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-03-05 13:12:52 -0800
commit8fd37b3862f6a567db3830bf0b50def231a76c41 (patch)
tree68e4944e0c8d3fac8c6cc928d630e27de601fdab /t/t1509-root-worktree.sh
parentGit 2.3.1 (diff)
parenttest-lib.sh: set prerequisite SANITY by testing what we really need (diff)
downloadtgif-8fd37b3862f6a567db3830bf0b50def231a76c41.tar.xz
Merge branch 'jk/sanity' into maint
The tests that wanted to see that file becomes unreadable after running "chmod a-r file", and the tests that wanted to make sure it is not run as root, we used "can we write into the / directory?" as a cheap substitute, but on some platforms that is not a good heuristics. The tests and their prerequisites have been updated to check what they really require. * jk/sanity: test-lib.sh: set prerequisite SANITY by testing what we really need tests: correct misuses of POSIXPERM t/lib-httpd: switch SANITY check for NOT_ROOT
Diffstat (limited to 't/t1509-root-worktree.sh')
-rwxr-xr-xt/t1509-root-worktree.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh
index 335420fd87..b6977d4b39 100755
--- a/t/t1509-root-worktree.sh
+++ b/t/t1509-root-worktree.sh
@@ -98,8 +98,16 @@ test_foobar_foobar() {
'
}
-if ! test_have_prereq POSIXPERM || ! [ -w / ]; then
- skip_all="Dangerous test skipped. Read this test if you want to execute it"
+if ! test -w /
+then
+ skip_all="Test requiring writable / skipped. Read this test if you want to run it"
+ test_done
+fi
+
+if test -e /refs || test -e /objects || test -e /info || test -e /hooks ||
+ test -e /.git || test -e /foo || test -e /me
+then
+ skip_all="Skip test that clobbers existing files in /"
test_done
fi
@@ -108,8 +116,9 @@ if [ "$IKNOWWHATIAMDOING" != "YES" ]; then
test_done
fi
-if [ "$UID" = 0 ]; then
- skip_all="No you can't run this with root"
+if ! test_have_prereq NOT_ROOT
+then
+ skip_all="No you can't run this as root"
test_done
fi