Skip to content

Commit 21dac1d

Browse files
ramsay-jonesgitster
authored andcommitted
test-lib: don't use ulimit in test prerequisites on cygwin
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 <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 31625b3 commit 21dac1d

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

t/t1400-update-ref.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,10 @@ run_with_limited_open_files () {
12531253
(ulimit -n 32 && "$@")
12541254
}
12551255

1256-
test_lazy_prereq ULIMIT_FILE_DESCRIPTORS 'run_with_limited_open_files true'
1256+
test_lazy_prereq ULIMIT_FILE_DESCRIPTORS '
1257+
test_have_prereq !MINGW,!CYGWIN &&
1258+
run_with_limited_open_files true
1259+
'
12571260

12581261
test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches does not burst open file limit' '
12591262
(

t/t6120-describe.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ test_expect_success 'describe ignoring a borken submodule' '
279279
grep broken out
280280
'
281281

282-
# we require ulimit, this excludes Windows
283282
test_expect_failure ULIMIT_STACK_SIZE 'name-rev works in a deep repo' '
284283
i=1 &&
285284
while test $i -lt 8000

t/t7004-tag.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,6 @@ test_expect_success 'version sort with very long prerelease suffix' '
18631863
git tag -l --sort=version:refname
18641864
'
18651865

1866-
# we require ulimit, this excludes Windows
18671866
test_expect_success ULIMIT_STACK_SIZE '--contains and --no-contains work in a deep repo' '
18681867
>expect &&
18691868
i=1 &&

t/test-lib.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,13 +1165,19 @@ run_with_limited_cmdline () {
11651165
(ulimit -s 128 && "$@")
11661166
}
11671167

1168-
test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
1168+
test_lazy_prereq CMDLINE_LIMIT '
1169+
test_have_prereq !MINGW,!CYGWIN &&
1170+
run_with_limited_cmdline true
1171+
'
11691172

11701173
run_with_limited_stack () {
11711174
(ulimit -s 128 && "$@")
11721175
}
11731176

1174-
test_lazy_prereq ULIMIT_STACK_SIZE 'run_with_limited_stack true'
1177+
test_lazy_prereq ULIMIT_STACK_SIZE '
1178+
test_have_prereq !MINGW,!CYGWIN &&
1179+
run_with_limited_stack true
1180+
'
11751181

11761182
build_option () {
11771183
git version --build-options |

0 commit comments

Comments
 (0)