Skip to content

Commit d29908f

Browse files
committed
run all leak tests and report failing
1 parent f143d8b commit d29908f

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,21 @@ def punittest(ars):
201201
with _pythonhome_context():
202202
mx_unittest.unittest(args)
203203

204-
# test leaks with Python code only
205-
assert run_leak_launcher(["--lang", "python", "--code", "pass", "--forbidden-class", "com.oracle.graal.python.builtins.objects.object.PythonObject", "--python.ForceImportSite"]) == 0
206-
207-
# test leaks when some C module code is involved
208-
assert run_leak_launcher(["--lang", "python", "--code", "import _testcapi, mmap, bz2; print(memoryview(b'').nbytes)", "--forbidden-class", "com.oracle.graal.python.builtins.objects.object.PythonObject", "--python.ForceImportSite"]) == 0
209-
210-
# test leaks with shared engine Python code only
211-
assert run_leak_launcher(["--lang", "python", "--shared-engine", "--code", "pass", "--forbidden-class", "com.oracle.graal.python.builtins.objects.object.PythonObject", "--python.ForceImportSite", "--python.TRegexUsesSREFallback=false"]) == 0
212-
213-
# test leaks with shared engine when some C module code is involved
214-
# Not working due to GR-26175
215-
# assert run_leak_launcher(["--lang", "python", "--shared-engine", "--code", "import _testcapi, mmap, bz2; print(memoryview(b'').nbytes)", "--forbidden-class", "com.oracle.graal.python.builtins.objects.object.PythonObject", "--python.ForceImportSite"]) == 0
204+
common_args = ["--lang", "python",
205+
"--forbidden-class", "com.oracle.graal.python.builtins.objects.object.PythonObject",
206+
"--python.ForceImportSite", "--python.TRegexUsesSREFallback=false"]
207+
208+
if not all([# test leaks with Python code only
209+
run_leak_launcher(common_args + ["--code", "pass", ]),
210+
# test leaks when some C module code is involved
211+
run_leak_launcher(common_args + ["--code", "import _testcapi, mmap, bz2; print(memoryview(b'').nbytes)"]),
212+
# test leaks with shared engine Python code only
213+
run_leak_launcher(common_args + ["--shared-engine", "--code", "pass"]),
214+
# test leaks with shared engine when some C module code is involved
215+
# Not working due to GR-26175
216+
# run_leak_launcher(common_args + ["--shared-engine", "--code", "import _testcapi, mmap, bz2; print(memoryview(b'').nbytes)"])
217+
]):
218+
mx.abort(1)
216219

217220

218221
PYTHON_ARCHIVES = ["GRAALPYTHON_GRAALVM_SUPPORT"]
@@ -1989,8 +1992,13 @@ def run_leak_launcher(args):
19891992
vm_args += mx.get_runtime_jvm_args(dists)
19901993
jdk = mx.get_jdk(tag=None)
19911994
vm_args.append("com.oracle.graal.python.test.advance.LeakTest")
1992-
return mx.run_java(vm_args + graalpython_args, jdk=jdk, env=env)
1993-
1995+
retval = mx.run_java(vm_args + graalpython_args, jdk=jdk, env=env, nonZeroIsFatal=False)
1996+
if retval == 0:
1997+
print("PASSED")
1998+
return True
1999+
else:
2000+
print("FAILED")
2001+
return False
19942002

19952003

19962004
# ----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)