Skip to content

Commit df101e5

Browse files
committed
Add --svm argument to mx graalpytest
1 parent 88aae2c commit df101e5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ def main():
11821182
if is_mx_graalpytest:
11831183
# mx graalpytest takes this option, but it forwards --help here, so pretend we take it
11841184
parser.add_argument('--python', help="Run tests with given Python binary")
1185+
parser.add_argument('--svm', action='store_true', help="Use SVM standalone")
11851186
parser.add_argument('-t', '--tagged', action='store_true',
11861187
help="Interpret test file names relative to tagged test directory")
11871188
parser.add_argument('-n', '--num-processes', type=int,

mx.graalpython/mx_graalpython.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,8 +1035,10 @@ def _hpy_test_root():
10351035

10361036

10371037
def graalpytest(args):
1038+
# help is delegated to the runner, it will fake the mx-specific options as well
10381039
parser = ArgumentParser(prog='mx graalpytest', add_help=False)
10391040
parser.add_argument('--python')
1041+
parser.add_argument('--svm', action='store_true')
10401042
args, unknown_args = parser.parse_known_args(args)
10411043

10421044
env = extend_os_env(
@@ -1053,10 +1055,13 @@ def graalpytest(args):
10531055
runner_args.append(arg)
10541056
# if we got a binary path it's most likely CPython, so don't add graalpython args
10551057
is_graalpy = False
1056-
if not args.python:
1058+
python_binary = args.python
1059+
if not python_binary:
10571060
is_graalpy = True
10581061
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:
10601065
is_graalpy = True
10611066
gp_args = ["--vm.ea", "--vm.esa", "--experimental-options=true", "--python.EnableDebuggingBuiltins"]
10621067
mx.log(f"Executable seems to be GraalPy, prepending arguments: {gp_args}")
@@ -1068,8 +1073,8 @@ def graalpytest(args):
10681073
pythonpath = [os.path.join(_dev_pythonhome(), 'lib-python', '3')]
10691074
pythonpath += [p for p in env.get('PYTHONPATH', '').split(os.pathsep) if p]
10701075
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)
10731078
else:
10741079
return full_python(cmd_args, env=env)
10751080

0 commit comments

Comments
 (0)