tests/run-tests.py: Move tests to skip with native emitter to a list.

This makes `run-tests.py` a little more organised, by putting all the
tests-to-skip-when-using-the-native-emitter in a dedicated list.

This should make it easier to maintain the list, and understand why a test
is there.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-07-26 17:31:24 +10:00
parent 7e8705fe2b
commit c35427cbdb

View File

@@ -102,6 +102,48 @@ __import__('__injected_test')
# Platforms associated with the unix port, values of `sys.platform`.
PC_PLATFORMS = ("darwin", "linux", "win32")
# Tests to skip for specific emitters.
emitter_tests_to_skip = {
# Some tests are known to fail with native emitter.
# Remove them from the below when they work.
"native": (
# These require raise_varargs.
"basics/gen_yield_from_close.py",
"basics/try_finally_return2.py",
"basics/try_reraise.py",
"basics/try_reraise2.py",
"misc/features.py",
# These require checking for unbound local.
"basics/annotate_var.py",
"basics/del_deref.py",
"basics/del_local.py",
"basics/scope_implicit.py",
"basics/unboundlocal.py",
# These require "raise from".
"basics/exception_chain.py",
# These require proper traceback info.
"basics/sys_tracebacklimit.py",
"misc/print_exception.py",
"micropython/emg_exc.py",
"micropython/heapalloc_traceback.py",
"micropython/opt_level_lineno.py",
# These require stack-allocated slice optimisation.
"micropython/heapalloc_slice.py",
# These require running the scheduler.
"micropython/schedule.py",
"extmod/asyncio_event_queue.py",
"extmod/asyncio_iterator_event.py",
# These require sys.exc_info().
"misc/sys_exc_info.py",
# These require sys.settrace().
"misc/sys_settrace_features.py",
"misc/sys_settrace_generator.py",
"misc/sys_settrace_loop.py",
# These are bytecode-specific tests.
"stress/bytecode_limit.py",
),
}
# Tests to skip on specific targets.
# These are tests that are difficult to detect that they should not be run on the given target.
platform_tests_to_skip = {
@@ -824,6 +866,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
skip_tests.add("basics/exception_chain.py") # warning is not printed
skip_tests.add("micropython/meminfo.py") # output is very different to PC output
# Skip emitter-specific tests.
skip_tests.update(emitter_tests_to_skip.get(args.emit, ()))
# Skip platform-specific tests.
skip_tests.update(platform_tests_to_skip.get(args.platform, ()))
@@ -837,46 +882,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
# Works but CPython uses '\' path separator
skip_tests.add("import/import_file.py")
# Some tests are known to fail with native emitter
# Remove them from the below when they work
if args.emit == "native":
skip_tests.add("basics/gen_yield_from_close.py") # require raise_varargs
skip_tests.update(
{"basics/%s.py" % t for t in "try_reraise try_reraise2".split()}
) # require raise_varargs
skip_tests.add("basics/annotate_var.py") # requires checking for unbound local
skip_tests.add("basics/del_deref.py") # requires checking for unbound local
skip_tests.add("basics/del_local.py") # requires checking for unbound local
skip_tests.add("basics/exception_chain.py") # raise from is not supported
skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local
skip_tests.add("basics/sys_tracebacklimit.py") # requires traceback info
skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs
skip_tests.add("basics/unboundlocal.py") # requires checking for unbound local
skip_tests.add("misc/features.py") # requires raise_varargs
skip_tests.add(
"misc/print_exception.py"
) # because native doesn't have proper traceback info
skip_tests.add("misc/sys_exc_info.py") # sys.exc_info() is not supported for native
skip_tests.add("misc/sys_settrace_features.py") # sys.settrace() not supported
skip_tests.add("misc/sys_settrace_generator.py") # sys.settrace() not supported
skip_tests.add("misc/sys_settrace_loop.py") # sys.settrace() not supported
skip_tests.add(
"micropython/emg_exc.py"
) # because native doesn't have proper traceback info
skip_tests.add(
"micropython/heapalloc_slice.py"
) # because native doesn't do the stack-allocated slice optimisation
skip_tests.add(
"micropython/heapalloc_traceback.py"
) # because native doesn't have proper traceback info
skip_tests.add(
"micropython/opt_level_lineno.py"
) # native doesn't have proper traceback info
skip_tests.add("micropython/schedule.py") # native code doesn't check pending events
skip_tests.add("stress/bytecode_limit.py") # bytecode specific test
skip_tests.add("extmod/asyncio_event_queue.py") # native can't run schedule
skip_tests.add("extmod/asyncio_iterator_event.py") # native can't run schedule
def run_one_test(test_file):
test_file = test_file.replace("\\", "/")
test_file_abspath = os.path.abspath(test_file).replace("\\", "/")