https://github.com/boomanaiden154 updated 
https://github.com/llvm/llvm-project/pull/165123

>From d34141d561067728d0954ffd574a973f21691e3e Mon Sep 17 00:00:00 2001
From: Aiden Grossman <[email protected]>
Date: Sun, 26 Oct 2025 08:29:41 +0000
Subject: [PATCH] fix

Created using spr 1.3.7
---
 llvm/utils/lit/lit/TestRunner.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index ee7670d4a9961..be01f15d649a1 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -12,7 +12,6 @@
 import shutil
 import tempfile
 import threading
-import resource
 import typing
 import traceback
 from typing import Optional, Tuple
@@ -603,6 +602,9 @@ def executeBuiltinUlimit(cmd, shenv):
     """executeBuiltinUlimit - Change the current limits."""
     if os.name != "posix":
         raise InternalShellError(cmd, "'ulimit' not supported on this system")
+    # Import resource here after we confirm we are on a POSIX system as the
+    # module does not exist on Windows.
+    import resource
     if len(cmd.args) != 3:
         raise InternalShellError(cmd, "'ulimit' requires two arguments")
     try:
@@ -613,11 +615,15 @@ def executeBuiltinUlimit(cmd, shenv):
     except ValueError as err:
         raise InternalShellError(cmd, "Error: 'ulimit': %s" % str(err))
     if cmd.args[1] == "-v":
-        shenv.ulimit["RLIMIT_AS"] = new_limit * 1024
+        if new_limit != resource.RLIM_INFINITY:
+            new_limit = new_limit * 1024
+        shenv.ulimit["RLIMIT_AS"] = new_limit
     elif cmd.args[1] == "-n":
         shenv.ulimit["RLIMIT_NOFILE"] = new_limit
     elif cmd.args[1] == "-s":
-        shenv.ulimit["RLIMIT_STACK"] = new_limit * 1024
+        if new_limit != resource.RLIM_INFINITY:
+            new_limit = new_limit * 1024
+        shenv.ulimit["RLIMIT_STACK"] = new_limit
     elif cmd.args[1] == "-f":
         shenv.ulimit["RLIMIT_FSIZE"] = new_limit
     else:

_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to