-
Couldn't load subscription status.
- Fork 15k
[lit] Support more ulimit options #165122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lit] Support more ulimit options #165122
Conversation
Created using spr 1.3.7
|
@llvm/pr-subscribers-testing-tools Author: Aiden Grossman (boomanaiden154) ChangesThese are the other options used in compiler-rt that we also need to Full diff: https://github.com/llvm/llvm-project/pull/165122.diff 5 Files Affected:
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index f88314547bb3f..a48df097403c7 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -612,6 +612,10 @@ def executeBuiltinUlimit(cmd, shenv):
shenv.ulimit["RLIMIT_AS"] = new_limit * 1024
elif cmd.args[1] == "-n":
shenv.ulimit["RLIMIT_NOFILE"] = new_limit
+ elif cmd.args[1] == "-s":
+ shenv.ulimit["RLIMIT_STACK"] = new_limit * 1024
+ elif cmd.args[1] == "-f":
+ shenv.ulimit["RLIMIT_FSIZE"] = new_limit
else:
raise InternalShellError(
cmd, "'ulimit' does not support option: %s" % cmd.args[1]
diff --git a/llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py b/llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py
index 33d2d59ff0dbe..a9dc2595497e7 100644
--- a/llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py
+++ b/llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py
@@ -17,6 +17,10 @@ def main(argv):
resource.setrlimit(resource.RLIMIT_AS, limit)
elif limit_str == "RLIMIT_NOFILE":
resource.setrlimit(resource.RLIMIT_NOFILE, limit)
+ elif limit_str == "RLIMIT_STACK":
+ resource.setrlimit(resource.RLIMIT_STACK, limit)
+ elif limit_str == "RLIMIT_FSIZE":
+ resource.setrlimit(resource.RLIMIT_FSIZE, limit)
process_output = subprocess.run(command_args)
sys.exit(process_output.returncode)
diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py b/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
index 632f954fa8fde..c732c0429e661 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
+++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
@@ -2,3 +2,5 @@
print("RLIMIT_AS=" + str(resource.getrlimit(resource.RLIMIT_AS)[0]))
print("RLIMIT_NOFILE=" + str(resource.getrlimit(resource.RLIMIT_NOFILE)[0]))
+print("RLIMIT_STACK=" + str(resource.getrlimit(resource.RLIMIT_STACK)[0]))
+print("RLIMIT_FSIZE=" + str(resource.getrlimit(resource.RLIMIT_FSIZE)[0]))
diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt
index 4edf1c303a092..d38dc44fa033d 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt
+++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt
@@ -1,4 +1,6 @@
# RUN: ulimit -n 50
+# RUN: ulimit -s 256
+# RUN: ulimit -f 5
# 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 09cd475b737c1..ba3de8b1bfced 100644
--- a/llvm/utils/lit/tests/shtest-ulimit.py
+++ b/llvm/utils/lit/tests/shtest-ulimit.py
@@ -19,7 +19,11 @@
# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_okay.txt ({{[^)]*}})
# CHECK: ulimit -n 50
+# CHECK: ulimit -s 256
+# CHECK: ulimit -f 5
# CHECK: RLIMIT_NOFILE=50
+# CHECK: RLIMIT_STACK=262144
+# CHECK: RLIMIT_FSIZE=5
# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_reset.txt ({{[^)]*}})
# CHECK: RLIMIT_NOFILE=[[BASE_NOFILE_LIMIT]]
|
These are the other options used in compiler-rt that we also need to support. Pull Request: llvm#165122
These are the other options used in compiler-rt that we also need to support. Reviewers: arichardson, petrhosek, ilovepi Reviewed By: ilovepi, arichardson Pull Request: llvm/llvm-project#165122
|
@boomanaiden154, in case you didn't get notified, the ulimit test you added seems to be failing on MacOS for some reason. Can you take a look? |
These are the other options used in compiler-rt that we also need to support. Reviewers: arichardson, petrhosek, ilovepi Reviewed By: ilovepi, arichardson Pull Request: llvm#165122
These are the other options used in compiler-rt that we also need to
support.