llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-testing-tools Author: Aiden Grossman (boomanaiden154) <details> <summary>Changes</summary> This is used by a couple compiler-rt tests. --- Full diff: https://github.com/llvm/llvm-project/pull/165123.diff 3 Files Affected: - (modified) llvm/utils/lit/lit/TestRunner.py (+5-1) - (added) llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_unlimited.txt (+6) - (modified) llvm/utils/lit/tests/shtest-ulimit.py (+7-1) ``````````diff diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index a48df097403c7..ee7670d4a9961 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -12,6 +12,7 @@ import shutil import tempfile import threading +import resource import typing import traceback from typing import Optional, Tuple @@ -605,7 +606,10 @@ def executeBuiltinUlimit(cmd, shenv): if len(cmd.args) != 3: raise InternalShellError(cmd, "'ulimit' requires two arguments") try: - new_limit = int(cmd.args[2]) + if cmd.args[2] == "unlimited": + new_limit = resource.RLIM_INFINITY + else: + new_limit = int(cmd.args[2]) except ValueError as err: raise InternalShellError(cmd, "Error: 'ulimit': %s" % str(err)) if cmd.args[1] == "-v": diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_unlimited.txt b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_unlimited.txt new file mode 100644 index 0000000000000..b8aa3d5071712 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_unlimited.txt @@ -0,0 +1,6 @@ +# RUN: ulimit -f 5 +# RUN: %{python} %S/print_limits.py +# RUN: ulimit -f unlimited +# RUN: %{python} %S/print_limits.py +# Fail the test so that we can assert on the output. +# RUN: not echo return diff --git a/llvm/utils/lit/tests/shtest-ulimit.py b/llvm/utils/lit/tests/shtest-ulimit.py index ba3de8b1bfced..d63a92f1c18e3 100644 --- a/llvm/utils/lit/tests/shtest-ulimit.py +++ b/llvm/utils/lit/tests/shtest-ulimit.py @@ -11,7 +11,7 @@ # RUN: not %{lit} -a -v %{inputs}/shtest-ulimit --order=lexical \ # RUN: | FileCheck -DBASE_NOFILE_LIMIT=%{readfile:%t.nofile_limit} %s -# CHECK: -- Testing: 3 tests{{.*}} +# CHECK: -- Testing: 4 tests{{.*}} # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit-bad-arg.txt ({{[^)]*}}) # CHECK: ulimit -n @@ -27,3 +27,9 @@ # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_reset.txt ({{[^)]*}}) # CHECK: RLIMIT_NOFILE=[[BASE_NOFILE_LIMIT]] + +# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_unlimited.txt ({{[^)]*}}) +# CHECK: ulimit -f 5 +# CHECK: RLIMIT_FSIZE=5 +# CHECK: ulimit -f unlimited +# CHECK: RLIMIT_FSIZE=-1 `````````` </details> https://github.com/llvm/llvm-project/pull/165123 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
