diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-01-28 16:10:13 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-28 16:10:13 -0800 |
commit | 4b16573ce99c46e8c5b4950c44b70f1584b8dca9 (patch) | |
tree | 61179e1f3dcec7d7718207f0178fafd52eaffae9 /t/test-lib.sh | |
parent | a2ec9484c1517305e2e28d64d8d77642f05e9a02 (diff) | |
parent | 719c3da2f183cfc751bb801a2c903f2eb015d131 (diff) | |
download | git-4b16573ce99c46e8c5b4950c44b70f1584b8dca9.tar.gz |
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
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index 16c4d7b516..bd4b02e9db 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1054,20 +1054,28 @@ test_lazy_prereq NOT_ROOT ' test "$uid" != 0 ' -# On a filesystem that lacks SANITY, a file can be deleted even if -# the containing directory doesn't have write permissions, or a file -# can be accessed even if the containing directory doesn't have read -# or execute permissions, causing our tests that validate that Git -# works sensibly in such situations. +# SANITY is about "can you correctly predict what the filesystem would +# do by only looking at the permission bits of the files and +# directories?" A typical example of !SANITY is running the test +# suite as root, where a test may expect "chmod -r file && cat file" +# to fail because file is supposed to be unreadable after a successful +# chmod. In an environment (i.e. combination of what filesystem is +# being used and who is running the tests) that lacks SANITY, you may +# be able to delete or create a file when the containing directory +# doesn't have write permissions, or access a file even if the +# containing directory doesn't have read or execute permissions. + test_lazy_prereq SANITY ' mkdir SANETESTD.1 SANETESTD.2 && chmod +w SANETESTD.1 SANETESTD.2 && >SANETESTD.1/x 2>SANETESTD.2/x && chmod -w SANETESTD.1 && + chmod -r SANETESTD.1/x && chmod -rx SANETESTD.2 || error "bug in test sript: cannot prepare SANETESTD" + ! test -r SANETESTD.1/x && ! rm SANETESTD.1/x && ! test -f SANETESTD.2/x status=$? |