Skip to content

Commit 80a86c4

Browse files
committed
tests/micropython: Make import_mpy_native test run on all architectures.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 3180113 commit 80a86c4

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

tests/micropython/import_mpy_native_x64.py renamed to tests/micropython/import_mpy_native.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# test importing of .mpy files with native code (x64 only)
1+
# test importing of .mpy files with native code
22

33
try:
44
import usys, uio, uos
55

6+
usys.implementation._mpy
67
uio.IOBase
78
uos.mount
89
except (ImportError, AttributeError):
910
print("SKIP")
1011
raise SystemExit
1112

12-
if not (usys.platform == "linux" and usys.maxsize > 2**32):
13+
mpy_arch = usys.implementation._mpy >> 8
14+
if mpy_arch == 0:
1315
print("SKIP")
1416
raise SystemExit
1517

@@ -49,15 +51,14 @@ def open(self, path, mode):
4951

5052

5153
# these are the test .mpy files
54+
valid_header = bytes([77, 6, mpy_arch, 31])
5255
# fmt: off
5356
user_files = {
5457
# bad architecture
55-
'/mod0.mpy': b'M\x06\xfc\x00\x10',
58+
'/mod0.mpy': b'M\x06\xfc\x1f',
5659

5760
# test loading of viper and asm
58-
'/mod1.mpy': (
59-
b'M\x06\x08\x1f' # header
60-
61+
'/mod1.mpy': valid_header + (
6162
b'\x02' # n_qstr
6263
b'\x00' # n_obj
6364

@@ -84,9 +85,7 @@ def open(self, path, mode):
8485
),
8586

8687
# test loading viper with additional scope flags and relocation
87-
'/mod2.mpy': (
88-
b'M\x06\x08\x1f' # header
89-
88+
'/mod2.mpy': valid_header + (
9089
b'\x02' # n_qstr
9190
b'\x00' # n_obj
9291

File renamed without changes.

0 commit comments

Comments
 (0)