Skip to content

Commit 8616eb9

Browse files
author
rocky
committed
Add first graal bytecode tests
1 parent 241bc1e commit 8616eb9

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

test/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ check: check-short check-roundtrip
2525
--bytecode-3.11 --bytecode-3.12 --bytecode-3.13 \
2626
--bytecode-2.7pypy --bytecode-3.2pypy \
2727
--bytecode-pypy35 --bytecode-pypy36 --bytecode-pypy37 \
28-
--bytecode-pypy38 --bytecode-pypy39 --bytecode-pypy310 $(COMPILE)
28+
--bytecode-pypy38 --bytecode-pypy39 --bytecode-pypy310 \
29+
--bytecode-graal312 $(COMPILE)
2930

3031
check-roundtrip:
3132
./test_pyc_roundtrip.py --quiet \

test/add-test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
""" Trivial helper program to byte compile and run ``dismasm`` on the bytecode file.
33
"""
44
import os
5+
import platform
56
import py_compile
67
import sys
78

@@ -24,9 +25,13 @@
2425
if short.endswith(".py"):
2526
short = short[:-3]
2627

27-
if hasattr(sys, "pypy_version_info"):
28-
version = version_tuple_to_str(end=2, delimiter="")
28+
python_implementation = platform.python_implementation()
29+
version = version_tuple_to_str(end=2, delimiter="")
30+
if python_implementation == "PyPy":
2931
bytecode = "bytecode_pypy%s/%s.pypy%s.pyc" % (version, short, version)
32+
elif python_implementation == "GraalVM":
33+
bytecode = "bytecode_graal%s/%s.graalpy%s.pyc" % (version, short, version)
34+
3035
else:
3136
version = version_tuple_to_str(end=2)
3237
bytecode = "bytecode_%s/%s.pyc" % (version, short)
455 Bytes
Binary file not shown.
455 Bytes
Binary file not shown.
456 Bytes
Binary file not shown.

test/test_pythonlib.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def get_srcdir():
9999
3.5,
100100
"3.2pypy",
101101
"2.7pypy",
102+
"3.12graal",
102103
3.6,
103104
3.7,
104105
3.8,
@@ -134,6 +135,15 @@ def get_srcdir():
134135
key = f"bytecode-pypy{vers_dot}"
135136
test_options[key] = (os.path.join(src_dir, bytecode), PYOC, bytecode, vers_dot)
136137

138+
for vers, vers_dot in (
139+
(312, 3.12),
140+
):
141+
bytecode = f"bytecode_graal{vers}"
142+
key = f"bytecode-graal{vers}"
143+
test_options[key] = (os.path.join(src_dir, bytecode), PYOC, bytecode, vers_dot)
144+
key = f"bytecode-pypy{vers_dot}"
145+
test_options[key] = (os.path.join(src_dir, bytecode), PYOC, bytecode, vers_dot)
146+
137147

138148
# -----
139149

0 commit comments

Comments
 (0)