git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] t/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to tests

From
Taylor Blau <me@ttaylorr.com>
Date
Apr 23, 2020, 21:41 UTC
Message-ID
<b374ff0490a9de2708943f41921e55e6a36d72e1.1587677671.git.me@ttaylorr.com>
In-Reply-To
<cover.1587677671.git.me@ttaylorr.com>

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>
---
 t/t1400-update-ref.sh | 9 ---------
 t/test-lib.sh         | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index a6224ef65f..1e7428a379 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -1354,15 +1354,6 @@ test_expect_success 'fails with duplicate ref update via symref' '
 	test_cmp expect actual
 '
 
-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
-'
-
 test_expect_success ULIMIT_FILE_DESCRIPTORS 'large transaction creating branches does not burst open file limit' '
 (
 	for i in $(test_seq 33)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9fe390bd5a..03bf2a4b93 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"
-- 
2.26.0.113.ge9739cdccc
Previous: Taylor BlauNext: Taylor Blau
Message 3 of 14 in “commit-graph: handle file descriptor exhaustion”
  1. 0/4 commit-graph: handle file descriptor exhaustionTaylor Blau, Apr 23, 2020
  2. 1/4 commit-graph.c: don't use discarded graph_name in errorTaylor Blau, Apr 23, 2020
  3. 2/4 t/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to testsTaylor Blau, Apr 23, 2020
  4. 4/4 commit-graph: close descriptors after mmapTaylor Blau, Apr 23, 2020
  5. Junio C HamanoApr 23, 2020
  6. Jeff KingApr 24, 2020
  7. Derrick StoleeApr 24, 2020
  8. Taylor BlauApr 24, 2020
  9. Junio C HamanoApr 24, 2020
  10. Derrick StoleeApr 27, 2020
  11. 3/4 commit-graph.c: gracefully handle file descriptor exhaustionTaylor Blau, Apr 23, 2020
  12. t5324-split-commit-graph.sh flaky due to assumptions about ulimit behaviorÆvar Arnfjörð Bjarmason, Jun 24, 2021
  13. Jeff KingJun 24, 2021
  14. Taylor BlauApr 23, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.