tests/run-natmodtests.py: Automatically skip tests that are too large.
This follows a similar change made for `run-tests.py` in commit
229104558f. The change here uses the same
logic to detect if a natmod test is too big for the target (eg overflows
(I)RAM loading the native .mpy), by printing "START TEST" at the start of
the test.
Typical output is now something like this:
...
pass extmod/random_basic.py
pass extmod/random_extra_float.py
pass extmod/random_extra.py
SKIP extmod/random_seed_default.py
LRGE extmod/re1.py
SKIP extmod/re_debug.py
pass extmod/re_error.py
pass extmod/re_group.py
pass extmod/re_groups.py
...
and the tests that are too large are reported at the end, and written to
the `_result.json` file.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
a9b038a57e
commit
ff6491ded0
1 changed files with 13 additions and 0 deletions
|
|
@ -170,6 +170,7 @@ def run_tests(target_truth, target, args, resolved_arch):
|
|||
print("skip {} - mpy file not compiled".format(test_file))
|
||||
continue
|
||||
test_script += bytes(injected_import_hook_code.format(test_module), "ascii")
|
||||
test_script += b"print('START TEST')\n"
|
||||
test_script += test_file_data
|
||||
|
||||
# Run test under MicroPython
|
||||
|
|
@ -177,8 +178,18 @@ def run_tests(target_truth, target, args, resolved_arch):
|
|||
|
||||
# Work out result of test
|
||||
extra = ""
|
||||
result_out = result_out.removeprefix(b"START TEST\n")
|
||||
if error is None and result_out == b"SKIP\n":
|
||||
result = "SKIP"
|
||||
elif (
|
||||
error is not None
|
||||
and error.args[0] == "exception"
|
||||
and error.args[1] == b""
|
||||
and b"MemoryError" in error.args[2]
|
||||
):
|
||||
# Test had a MemoryError before anything (should be at least "START TEST")
|
||||
# was printed, so the test is too big for the target.
|
||||
result = "LRGE"
|
||||
elif error is not None:
|
||||
result = "FAIL"
|
||||
extra = " - " + str(error)
|
||||
|
|
@ -203,6 +214,8 @@ def run_tests(target_truth, target, args, resolved_arch):
|
|||
test_results.append((test_file, "pass", ""))
|
||||
elif result == "SKIP":
|
||||
test_results.append((test_file, "skip", ""))
|
||||
elif result == "LRGE":
|
||||
test_results.append((test_file, "skip", "too large"))
|
||||
else:
|
||||
test_results.append((test_file, "fail", ""))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue