aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2020-04-23 15:41:06 -0600
committerJunio C Hamano <gitster@pobox.com>2020-04-23 14:58:52 -0700
commitb30fdb4b4e6608ccafdfa4a13893940b85a8a7e8 (patch)
tree1c10149c98eb7fa738a14e44d21793681feb5aa6 /t/test-lib.sh
parenta2d57e22803b1da0df95b0a88a34116209eeb6e6 (diff)
downloadgit-b30fdb4b4e6608ccafdfa4a13893940b85a8a7e8.tar.gz
t/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to tests
In t1400 the prerequisite 'ULIMIT_FILE_DESCRIPTORS' is defined and used to effectively guard the helper function 'run_with_limited_open_files' from being used on systems that do not satisfy this prerequisite. In the subsequent patch, we will introduce another test outside of t1400 that would benefit from using this prerequisite. So, move it to 'test-lib.sh' instead so that it can be used by multiple tests. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 44df51be8f..cb0f93eb58 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1618,6 +1618,15 @@ test_lazy_prereq ULIMIT_STACK_SIZE '
run_with_limited_stack true
'
+run_with_limited_open_files () {
+ (ulimit -n 32 && "$@")
+}
+
+test_lazy_prereq ULIMIT_FILE_DESCRIPTORS '
+ test_have_prereq !MINGW,!CYGWIN &&
+ run_with_limited_open_files true
+'
+
build_option () {
git version --build-options |
sed -ne "s/^$1: //p"