diff options
| author | Damien George <damien@micropython.org> | 2025-07-22 14:52:17 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-07-31 11:07:50 +1000 |
| commit | ff6491ded0ebaa7728ecba67c18641941885feb5 (patch) | |
| tree | 000edb8d789456c8e6bcb3f6902b5ca8e253df27 | |
| parent | a9b038a57e2ca730dd95e79fc89491d0d1154e6e (diff) | |
tests/run-natmodtests.py: Automatically skip tests that are too large.
This follows a similar change made for `run-tests.py` in commit
229104558fb7f9d283b7302bc3720bc35c5c49cf. 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>
| -rwxr-xr-x | tests/run-natmodtests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py index f9d2074f6..55adb6049 100755 --- a/tests/run-natmodtests.py +++ b/tests/run-natmodtests.py @@ -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", "")) |
