Skip to content

Commit 1401fdb

Browse files
committed
tests/run-tests.py: Run tests-with-regex-output as normal tests.
Some tests (currently given by the `special_tests` list) have output which must be mached via a regex, because it can change from run to run (eg the address of an object is printed). These tests are currently classified as `is_special` in the test runner, which means they get special treatment. In particular they don't set the emitter as specified by `args.emit`. That means these tests do not run via .mpy or using the native emitter, even if those options are given on the command line. This commit fixes that by considering `is_special` as different to `tests_with_regex_output`. The former is used for things like target feature detection (which are not really tests) and when extra command line options need to be passed to the unix micropython executable. The latter (now called `tests_with_regex_output`) are specifically for tests that have output to be matched via regex. The `thread_exc2.py` test now needs to be excluded when running using the native emitter, because the native emitter doesn't print traceback info. And the `sys_settrace_cov.py` test needs to be excluded because set-trace output is different with the native emitter. Signed-off-by: Damien George <[email protected]>
1 parent c35427c commit 1401fdb

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/run-tests.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def open(self, path, mode):
127127
"micropython/emg_exc.py",
128128
"micropython/heapalloc_traceback.py",
129129
"micropython/opt_level_lineno.py",
130+
"thread/thread_exc2.py",
130131
# These require stack-allocated slice optimisation.
131132
"micropython/heapalloc_slice.py",
132133
# These require running the scheduler.
@@ -136,6 +137,7 @@ def open(self, path, mode):
136137
# These require sys.exc_info().
137138
"misc/sys_exc_info.py",
138139
# These require sys.settrace().
140+
"misc/sys_settrace_cov.py",
139141
"misc/sys_settrace_features.py",
140142
"misc/sys_settrace_generator.py",
141143
"misc/sys_settrace_loop.py",
@@ -392,7 +394,7 @@ def run_script_on_remote_target(pyb, args, test_file, is_special):
392394
return had_crash, output_mupy
393395

394396

395-
special_tests = [
397+
tests_with_regex_output = [
396398
base_path(file)
397399
for file in (
398400
"micropython/meminfo.py",
@@ -409,10 +411,7 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False):
409411
had_crash = False
410412
if pyb is None:
411413
# run on PC
412-
if (
413-
test_file_abspath.startswith((base_path("cmdline/"), base_path("feature_check/")))
414-
or test_file_abspath in special_tests
415-
):
414+
if test_file_abspath.startswith((base_path("cmdline/"), base_path("feature_check/"))):
416415
# special handling for tests of the unix cmdline program
417416
is_special = True
418417

@@ -544,7 +543,7 @@ def send_get(what):
544543
if is_special and not had_crash and b"\nSKIP\n" in output_mupy:
545544
return b"SKIP\n"
546545

547-
if is_special or test_file_abspath in special_tests:
546+
if is_special or test_file_abspath in tests_with_regex_output:
548547
# convert parts of the output that are not stable across runs
549548
with open(test_file + ".exp", "rb") as f:
550549
lines_exp = []

0 commit comments

Comments
 (0)