97
97
98
98
_COLLECTING_COVERAGE = False
99
99
100
- def is_collectiong_coverage ():
101
- return bool (mx_gate .get_jacoco_agent_args () or _COLLECTING_COVERAGE )
102
-
100
+ CI = os .environ .get ("CI" ) == "true"
101
+ BUILD_NATIVE_IMAGE_WITH_ASSERTIONS = CI and sys .platform != "win32" # disable assertions on win32 until we properly support that platform
103
102
104
- if os . environ . get ( "CI" ) == "true" and not os .environ .get ("GRAALPYTEST_FAIL_FAST" ):
103
+ if CI and not os .environ .get ("GRAALPYTEST_FAIL_FAST" ):
105
104
os .environ ["GRAALPYTEST_FAIL_FAST" ] = "true"
106
105
107
106
107
+ def is_collecting_coverage ():
108
+ return bool (mx_gate .get_jacoco_agent_args () or _COLLECTING_COVERAGE )
109
+
110
+
108
111
def wants_debug_build (flags = os .environ .get ("CFLAGS" , "" )):
109
112
return any (x in flags for x in ["-g" , "-ggdb" , "-ggdb3" ])
110
113
@@ -252,7 +255,7 @@ def do_run_python(args, extra_vm_args=None, env=None, jdk=None, extra_dists=None
252
255
if extra_dists :
253
256
dists += extra_dists
254
257
255
- if not os . environ . get ( "CI" ) :
258
+ if not CI :
256
259
# Try eagerly to include tools for convenience when running Python
257
260
if not mx .suite ("tools" , fatalIfMissing = False ):
258
261
SUITE .import_suite ("tools" , version = None , urlinfos = None , in_subdir = True )
@@ -697,6 +700,9 @@ def _graalvm_home(*, envfile, extra_dy=""):
697
700
mx_args = ["--dy" , dy ] + mx_args
698
701
if mx ._opts .verbose :
699
702
mx .run_mx (mx_args + ["graalvm-show" ])
703
+ if BUILD_NATIVE_IMAGE_WITH_ASSERTIONS :
704
+ mx_args .append ("--extra-image-builder-argument=-ea" )
705
+ mx_args .append ("--extra-image-builder-argument=--verbose" )
700
706
mx .run_mx (mx_args + ["build" ])
701
707
out = mx .OutputCapture ()
702
708
mx .run_mx (mx_args + ["graalvm-home" ], out = out )
@@ -722,7 +728,7 @@ def python_gvm(_=None):
722
728
723
729
if mx_gate .get_jacoco_agent_args ():
724
730
# patch our launchers created under jacoco to also run with jacoco.
725
- # do not use is_collectiong_coverage () here, we only want to patch when
731
+ # do not use is_collecting_coverage () here, we only want to patch when
726
732
# jacoco agent is requested.
727
733
def graalvm_vm_arg (java_arg ):
728
734
if java_arg .startswith ("@" ) and os .path .exists (java_arg [1 :]):
@@ -918,7 +924,7 @@ def run_python_unittests(python_binary, args=None, paths=None, aot_compatible=Fa
918
924
args += ["--report" , reportfile ]
919
925
920
926
result = 0
921
- if is_collectiong_coverage ():
927
+ if is_collecting_coverage ():
922
928
env ['ENABLE_THREADED_GRAALPYTEST' ] = "false"
923
929
if mx_gate .get_jacoco_agent_args ():
924
930
with open (python_binary , "r" ) as f :
@@ -1021,7 +1027,7 @@ def run_hpy_unittests(python_binary, args=None, include_native=True, env=None, n
1021
1027
nonZeroIsFatal = nonZeroIsFatal , env = env , timeout = timeout )
1022
1028
mx .run ([python_binary ] + args + ["-m" , "pip" , "install" , "--user" , "pytest<=6.2.3" , "pytest-xdist" , "filelock" ],
1023
1029
nonZeroIsFatal = nonZeroIsFatal , env = env , timeout = timeout )
1024
- if not is_collectiong_coverage ():
1030
+ if not is_collecting_coverage ():
1025
1031
# parallelize
1026
1032
import threading
1027
1033
threads = []
@@ -1115,8 +1121,8 @@ def run_tagged_unittests(python_binary, env=None, cwd=None, javaAsserts=False, n
1115
1121
1116
1122
1117
1123
def graalpython_gate_runner (args , tasks ):
1118
- report = lambda : (not is_collectiong_coverage ()) and task
1119
- nonZeroIsFatal = not is_collectiong_coverage ()
1124
+ report = lambda : (not is_collecting_coverage ()) and task
1125
+ nonZeroIsFatal = not is_collecting_coverage ()
1120
1126
1121
1127
# JUnit tests
1122
1128
with Task ('GraalPython JUnit' , tasks , tags = [GraalPythonTags .junit ]) as task :
@@ -1173,7 +1179,7 @@ def graalpython_gate_runner(args, tasks):
1173
1179
with Task ('GraalPython Python tests' , tasks , tags = [GraalPythonTags .tagged ]) as task :
1174
1180
if task :
1175
1181
# don't fail this task if we're running with the jacoco agent, we know that some tests don't pass with it enabled
1176
- run_tagged_unittests (python_svm (), nonZeroIsFatal = (not is_collectiong_coverage ()), report = report ())
1182
+ run_tagged_unittests (python_svm (), nonZeroIsFatal = (not is_collecting_coverage ()), report = report ())
1177
1183
1178
1184
with Task ('GraalPython sandboxed Python tests' , tasks , tags = [GraalPythonTags .tagged_sandboxed ]) as task :
1179
1185
if task :
0 commit comments