@@ -201,18 +201,21 @@ def punittest(ars):
201
201
with _pythonhome_context ():
202
202
mx_unittest .unittest (args )
203
203
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 )
216
219
217
220
218
221
PYTHON_ARCHIVES = ["GRAALPYTHON_GRAALVM_SUPPORT" ]
@@ -1989,8 +1992,13 @@ def run_leak_launcher(args):
1989
1992
vm_args += mx .get_runtime_jvm_args (dists )
1990
1993
jdk = mx .get_jdk (tag = None )
1991
1994
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
1994
2002
1995
2003
1996
2004
# ----------------------------------------------------------------------------------------------------------------------
0 commit comments