@@ -311,7 +311,7 @@ def run_cpython_test(args):
311311 env = os .environ .copy ()
312312 delete_bad_env_keys (env )
313313 with _dev_pythonhome_context ():
314- mx .run ([python_gvm_with_assertions () ] + interp_args + [
314+ mx .run ([python_gvm ()] + [ '--vm.ea' ] + interp_args + [
315315 os .path .join (SUITE .dir , "graalpython/com.oracle.graal.python.test/src/tests/run_cpython_test.py" ),
316316 ] + test_args + testfiles , env = env )
317317
@@ -342,7 +342,9 @@ def retag_unittests(args):
342342 'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
343343 '--retag'
344344 ]
345- vm = python_svm () if not parsed_args .jvm else python_gvm_with_assertions ()
345+ vm = python_svm () if not parsed_args .jvm else python_gvm ()
346+ if parsed_args .jvm :
347+ args += ['-ea' ]
346348 mx .run ([vm ] + args + remaining_args , env = env )
347349 if parsed_args .upload_results_to :
348350 with tempfile .TemporaryDirectory (prefix = 'graalpython-retagger-' ) as d :
@@ -590,18 +592,6 @@ def python_enterprise_gvm(_=None):
590592 mx .log (launcher )
591593 return launcher
592594
593- def python_gvm_with_assertions ():
594- launcher = python_gvm ()
595- patch_batch_launcher (launcher , '-ea' )
596- return launcher
597-
598-
599- def python_managed_gvm_with_assertions ():
600- launcher = python_managed_gvm ()
601- patch_batch_launcher (launcher , '-ea' )
602- return launcher
603-
604-
605595def python_svm (_ = None ):
606596 home = _graalvm_home (envfile = "graalpython-launcher" )
607597 launcher = _join_bin (home , "graalpy" )
@@ -695,7 +685,7 @@ def is_included(path):
695685
696686
697687def run_python_unittests (python_binary , args = None , paths = None , aot_compatible = False , exclude = None , env = None ,
698- use_pytest = False , cwd = None , lock = None , out = None , err = None , nonZeroIsFatal = True ):
688+ use_pytest = False , cwd = None , lock = None , out = None , err = None , nonZeroIsFatal = True , javaAsserts = False ):
699689 if lock :
700690 lock .acquire ()
701691 # ensure that the test distribution is up-to-date
@@ -759,6 +749,9 @@ def graalvm_vm_arg(java_arg):
759749 mx .run ([python_binary , "--jvm" , agent_args ] + args + [testfile ],
760750 nonZeroIsFatal = nonZeroIsFatal , env = env , cwd = cwd , out = out , err = err )
761751 else :
752+ if javaAsserts :
753+ args += ['-ea' ]
754+
762755 args += testfiles
763756 mx .logv (" " .join ([python_binary ] + args ))
764757 if lock :
@@ -838,7 +831,7 @@ def run(self):
838831 mx .abort ("At least one HPy testing thread failed." )
839832
840833
841- def run_tagged_unittests (python_binary , env = None , cwd = None ):
834+ def run_tagged_unittests (python_binary , env = None , cwd = None , javaAsserts = False ):
842835 if env is None :
843836 env = os .environ
844837 sub_env = env .copy ()
@@ -852,7 +845,8 @@ def run_tagged_unittests(python_binary, env=None, cwd=None):
852845 args = ["-v" ],
853846 paths = ["test_tagged_unittests.py" ],
854847 env = sub_env ,
855- cwd = cwd
848+ cwd = cwd ,
849+ javaAsserts = javaAsserts
856850 )
857851
858852
@@ -877,19 +871,19 @@ def graalpython_gate_runner(args, tasks):
877871 test_args = [exe , _graalpytest_driver (), "-v" , _graalpytest_root ()]
878872 mx .run (test_args , nonZeroIsFatal = True , env = env )
879873 mx .run (["env" ])
880- run_python_unittests (python_gvm_with_assertions () )
874+ run_python_unittests (python_gvm (), javaAsserts = True )
881875
882876 with Task ('GraalPython sandboxed tests' , tasks , tags = [GraalPythonTags .unittest_sandboxed ]) as task :
883877 if task :
884- run_python_unittests (python_managed_gvm_with_assertions () )
878+ run_python_unittests (python_managed_gvm (), javaAsserts = True )
885879
886880 with Task ('GraalPython multi-context unittests' , tasks , tags = [GraalPythonTags .unittest_multi ]) as task :
887881 if task :
888- run_python_unittests (python_gvm_with_assertions (), args = ["-multi-context" ])
882+ run_python_unittests (python_gvm (), args = ["-multi-context" ], javaAsserts = True )
889883
890884 with Task ('GraalPython Jython emulation tests' , tasks , tags = [GraalPythonTags .unittest_jython ]) as task :
891885 if task :
892- run_python_unittests (python_gvm_with_assertions (), args = ["--python.EmulateJython" ], paths = ["test_interop.py" ])
886+ run_python_unittests (python_gvm (), args = ["--python.EmulateJython" ], paths = ["test_interop.py" ], javaAsserts = True )
893887
894888 with Task ('GraalPython HPy tests' , tasks , tags = [GraalPythonTags .unittest_hpy ]) as task :
895889 if task :
@@ -901,8 +895,8 @@ def graalpython_gate_runner(args, tasks):
901895
902896 with Task ('GraalPython posix module tests' , tasks , tags = [GraalPythonTags .unittest_posix ]) as task :
903897 if task :
904- run_python_unittests (python_gvm_with_assertions (), args = ["--PosixModuleBackend=native" ], paths = ["test_posix.py" , "test_mmap.py" ])
905- run_python_unittests (python_gvm_with_assertions (), args = ["--PosixModuleBackend=java" ], paths = ["test_posix.py" , "test_mmap.py" ])
898+ run_python_unittests (python_gvm (), args = ["--PosixModuleBackend=native" ], paths = ["test_posix.py" , "test_mmap.py" ], javaAsserts = True )
899+ run_python_unittests (python_gvm (), args = ["--PosixModuleBackend=java" ], paths = ["test_posix.py" , "test_mmap.py" ], javaAsserts = True )
906900
907901 with Task ('GraalPython Python tests' , tasks , tags = [GraalPythonTags .tagged ]) as task :
908902 if task :
@@ -1652,10 +1646,9 @@ def verify_ci(dest_suite, common_ci_dir="ci_common", args=None, ext=('.jsonnet',
16521646 'graalpython:GRAALPYTHON_GRAALVM_SUPPORT' ,
16531647 'graalpython:GRAALPYTHON_GRAALVM_DOCS' ,
16541648 ],
1655- launcher_configs = [
1656- mx_sdk .LanguageLauncherConfig (
1657- destination = 'bin/<exe:graalpy>' ,
1658- links = ['bin/python' , 'bin/python3' ],
1649+ library_configs = [
1650+ mx_sdk .LanguageLibraryConfig (
1651+ launchers = ['bin/<exe:graalpy>' , 'bin/<exe:python>' , 'bin/<exe:python3>' ],
16591652 jar_distributions = ['graalpython:GRAALPYTHON-LAUNCHER' ],
16601653 main_class = GRAALPYTHON_MAIN_CLASS ,
16611654 build_args = [
@@ -1814,7 +1807,7 @@ def python_coverage(args):
18141807 'coverage-upload' ,
18151808 ])
18161809 if args .truffle :
1817- executable = python_gvm_with_assertions ()
1810+ executable = python_gvm ()
18181811 variants = [
18191812 {"args" : []},
18201813 {"args" : ["--python.EmulateJython" ], "paths" : ["test_interop.py" ]},
@@ -1844,9 +1837,9 @@ def python_coverage(args):
18441837 env ['GRAAL_PYTHON_ARGS' ] = " " .join (extra_args )
18451838 env ['ENABLE_THREADED_GRAALPYTEST' ] = "false"
18461839 if kwds .pop ("tagged" , False ):
1847- run_tagged_unittests (executable , env = env )
1840+ run_tagged_unittests (executable , env = env , javaAsserts = True )
18481841 else :
1849- run_python_unittests (executable , env = env , ** kwds )
1842+ run_python_unittests (executable , env = env , javaAsserts = True , ** kwds )
18501843
18511844 # generate a synthetic lcov file that includes all sources with 0
18521845 # coverage. this is to ensure all sources actuall show up - otherwise,
0 commit comments