From: Junio C Hamano Date: Wed, 17 Feb 2016 18:03:41 +0000 (-0800) Subject: Merge branch 'js/test-lib-windows-emulated-yes' into maint X-Git-Tag: v2.7.2~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7516977b4adc38937d95d8c7da8944153784bf9a?hp=-c Merge branch 'js/test-lib-windows-emulated-yes' into maint The emulated "yes" command used in our test scripts has been tweaked not to spend too much time generating unnecessary output that is not used, to help those who test on Windows where it would not stop until it fills the pipe buffer due to lack of SIGPIPE. * js/test-lib-windows-emulated-yes: test-lib: limit the output of the yes utility --- 7516977b4adc38937d95d8c7da8944153784bf9a diff --combined t/test-lib.sh index bd4b02e9db,dfa29255d5..51e4a88c33 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -907,9 -907,11 +907,11 @@@ yes () y="$*" fi - while echo "$y" + i=0 + while test $i -lt 99 do - : + echo "$y" + i=$(($i+1)) done } @@@ -1054,28 -1056,20 +1056,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=$?