@@ -102,6 +102,50 @@ def open(self, path, mode):
102102# Platforms associated with the unix port, values of `sys.platform`.
103103PC_PLATFORMS = ("darwin" , "linux" , "win32" )
104104
105+ # Tests to skip for specific emitters.
106+ emitter_tests_to_skip = {
107+ # Some tests are known to fail with native emitter.
108+ # Remove them from the below when they work.
109+ "native" : (
110+ # These require raise_varargs.
111+ "basics/gen_yield_from_close.py" ,
112+ "basics/try_finally_return2.py" ,
113+ "basics/try_reraise.py" ,
114+ "basics/try_reraise2.py" ,
115+ "misc/features.py" ,
116+ # These require checking for unbound local.
117+ "basics/annotate_var.py" ,
118+ "basics/del_deref.py" ,
119+ "basics/del_local.py" ,
120+ "basics/scope_implicit.py" ,
121+ "basics/unboundlocal.py" ,
122+ # These require "raise from".
123+ "basics/exception_chain.py" ,
124+ # These require proper traceback info.
125+ "basics/sys_tracebacklimit.py" ,
126+ "misc/print_exception.py" ,
127+ "micropython/emg_exc.py" ,
128+ "micropython/heapalloc_traceback.py" ,
129+ "micropython/opt_level_lineno.py" ,
130+ "thread/thread_exc2.py" ,
131+ # These require stack-allocated slice optimisation.
132+ "micropython/heapalloc_slice.py" ,
133+ # These require running the scheduler.
134+ "micropython/schedule.py" ,
135+ "extmod/asyncio_event_queue.py" ,
136+ "extmod/asyncio_iterator_event.py" ,
137+ # These require sys.exc_info().
138+ "misc/sys_exc_info.py" ,
139+ # These require sys.settrace().
140+ "misc/sys_settrace_cov.py" ,
141+ "misc/sys_settrace_features.py" ,
142+ "misc/sys_settrace_generator.py" ,
143+ "misc/sys_settrace_loop.py" ,
144+ # These are bytecode-specific tests.
145+ "stress/bytecode_limit.py" ,
146+ ),
147+ }
148+
105149# Tests to skip on specific targets.
106150# These are tests that are difficult to detect that they should not be run on the given target.
107151platform_tests_to_skip = {
@@ -350,7 +394,7 @@ def run_script_on_remote_target(pyb, args, test_file, is_special):
350394 return had_crash , output_mupy
351395
352396
353- special_tests = [
397+ tests_with_regex_output = [
354398 base_path (file )
355399 for file in (
356400 "micropython/meminfo.py" ,
@@ -367,10 +411,7 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False):
367411 had_crash = False
368412 if pyb is None :
369413 # run on PC
370- if (
371- test_file_abspath .startswith ((base_path ("cmdline/" ), base_path ("feature_check/" )))
372- or test_file_abspath in special_tests
373- ):
414+ if test_file_abspath .startswith ((base_path ("cmdline/" ), base_path ("feature_check/" ))):
374415 # special handling for tests of the unix cmdline program
375416 is_special = True
376417
@@ -502,7 +543,7 @@ def send_get(what):
502543 if is_special and not had_crash and b"\n SKIP\n " in output_mupy :
503544 return b"SKIP\n "
504545
505- if is_special or test_file_abspath in special_tests :
546+ if is_special or test_file_abspath in tests_with_regex_output :
506547 # convert parts of the output that are not stable across runs
507548 with open (test_file + ".exp" , "rb" ) as f :
508549 lines_exp = []
@@ -824,6 +865,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
824865 skip_tests .add ("basics/exception_chain.py" ) # warning is not printed
825866 skip_tests .add ("micropython/meminfo.py" ) # output is very different to PC output
826867
868+ # Skip emitter-specific tests.
869+ skip_tests .update (emitter_tests_to_skip .get (args .emit , ()))
870+
827871 # Skip platform-specific tests.
828872 skip_tests .update (platform_tests_to_skip .get (args .platform , ()))
829873
@@ -837,46 +881,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
837881 # Works but CPython uses '\' path separator
838882 skip_tests .add ("import/import_file.py" )
839883
840- # Some tests are known to fail with native emitter
841- # Remove them from the below when they work
842- if args .emit == "native" :
843- skip_tests .add ("basics/gen_yield_from_close.py" ) # require raise_varargs
844- skip_tests .update (
845- {"basics/%s.py" % t for t in "try_reraise try_reraise2" .split ()}
846- ) # require raise_varargs
847- skip_tests .add ("basics/annotate_var.py" ) # requires checking for unbound local
848- skip_tests .add ("basics/del_deref.py" ) # requires checking for unbound local
849- skip_tests .add ("basics/del_local.py" ) # requires checking for unbound local
850- skip_tests .add ("basics/exception_chain.py" ) # raise from is not supported
851- skip_tests .add ("basics/scope_implicit.py" ) # requires checking for unbound local
852- skip_tests .add ("basics/sys_tracebacklimit.py" ) # requires traceback info
853- skip_tests .add ("basics/try_finally_return2.py" ) # requires raise_varargs
854- skip_tests .add ("basics/unboundlocal.py" ) # requires checking for unbound local
855- skip_tests .add ("misc/features.py" ) # requires raise_varargs
856- skip_tests .add (
857- "misc/print_exception.py"
858- ) # because native doesn't have proper traceback info
859- skip_tests .add ("misc/sys_exc_info.py" ) # sys.exc_info() is not supported for native
860- skip_tests .add ("misc/sys_settrace_features.py" ) # sys.settrace() not supported
861- skip_tests .add ("misc/sys_settrace_generator.py" ) # sys.settrace() not supported
862- skip_tests .add ("misc/sys_settrace_loop.py" ) # sys.settrace() not supported
863- skip_tests .add (
864- "micropython/emg_exc.py"
865- ) # because native doesn't have proper traceback info
866- skip_tests .add (
867- "micropython/heapalloc_slice.py"
868- ) # because native doesn't do the stack-allocated slice optimisation
869- skip_tests .add (
870- "micropython/heapalloc_traceback.py"
871- ) # because native doesn't have proper traceback info
872- skip_tests .add (
873- "micropython/opt_level_lineno.py"
874- ) # native doesn't have proper traceback info
875- skip_tests .add ("micropython/schedule.py" ) # native code doesn't check pending events
876- skip_tests .add ("stress/bytecode_limit.py" ) # bytecode specific test
877- skip_tests .add ("extmod/asyncio_event_queue.py" ) # native can't run schedule
878- skip_tests .add ("extmod/asyncio_iterator_event.py" ) # native can't run schedule
879-
880884 def run_one_test (test_file ):
881885 test_file = test_file .replace ("\\ " , "/" )
882886 test_file_abspath = os .path .abspath (test_file ).replace ("\\ " , "/" )
0 commit comments