Skip to content

Commit d6d950a

Browse files
committed
run unittests single file when using jacoco to avoid too much memory usage
1 parent cb7d51a commit d6d950a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,17 @@ def is_included(path):
380380
testfiles.append(testfile)
381381

382382
args += [_graalpytest_driver(), "-v"]
383-
args += testfiles
384-
mx.logv(" ".join([python_binary] + args))
385383

386384
agent_args = " ".join(mx_gate.get_jacoco_agent_args() or [])
387-
with set_env(JAVA_TOOL_OPTIONS=agent_args):
385+
if agent_args:
386+
# jacoco only dumps the data on exit, and when we run all our unittests
387+
# at once it generates so much data we run out of heap space
388+
with set_env(JAVA_TOOL_OPTIONS=agent_args):
389+
for testfile in testfiles:
390+
mx.run([python_binary] + args + [testfile], nonZeroIsFatal=True)
391+
else:
392+
args += testfiles
393+
mx.logv(" ".join([python_binary] + args))
388394
return mx.run([python_binary] + args, nonZeroIsFatal=True)
389395

390396

@@ -397,7 +403,7 @@ def graalpython_gate_runner(args, tasks):
397403
# Unittests on JVM
398404
with Task('GraalPython Python unittests', tasks, tags=[GraalPythonTags.unittest]) as task:
399405
if task:
400-
if platform.system() != 'Darwin':
406+
if platform.system() != 'Darwin' and not mx_gate.get_jacoco_agent_args():
401407
# TODO: drop condition when python3 is available on darwin
402408
mx.log("Running tests with CPython")
403409
test_args = [_graalpytest_driver(), "-v", _graalpytest_root()]

0 commit comments

Comments
 (0)