kopia lustrzana https://github.com/micropython/micropython
tests/micropython: Make import_mpy_native test run on all architectures.
Signed-off-by: Damien George <damien@micropython.org>pull/8701/head
rodzic
3180113aef
commit
80a86c48e3
|
@ -1,15 +1,17 @@
|
||||||
# test importing of .mpy files with native code (x64 only)
|
# test importing of .mpy files with native code
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import usys, uio, uos
|
import usys, uio, uos
|
||||||
|
|
||||||
|
usys.implementation._mpy
|
||||||
uio.IOBase
|
uio.IOBase
|
||||||
uos.mount
|
uos.mount
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
if not (usys.platform == "linux" and usys.maxsize > 2**32):
|
mpy_arch = usys.implementation._mpy >> 8
|
||||||
|
if mpy_arch == 0:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
@ -49,15 +51,14 @@ class UserFS:
|
||||||
|
|
||||||
|
|
||||||
# these are the test .mpy files
|
# these are the test .mpy files
|
||||||
|
valid_header = bytes([77, 6, mpy_arch, 31])
|
||||||
# fmt: off
|
# fmt: off
|
||||||
user_files = {
|
user_files = {
|
||||||
# bad architecture
|
# bad architecture
|
||||||
'/mod0.mpy': b'M\x06\xfc\x00\x10',
|
'/mod0.mpy': b'M\x06\xfc\x1f',
|
||||||
|
|
||||||
# test loading of viper and asm
|
# test loading of viper and asm
|
||||||
'/mod1.mpy': (
|
'/mod1.mpy': valid_header + (
|
||||||
b'M\x06\x08\x1f' # header
|
|
||||||
|
|
||||||
b'\x02' # n_qstr
|
b'\x02' # n_qstr
|
||||||
b'\x00' # n_obj
|
b'\x00' # n_obj
|
||||||
|
|
||||||
|
@ -84,9 +85,7 @@ user_files = {
|
||||||
),
|
),
|
||||||
|
|
||||||
# test loading viper with additional scope flags and relocation
|
# test loading viper with additional scope flags and relocation
|
||||||
'/mod2.mpy': (
|
'/mod2.mpy': valid_header + (
|
||||||
b'M\x06\x08\x1f' # header
|
|
||||||
|
|
||||||
b'\x02' # n_qstr
|
b'\x02' # n_qstr
|
||||||
b'\x00' # n_obj
|
b'\x00' # n_obj
|
||||||
|
|
Ładowanie…
Reference in New Issue