Skip to content

Commit 502b4e2

Browse files
committed
Fix collecting tests under sandboxed
1 parent 63ad0b2 commit 502b4e2

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

graalpython/lib-python/3/test/test_crypt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import unittest
33
from test.support import check_sanitizer, warnings_helper
44

5+
# GraalPy change:
6+
if sys.implementation.name == 'graalpy' and __graalpython__.posix_module_backend() == 'java':
7+
raise unittest.SkipTest("Not supported on Java posix backend")
58

69
try:
710
if check_sanitizer(address=True, memory=True):

mx.graalpython/mx_graalpython.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,23 +1101,30 @@ def graalpytest(args):
11011101
PYTHONHASHSEED='0',
11021102
)
11031103

1104-
cmd_args = []
1104+
python_args = []
1105+
runner_args = []
1106+
for arg in unknown_args:
1107+
if arg.startswith(('--python.', '--engine.', '--llvm.', '--vm.')):
1108+
python_args.append(arg)
1109+
else:
1110+
runner_args.append(arg)
11051111
# if we got a binary path it's most likely CPython, so don't add graalpython args
11061112
is_graalpy = False
11071113
if not args.python:
11081114
is_graalpy = True
1109-
cmd_args += ["--experimental-options=true", "--python.EnableDebuggingBuiltins"]
1115+
python_args += ["--experimental-options=true", "--python.EnableDebuggingBuiltins"]
11101116
elif 'graalpy' in os.path.basename(args.python) or 'mxbuild' in args.python:
11111117
is_graalpy = True
11121118
gp_args = ["--vm.ea", "--vm.esa", "--experimental-options=true", "--python.EnableDebuggingBuiltins"]
11131119
mx.log(f"Executable seems to be GraalPy, prepending arguments: {gp_args}")
1114-
cmd_args += gp_args
1115-
cmd_args += [_python_test_runner(), *unknown_args]
1120+
python_args += gp_args
1121+
runner_args += ['--subprocess-args', shlex.join(python_args)]
1122+
cmd_args = [*python_args, _python_test_runner(), *runner_args]
11161123
delete_bad_env_keys(env)
11171124
if is_graalpy:
11181125
pythonpath = [os.path.join(_dev_pythonhome(), 'lib-python', '3')]
11191126
pythonpath += [p for p in env.get('PYTHONPATH', '').split(os.pathsep) if p]
1120-
env['PYTONPATH'] = os.pathsep.join(pythonpath)
1127+
env['PYTHONPATH'] = os.pathsep.join(pythonpath)
11211128
if args.python:
11221129
return mx.run([args.python] + cmd_args, nonZeroIsFatal=True, env=env)
11231130
else:
@@ -1163,7 +1170,6 @@ def run_python_unittests(python_binary, args=None, paths=None, aot_compatible=Fa
11631170

11641171
args = args or []
11651172
args = [
1166-
"-s",
11671173
"--vm.ea",
11681174
"--experimental-options=true",
11691175
"--python.EnableDebuggingBuiltins",
@@ -1482,7 +1488,7 @@ def graalpython_gate_runner(args, tasks):
14821488
with Task('GraalPython Python unittests with CPython', tasks, tags=[GraalPythonTags.unittest_cpython]) as task:
14831489
if task:
14841490
env = extend_os_env(PYTHONHASHSEED='0')
1485-
test_args = [get_cpython(), "-s", _python_test_runner(), "-n", "1", "graalpython/com.oracle.graal.python.test/src/tests"]
1491+
test_args = [get_cpython(), _python_test_runner(), "-n", "1", "graalpython/com.oracle.graal.python.test/src/tests"]
14861492
mx.run(test_args, nonZeroIsFatal=True, env=env)
14871493

14881494
with Task('GraalPython sandboxed tests', tasks, tags=[GraalPythonTags.unittest_sandboxed]) as task:

0 commit comments

Comments
 (0)