]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-lib: don't use ulimit in test prerequisites on cygwin
authorRamsay Jones <ramsay@ramsayjones.plus.com>
Thu, 14 Sep 2017 17:24:41 +0000 (18:24 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Sep 2017 02:52:00 +0000 (11:52 +0900)
On cygwin (and MinGW), the 'ulimit' built-in bash command does not have
the desired effect of limiting the resources of new processes, at least
for the stack and file descriptors. However, it always returns success
and leads to several test prerequisites being erroneously set to true.

Add a check for cygwin and MinGW to the prerequisite expressions, using
a 'test_have_prereq !MINGW,!CYGWIN' clause, to guard against using ulimit.
This affects the prerequisite expressions for the ULIMIT_STACK_SIZE,
CMDLINE_LIMIT and ULIMIT_FILE_DESCRIPTORS prerequisites.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1400-update-ref.sh
t/t6120-describe.sh
t/t7004-tag.sh
t/test-lib.sh

index dc98b4bc6dc7aab41eca38d9e1086ad2b6701fd3..664a3a4e4e9b81d3e017c22414b0bbe2ef25b83a 100755 (executable)
@@ -1253,7 +1253,10 @@ run_with_limited_open_files () {
        (ulimit -n 32 && "$@")
 }
 
-test_lazy_prereq ULIMIT_FILE_DESCRIPTORS 'run_with_limited_open_files true'
+test_lazy_prereq ULIMIT_FILE_DESCRIPTORS '
+       test_have_prereq !MINGW,!CYGWIN &&
+       run_with_limited_open_files true
+'
 
 test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches does not burst open file limit' '
 (
index dd6dd9df9b52647381fb4bb6ff2a1cdc1ade7469..3d45dc2955015f4148dee1d7a8f15d1e8fd7d2fa 100755 (executable)
@@ -279,7 +279,6 @@ test_expect_success 'describe ignoring a borken submodule' '
        grep broken out
 '
 
-# we require ulimit, this excludes Windows
 test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' '
        i=1 &&
        while test $i -lt 8000
index 5bf5ace56bfde11e9b080db09e45db8df26a539f..b545c33f83be94608f18182444ffe37eef753e88 100755 (executable)
@@ -1863,7 +1863,6 @@ test_expect_success 'version sort with very long prerelease suffix' '
        git tag -l --sort=version:refname
 '
 
-# we require ulimit, this excludes Windows
 test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
        >expect &&
        i=1 &&
index f22c1b260aa10e521930eb6f786f294a8aca3a74..8a91fb10a9906ad0d4b09cff69f7dca7674425e1 100644 (file)
@@ -1165,13 +1165,19 @@ run_with_limited_cmdline () {
        (ulimit -s 128 && "$@")
 }
 
-test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
+test_lazy_prereq CMDLINE_LIMIT '
+       test_have_prereq !MINGW,!CYGWIN &&
+       run_with_limited_cmdline true
+'
 
 run_with_limited_stack () {
        (ulimit -s 128 && "$@")
 }
 
-test_lazy_prereq ULIMIT_STACK_SIZE 'run_with_limited_stack true'
+test_lazy_prereq ULIMIT_STACK_SIZE '
+       test_have_prereq !MINGW,!CYGWIN &&
+       run_with_limited_stack true
+'
 
 build_option () {
        git version --build-options |