Skip to content

Commit 330068a

Browse files
Revert "[lit] Implement ulimit builtin"
This reverts commit 615d07e. This was causing some MacOS buildbolt failures.
1 parent 84f431c commit 330068a

File tree

7 files changed

+1
-98
lines changed

7 files changed

+1
-98
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ class ShellEnvironment(object):
9292
we maintain a dir stack for pushd/popd.
9393
"""
9494

95-
def __init__(self, cwd, env, umask=-1, ulimit={}):
95+
def __init__(self, cwd, env, umask=-1):
9696
self.cwd = cwd
9797
self.env = dict(env)
9898
self.umask = umask
9999
self.dirStack = []
100-
self.ulimit = ulimit
101100

102101
def change_dir(self, newdir):
103102
if os.path.isabs(newdir):
@@ -596,27 +595,6 @@ def executeBuiltinUmask(cmd, shenv):
596595
return ShellCommandResult(cmd, "", "", 0, False)
597596

598597

599-
def executeBuiltinUlimit(cmd, shenv):
600-
"""executeBuiltinUlimit - Change the current limits."""
601-
if os.name != "posix":
602-
raise InternalShellError(cmd, "'ulimit' not supported on this system")
603-
if len(cmd.args) != 3:
604-
raise InternalShellError(cmd, "'ulimit' requires two arguments")
605-
try:
606-
new_limit = int(cmd.args[2])
607-
except ValueError as err:
608-
raise InternalShellError(cmd, "Error: 'ulimit': %s" % str(err))
609-
if cmd.args[1] == "-v":
610-
shenv.ulimit["RLIMIT_AS"] = new_limit * 1024
611-
elif cmd.args[1] == "-n":
612-
shenv.ulimit["RLIMIT_NOFILE"] = new_limit
613-
else:
614-
raise InternalShellError(
615-
cmd, "'ulimit' does not support option: %s" % cmd.args[1]
616-
)
617-
return ShellCommandResult(cmd, "", "", 0, False)
618-
619-
620598
def executeBuiltinColon(cmd, cmd_shenv):
621599
"""executeBuiltinColon - Discard arguments and exit with status 0."""
622600
return ShellCommandResult(cmd, "", "", 0, False)
@@ -771,7 +749,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
771749
"popd": executeBuiltinPopd,
772750
"pushd": executeBuiltinPushd,
773751
"rm": executeBuiltinRm,
774-
"ulimit": executeBuiltinUlimit,
775752
"umask": executeBuiltinUmask,
776753
":": executeBuiltinColon,
777754
}
@@ -937,19 +914,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
937914
if kIsWindows:
938915
args = quote_windows_command(args)
939916

940-
# Handle any resource limits. We do this by launching the command with
941-
# a wrapper that sets the necessary limits. We use a wrapper rather than
942-
# setting the limits in process as we cannot reraise the limits back to
943-
# their defaults without elevated permissions.
944-
if cmd_shenv.ulimit:
945-
executable = sys.executable
946-
args.insert(0, sys.executable)
947-
args.insert(1, os.path.join(builtin_commands_dir, "_launch_with_limit.py"))
948-
for limit in cmd_shenv.ulimit:
949-
cmd_shenv.env["LIT_INTERNAL_ULIMIT_" + limit] = str(
950-
cmd_shenv.ulimit[limit]
951-
)
952-
953917
try:
954918
# TODO(boomanaiden154): We currently wrap the subprocess.Popen with
955919
# os.umask as the umask argument in subprocess.Popen is not

llvm/utils/lit/lit/builtin_commands/_launch_with_limit.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

llvm/utils/lit/tests/Inputs/shtest-ulimit/lit.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit-bad-arg.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_okay.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

llvm/utils/lit/tests/shtest-ulimit.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)