Skip to content

Commit 17998f4

Browse files
committed
Run test subprocesses without JIT
1 parent a4609d2 commit 17998f4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@
8181
CURRENT_PLATFORM = f'{sys.platform}-{platform.machine()}'
8282
CURRENT_PLATFORM_KEYS = frozenset({CURRENT_PLATFORM})
8383

84+
RUNNER_ENV = {}
85+
DISABLE_JIT_ENV = {'GRAAL_PYTHON_VM_ARGS': '--experimental-options --engine.Compilation=false'}
86+
87+
# We leave the JIT enabled for the tests themselves, but disable it for subprocesses
88+
# noinspection PyUnresolvedReferences
89+
if IS_GRAALPY and __graalpython__.is_native and 'GRAAL_PYTHON_VM_ARGS' not in os.environ:
90+
try:
91+
subprocess.check_output([sys.executable, '--version'], env={**os.environ, **DISABLE_JIT_ENV})
92+
RUNNER_ENV = DISABLE_JIT_ENV
93+
except subprocess.CalledProcessError:
94+
pass
95+
8496

8597
class Logger:
8698
report_incomplete = sys.stdout.isatty()
@@ -926,6 +938,7 @@ def parse_config(cls, config_path: Path):
926938
if config_tags_dir := settings.get('tags_dir'):
927939
tags_dir = (config_path.parent / config_tags_dir).resolve()
928940
# Temporary hack for Bytecode DSL development in master branch:
941+
# noinspection PyUnresolvedReferences
929942
if IS_GRAALPY and getattr(__graalpython__, 'is_bytecode_dsl_interpreter', False) and tags_dir:
930943
new_tags_dir = (config_path.parent / (config_tags_dir + '_bytecode_dsl')).resolve()
931944
if new_tags_dir.exists():
@@ -999,6 +1012,7 @@ class TestSuite:
9991012
collected_tests: list['Test']
10001013

10011014
def run(self, result):
1015+
os.environ.update(RUNNER_ENV)
10021016
saved_path = sys.path[:]
10031017
sys.path[:] = self.pythonpath
10041018
try:

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,13 +1193,17 @@ def test__enablelegacywindowsfsencoding(self):
11931193

11941194
@support.requires_subprocess()
11951195
def test_orig_argv(self):
1196+
# GraalPy change: remove vars that could influence the test
1197+
env = os.environ.copy()
1198+
env.pop('GRAAL_PYTHON_ARGS', None)
1199+
env.pop('GRAAL_PYTHON_VM_ARGS', None)
11961200
code = textwrap.dedent('''
11971201
import sys
11981202
print(sys.argv)
11991203
print(sys.orig_argv)
12001204
''')
12011205
args = [sys.executable, '-I', '-X', 'utf8', '-c', code, 'arg']
1202-
proc = subprocess.run(args, check=True, capture_output=True, text=True)
1206+
proc = subprocess.run(args, check=True, capture_output=True, text=True, env=env)
12031207
expected = [
12041208
repr(['-c', 'arg']), # sys.argv
12051209
repr(args), # sys.orig_argv

0 commit comments

Comments
 (0)