@@ -311,7 +311,7 @@ def run_cpython_test(args):
311
311
env = os .environ .copy ()
312
312
delete_bad_env_keys (env )
313
313
with _dev_pythonhome_context ():
314
- mx .run ([python_gvm_with_assertions () ] + interp_args + [
314
+ mx .run ([python_gvm ()] + [ '--vm.ea' ] + interp_args + [
315
315
os .path .join (SUITE .dir , "graalpython/com.oracle.graal.python.test/src/tests/run_cpython_test.py" ),
316
316
] + test_args + testfiles , env = env )
317
317
@@ -342,7 +342,9 @@ def retag_unittests(args):
342
342
'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
343
343
'--retag'
344
344
]
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' ]
346
348
mx .run ([vm ] + args + remaining_args , env = env )
347
349
if parsed_args .upload_results_to :
348
350
with tempfile .TemporaryDirectory (prefix = 'graalpython-retagger-' ) as d :
@@ -590,18 +592,6 @@ def python_enterprise_gvm(_=None):
590
592
mx .log (launcher )
591
593
return launcher
592
594
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
-
605
595
def python_svm (_ = None ):
606
596
home = _graalvm_home (envfile = "graalpython-launcher" )
607
597
launcher = _join_bin (home , "graalpy" )
@@ -695,7 +685,7 @@ def is_included(path):
695
685
696
686
697
687
def 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 ):
699
689
if lock :
700
690
lock .acquire ()
701
691
# ensure that the test distribution is up-to-date
@@ -759,6 +749,9 @@ def graalvm_vm_arg(java_arg):
759
749
mx .run ([python_binary , "--jvm" , agent_args ] + args + [testfile ],
760
750
nonZeroIsFatal = nonZeroIsFatal , env = env , cwd = cwd , out = out , err = err )
761
751
else :
752
+ if javaAsserts :
753
+ args += ['-ea' ]
754
+
762
755
args += testfiles
763
756
mx .logv (" " .join ([python_binary ] + args ))
764
757
if lock :
@@ -838,7 +831,7 @@ def run(self):
838
831
mx .abort ("At least one HPy testing thread failed." )
839
832
840
833
841
- def run_tagged_unittests (python_binary , env = None , cwd = None ):
834
+ def run_tagged_unittests (python_binary , env = None , cwd = None , javaAsserts = False ):
842
835
if env is None :
843
836
env = os .environ
844
837
sub_env = env .copy ()
@@ -852,7 +845,8 @@ def run_tagged_unittests(python_binary, env=None, cwd=None):
852
845
args = ["-v" ],
853
846
paths = ["test_tagged_unittests.py" ],
854
847
env = sub_env ,
855
- cwd = cwd
848
+ cwd = cwd ,
849
+ javaAsserts = javaAsserts
856
850
)
857
851
858
852
@@ -877,19 +871,19 @@ def graalpython_gate_runner(args, tasks):
877
871
test_args = [exe , _graalpytest_driver (), "-v" , _graalpytest_root ()]
878
872
mx .run (test_args , nonZeroIsFatal = True , env = env )
879
873
mx .run (["env" ])
880
- run_python_unittests (python_gvm_with_assertions () )
874
+ run_python_unittests (python_gvm (), javaAsserts = True )
881
875
882
876
with Task ('GraalPython sandboxed tests' , tasks , tags = [GraalPythonTags .unittest_sandboxed ]) as task :
883
877
if task :
884
- run_python_unittests (python_managed_gvm_with_assertions () )
878
+ run_python_unittests (python_managed_gvm (), javaAsserts = True )
885
879
886
880
with Task ('GraalPython multi-context unittests' , tasks , tags = [GraalPythonTags .unittest_multi ]) as task :
887
881
if task :
888
- run_python_unittests (python_gvm_with_assertions (), args = ["-multi-context" ])
882
+ run_python_unittests (python_gvm (), args = ["-multi-context" ], javaAsserts = True )
889
883
890
884
with Task ('GraalPython Jython emulation tests' , tasks , tags = [GraalPythonTags .unittest_jython ]) as task :
891
885
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 )
893
887
894
888
with Task ('GraalPython HPy tests' , tasks , tags = [GraalPythonTags .unittest_hpy ]) as task :
895
889
if task :
@@ -901,8 +895,8 @@ def graalpython_gate_runner(args, tasks):
901
895
902
896
with Task ('GraalPython posix module tests' , tasks , tags = [GraalPythonTags .unittest_posix ]) as task :
903
897
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 )
906
900
907
901
with Task ('GraalPython Python tests' , tasks , tags = [GraalPythonTags .tagged ]) as task :
908
902
if task :
@@ -1652,10 +1646,9 @@ def verify_ci(dest_suite, common_ci_dir="ci_common", args=None, ext=('.jsonnet',
1652
1646
'graalpython:GRAALPYTHON_GRAALVM_SUPPORT' ,
1653
1647
'graalpython:GRAALPYTHON_GRAALVM_DOCS' ,
1654
1648
],
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>' ],
1659
1652
jar_distributions = ['graalpython:GRAALPYTHON-LAUNCHER' ],
1660
1653
main_class = GRAALPYTHON_MAIN_CLASS ,
1661
1654
build_args = [
@@ -1814,7 +1807,7 @@ def python_coverage(args):
1814
1807
'coverage-upload' ,
1815
1808
])
1816
1809
if args .truffle :
1817
- executable = python_gvm_with_assertions ()
1810
+ executable = python_gvm ()
1818
1811
variants = [
1819
1812
{"args" : []},
1820
1813
{"args" : ["--python.EmulateJython" ], "paths" : ["test_interop.py" ]},
@@ -1844,9 +1837,9 @@ def python_coverage(args):
1844
1837
env ['GRAAL_PYTHON_ARGS' ] = " " .join (extra_args )
1845
1838
env ['ENABLE_THREADED_GRAALPYTEST' ] = "false"
1846
1839
if kwds .pop ("tagged" , False ):
1847
- run_tagged_unittests (executable , env = env )
1840
+ run_tagged_unittests (executable , env = env , javaAsserts = True )
1848
1841
else :
1849
- run_python_unittests (executable , env = env , ** kwds )
1842
+ run_python_unittests (executable , env = env , javaAsserts = True , ** kwds )
1850
1843
1851
1844
# generate a synthetic lcov file that includes all sources with 0
1852
1845
# coverage. this is to ensure all sources actuall show up - otherwise,
0 commit comments