aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Mussared2019-08-19 10:59:27 +1000
committerDamien George2019-08-20 15:14:08 +1000
commit0bd1eb80ff49dd0d4ad0c369a83a5aadea995944 (patch)
tree49befa6047dd9e86e28b78675800f0678aa85cc6 /tests
parent4ab5156c01bfd4a6304e26b1dc2d34163b8637c0 (diff)
qemu-arm: Add testing of frozen native modules.
- Split 'qemu-arm' from 'unix' for generating tests. - Add frozen module to the qemu-arm test build. - Add test that reproduces the requirement to half-word align native function data.
Diffstat (limited to 'tests')
-rw-r--r--tests/qemu-arm/native_test.py5
-rw-r--r--tests/qemu-arm/native_test.py.exp3
-rwxr-xr-xtests/run-tests27
3 files changed, 25 insertions, 10 deletions
diff --git a/tests/qemu-arm/native_test.py b/tests/qemu-arm/native_test.py
new file mode 100644
index 000000000..0b58433d9
--- /dev/null
+++ b/tests/qemu-arm/native_test.py
@@ -0,0 +1,5 @@
+import native_frozen_align
+
+native_frozen_align.native_x(1)
+native_frozen_align.native_y(2)
+native_frozen_align.native_z(3)
diff --git a/tests/qemu-arm/native_test.py.exp b/tests/qemu-arm/native_test.py.exp
new file mode 100644
index 000000000..dcf37cd5e
--- /dev/null
+++ b/tests/qemu-arm/native_test.py.exp
@@ -0,0 +1,3 @@
+2
+3
+4
diff --git a/tests/run-tests b/tests/run-tests
index 9f74c1cfc..c45d2787e 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -349,6 +349,8 @@ def run_tests(pyb, tests, args, base_path="."):
for t in tests:
if t.startswith('basics/io_'):
skip_tests.add(t)
+ elif args.target == 'qemu-arm':
+ skip_tests.add('misc/print_exception.py') # requires sys stdfiles
# Some tests are known to fail on 64-bit machines
if pyb is None and platform.architecture()[0] == '64bit':
@@ -527,8 +529,9 @@ the last matching regex is used:
cmd_parser.add_argument('files', nargs='*', help='input test files')
args = cmd_parser.parse_args()
+ LOCAL_TARGETS = ('unix', 'qemu-arm',)
EXTERNAL_TARGETS = ('pyboard', 'wipy', 'esp8266', 'esp32', 'minimal', 'nrf')
- if args.target == 'unix' or args.list_tests:
+ if args.target in LOCAL_TARGETS or args.list_tests:
pyb = None
elif args.target in EXTERNAL_TARGETS:
global pyboard
@@ -537,24 +540,28 @@ the last matching regex is used:
pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password)
pyb.enter_raw_repl()
else:
- raise ValueError('target must be either %s or unix' % ", ".join(EXTERNAL_TARGETS))
+ raise ValueError('target must be one of %s' % ", ".join(LOCAL_TARGETS + EXTERNAL_TARGETS))
if len(args.files) == 0:
if args.test_dirs is None:
+ test_dirs = ('basics', 'micropython', 'misc', 'extmod',)
if args.target == 'pyboard':
# run pyboard tests
- test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm')
+ test_dirs += ('float', 'stress', 'pyb', 'pybnative', 'inlineasm')
elif args.target in ('esp8266', 'esp32', 'minimal', 'nrf'):
- test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod')
+ test_dirs += ('float',)
elif args.target == 'wipy':
# run WiPy tests
- test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy')
- else:
+ test_dirs += ('wipy',)
+ elif args.target == 'unix':
# run PC tests
- test_dirs = (
- 'basics', 'micropython', 'float', 'import', 'io', 'misc',
- 'stress', 'unicode', 'extmod', 'unix', 'cmdline',
- )
+ test_dirs += ('float', 'import', 'io', 'stress', 'unicode', 'unix', 'cmdline',)
+ elif args.target == 'qemu-arm':
+ if not args.write_exp:
+ raise ValueError('--target=qemu-arm must be used with --write-exp')
+ # Generate expected output files for qemu run.
+ # This list should match the test_dirs tuple in tinytest-codegen.py.
+ test_dirs += ('float', 'inlineasm', 'qemu-arm',)
else:
# run tests from these directories
test_dirs = args.test_dirs