Skip to content

Commit 4b16573

Browse files
committed
Merge branch 'jk/sanity'
The description for SANITY prerequisite the test suite uses has been clarified both in the comment and in the implementation. * jk/sanity: test-lib: clarify and tighten SANITY
2 parents a2ec948 + 719c3da commit 4b16573

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

t/test-lib.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,20 +1054,28 @@ test_lazy_prereq NOT_ROOT '
10541054
test "$uid" != 0
10551055
'
10561056

1057-
# On a filesystem that lacks SANITY, a file can be deleted even if
1058-
# the containing directory doesn't have write permissions, or a file
1059-
# can be accessed even if the containing directory doesn't have read
1060-
# or execute permissions, causing our tests that validate that Git
1061-
# works sensibly in such situations.
1057+
# SANITY is about "can you correctly predict what the filesystem would
1058+
# do by only looking at the permission bits of the files and
1059+
# directories?" A typical example of !SANITY is running the test
1060+
# suite as root, where a test may expect "chmod -r file && cat file"
1061+
# to fail because file is supposed to be unreadable after a successful
1062+
# chmod. In an environment (i.e. combination of what filesystem is
1063+
# being used and who is running the tests) that lacks SANITY, you may
1064+
# be able to delete or create a file when the containing directory
1065+
# doesn't have write permissions, or access a file even if the
1066+
# containing directory doesn't have read or execute permissions.
1067+
10621068
test_lazy_prereq SANITY '
10631069
mkdir SANETESTD.1 SANETESTD.2 &&
10641070
10651071
chmod +w SANETESTD.1 SANETESTD.2 &&
10661072
>SANETESTD.1/x 2>SANETESTD.2/x &&
10671073
chmod -w SANETESTD.1 &&
1074+
chmod -r SANETESTD.1/x &&
10681075
chmod -rx SANETESTD.2 ||
10691076
error "bug in test sript: cannot prepare SANETESTD"
10701077
1078+
! test -r SANETESTD.1/x &&
10711079
! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
10721080
status=$?
10731081

0 commit comments

Comments
 (0)