[PATCH v2 1/2] test-lib.sh: add limited processes to test-lib
- From
Han Xin <hanxin.hx@bytedance.com>
- Date
- Jun 24, 2022, 05:27 UTC
- Message-ID
- <442a4c351dea603e226bae89eddc2b3496d93262.1656044659.git.hanxin.hx@bytedance.com>
- In-Reply-To
- <cover.1656044659.git.hanxin.hx@bytedance.com>
We will use the lazy prerequisite ULIMIT_PROCESSES in a follow-up commit.
With run_with_limited_processses() we can limit forking subprocesses and fail reliably in some test cases.
Signed-off-by: Han Xin <hanxin.hx@bytedance.com> --- t/test-lib.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/t/test-lib.sh b/t/test-lib.sh index 8ba5ca1534..f920e3b0ae 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1816,6 +1816,15 @@ test_lazy_prereq ULIMIT_FILE_DESCRIPTORS ' run_with_limited_open_files true ' +run_with_limited_processses () { + (ulimit -u 512 && "$@") +} + +test_lazy_prereq ULIMIT_PROCESSES ' + test_have_prereq !HPPA,!MINGW,!CYGWIN && + run_with_limited_processses true +' + build_option () { git version --build-options | sed -ne "s/^$1: //p"
-- 2.36.1