Skip to content

Commit 15d2fe8

Browse files
committed
tests: Add option to run-tests to enable native emitter.
1 parent 110ba35 commit 15d2fe8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ script:
2020
- make -C windows CROSS_COMPILE=i586-mingw32msvc-
2121

2222
- (cd tests && MICROPY_CPYTHON3=python3.3 ./run-tests)
23+
- (cd tests && MICROPY_CPYTHON3=python3.3 ./run-tests --emit native)
2324

2425
after_failure:
2526
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)

tests/run-tests

+16-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ def run_tests(pyb, tests, args):
3333
if os.getenv('TRAVIS') == 'true':
3434
skip_tests.add('basics/memoryerror.py')
3535

36+
# Some tests are known to fail with native emitter
37+
# Remove them from the below when they work
38+
if args.emit == 'native':
39+
skip_tests.update({'basics/%s.py' % t for t in 'bytes class_store_class class_super class_super_object closure1 closure2 closure_defargs compare_multi containment del_deref del_local del_name fun3 fun_calldblstar fun_callstar fun_callstardblstar fun_defargs fun_defargs2 fun_kwargs fun_kwonly fun_kwonlydef fun_kwvarargs fun_varargs gen_yield_from gen_yield_from_close gen_yield_from_ducktype gen_yield_from_exc gen_yield_from_iter gen_yield_from_send gen_yield_from_throw generator1 generator2 generator_args generator_close generator_closure generator_exc generator_return generator_send globals_del is_isnot string_format string_join subclass_native2_list subclass_native2_tuple subclass_native3 try2 try_as_var try_finally1 try_finally_loops try_finally_return try_reraise try_reraise2 unary_op unboundlocal with1 with_break with_continue with_return'.split()})
40+
skip_tests.add('float/string_format.py')
41+
skip_tests.add('import/gen_context.py')
42+
skip_tests.add('import/import_pkg1.py')
43+
skip_tests.add('io/file_with.py')
44+
skip_tests.add('micropython/heapalloc.py')
45+
skip_tests.add('micropython/viper.py')
46+
skip_tests.add('misc/features.py')
47+
skip_tests.add('misc/recursion.py')
48+
skip_tests.add('misc/rge_sm.py')
49+
3650
for test_file in tests:
3751
test_basename = os.path.basename(test_file)
3852
test_name = os.path.splitext(test_basename)[0]
@@ -67,7 +81,7 @@ def run_tests(pyb, tests, args):
6781
if pyb is None:
6882
# run on PC
6983
try:
70-
output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=bytecode', test_file])
84+
output_mupy = subprocess.check_output([MICROPYTHON, '-X', 'emit=' + args.emit, test_file])
7185
except subprocess.CalledProcessError:
7286
output_mupy = b'CRASH'
7387
else:
@@ -120,6 +134,7 @@ def main():
120134
cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard')
121135
cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)')
122136
cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython')
137+
cmd_parser.add_argument('--emit', default='bytecode', help='Micro Python emitter to use (bytecode or native)')
123138
cmd_parser.add_argument('files', nargs='*', help='input test files')
124139
args = cmd_parser.parse_args()
125140

0 commit comments

Comments
 (0)