Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

These are the other options used in compiler-rt that we also need to
support.

Created using spr 1.3.7
@llvmbot
Copy link
Member

llvmbot commented Oct 25, 2025

@llvm/pr-subscribers-testing-tools

Author: Aiden Grossman (boomanaiden154)

Changes

These are the other options used in compiler-rt that we also need to
support.


Full diff: https://github.com/llvm/llvm-project/pull/165122.diff

5 Files Affected:

  • (modified) llvm/utils/lit/lit/TestRunner.py (+4)
  • (modified) llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py (+4)
  • (modified) llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py (+2)
  • (modified) llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt (+2)
  • (modified) llvm/utils/lit/tests/shtest-ulimit.py (+4)
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]]

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Oct 26, 2025
These are the other options used in compiler-rt that we also need to
support.

Pull Request: llvm#165122
@boomanaiden154 boomanaiden154 merged commit 8f1c72d into main Oct 27, 2025
13 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/lit-support-more-ulimit-options branch October 27, 2025 17:43
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 27, 2025
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
@dyung
Copy link
Collaborator

dyung commented Oct 27, 2025

@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?

dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants