@matheusbsbs / matheus-bagliano / commits / 2283645b85
Fork 0

t3600-rm: skip failed-remove test when we cannot make an unremovable file.

When running t3600-rm test under fakeroot (or as root), we cannot make a file unremovable with "chmod a-w .". Detect this case early and skip that test. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 13, 2006 at 11:57 UTC 2283645b85dc91ca958b05066511083255a8612a
1 file changed +15 -3
t/t3600-rm.sh
+15 -3
@@ -23,6 +23,16 @@ else
23 test_tabs=n
24 fi
25
26 +# Later we will try removing an unremovable path to make sure
27 +# git-rm barfs, but if the test is run as root that cannot be
28 +# arranged.
29 +: >test-file
30 +chmod a-w .
31 +rm -f test-file
32 +test -f test-file && test_failed_remove=y
33 +chmod 775 .
34 +rm -f test-file
35 +
36 test_expect_success \
37 'Pre-check that foo exists and is in index before git-rm foo' \
38 '[ -f foo ] && git-ls-files --error-unmatch foo'
@@ -56,12 +66,14 @@ test "$test_tabs" = y && test_expect_success \
66 "git-rm -f 'space embedded' 'tab embedded' 'newline
67 embedded'"
68
59 -if test "$test_tabs" = y; then
60 -chmod u-w .
69 +if test "$test_failed_remove" = y; then
70 +chmod a-w .
71 test_expect_failure \
72 'Test that "git-rm -f" fails if its rm fails' \
73 'git-rm -f baz'
64 -chmod u+w .
74 +chmod 775 .
75 +else
76 + test_expect_success 'skipping removal failure (perhaps running as root?)' :
77 fi
78
79 test_expect_success \