summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-12-02 16:27:24 +1100
committerDamien George <damien.p.george@gmail.com>2019-12-12 20:15:28 +1100
commit111d1ffb6473950274bb506e1a27c01b33ea3d61 (patch)
treeeaf16af5158f007d1d36d31a389343dc9c3f3cb0
parentabc642973db46fbce7494d34ea0ef2539b339be0 (diff)
tests/import: Add test for importing viper code with additional flags.
-rw-r--r--tests/import/mpy_native.py21
-rw-r--r--tests/import/mpy_native.py.exp1
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/import/mpy_native.py b/tests/import/mpy_native.py
index c33b3350c..4ee537f4a 100644
--- a/tests/import/mpy_native.py
+++ b/tests/import/mpy_native.py
@@ -73,6 +73,27 @@ user_files = {
b'\x00\x00\x00\x00\x00\x00\x00\x00' # dummy machine code
b'\x00\x00\x00' # scope_flags, n_pos_args, type_sig
),
+
+ # test loading viper with additional scope flags and relocation
+ '/mod2.mpy': (
+ b'M\x05\x0b\x1f\x20' # header
+
+ b'\x20' # n bytes, bytecode
+ b'\x00\x08\x02m\x02m' # prelude
+ b'\x51' # LOAD_CONST_NONE
+ b'\x63' # RETURN_VALUE
+
+ b'\x00\x01' # n_obj, n_raw_code
+
+ b'\x12' # n bytes(=4), viper code
+ b'\x00\x00\x00\x00' # dummy machine code
+ b'\x00' # n_qstr
+ b'\x70' # scope_flags: VIPERBSS | VIPERRODATA | VIPERRELOC
+ b'\x00\x00' # n_obj, n_raw_code
+ b'\x06rodata' # rodata, 6 bytes
+ b'\x04' # bss, 4 bytes
+ b'\x03\x01\x00' # dummy relocation of rodata
+ ),
}
# create and mount a user filesystem
diff --git a/tests/import/mpy_native.py.exp b/tests/import/mpy_native.py.exp
index b73812094..320cac09d 100644
--- a/tests/import/mpy_native.py.exp
+++ b/tests/import/mpy_native.py.exp
@@ -1,2 +1,3 @@
mod0 ValueError incompatible .mpy arch
mod1 OK
+mod2 OK