@@ -1035,8 +1035,10 @@ def _hpy_test_root():
1035
1035
1036
1036
1037
1037
def graalpytest (args ):
1038
+ # help is delegated to the runner, it will fake the mx-specific options as well
1038
1039
parser = ArgumentParser (prog = 'mx graalpytest' , add_help = False )
1039
1040
parser .add_argument ('--python' )
1041
+ parser .add_argument ('--svm' , action = 'store_true' )
1040
1042
args , unknown_args = parser .parse_known_args (args )
1041
1043
1042
1044
env = extend_os_env (
@@ -1053,10 +1055,13 @@ def graalpytest(args):
1053
1055
runner_args .append (arg )
1054
1056
# if we got a binary path it's most likely CPython, so don't add graalpython args
1055
1057
is_graalpy = False
1056
- if not args .python :
1058
+ python_binary = args .python
1059
+ if not python_binary :
1057
1060
is_graalpy = True
1058
1061
python_args += ["--experimental-options=true" , "--python.EnableDebuggingBuiltins" ]
1059
- elif 'graalpy' in os .path .basename (args .python ) or 'mxbuild' in args .python :
1062
+ if args .svm :
1063
+ python_binary = graalpy_standalone_native ()
1064
+ elif 'graalpy' in os .path .basename (python_binary ) or 'mxbuild' in python_binary :
1060
1065
is_graalpy = True
1061
1066
gp_args = ["--vm.ea" , "--vm.esa" , "--experimental-options=true" , "--python.EnableDebuggingBuiltins" ]
1062
1067
mx .log (f"Executable seems to be GraalPy, prepending arguments: { gp_args } " )
@@ -1068,8 +1073,8 @@ def graalpytest(args):
1068
1073
pythonpath = [os .path .join (_dev_pythonhome (), 'lib-python' , '3' )]
1069
1074
pythonpath += [p for p in env .get ('PYTHONPATH' , '' ).split (os .pathsep ) if p ]
1070
1075
env ['PYTHONPATH' ] = os .pathsep .join (pythonpath )
1071
- if args . python :
1072
- return mx .run ([args . python ] + cmd_args , nonZeroIsFatal = True , env = env )
1076
+ if python_binary :
1077
+ return mx .run ([python_binary , * cmd_args ] , nonZeroIsFatal = True , env = env )
1073
1078
else :
1074
1079
return full_python (cmd_args , env = env )
1075
1080
0 commit comments