Skip to content

Commit dcafb08

Browse files
committed
tests/run-perfbench.py: Skip large tests based on bm_params.
Signed-off-by: Damien George <damien@micropython.org>
1 parent dafae99 commit dcafb08

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

tests/run-perfbench.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import subprocess
99
import sys
1010
import argparse
11+
import re
1112
from glob import glob
1213

1314
from test_utils import (
@@ -120,6 +121,19 @@ def run_benchmarks(args, target, param_n, param_m, n_average, test_list):
120121
test_script += f.read()
121122
test_script += b"bm_run(%u, %u)\n" % (param_n, param_m)
122123

124+
# Search for the bm_params dict, to extract the minimum memory required.
125+
m = re.search(rb"bm_params = {\s+\((\d+), (\d+)\):", test_script)
126+
if not m:
127+
print(f"Test file '{test_file}' doesn't contain valid 'bm_params'")
128+
sys.exit(2)
129+
min_m = int(m.group(2))
130+
131+
# Skip the test if the target doesn't have enough memory.
132+
if param_m < min_m:
133+
test_results.append((test_file, "skip", "too large"))
134+
print("SKIP: too large")
135+
continue
136+
123137
# Write full test script if needed
124138
if 0:
125139
with open("%s.full" % test_file, "wb") as f:
@@ -314,14 +328,10 @@ def main():
314328
args.mpy_cross_flags = "-march=armv7m"
315329

316330
if len(args.files) == 0:
317-
tests_skip = ("benchrun.py",)
318-
if M <= 25:
319-
# These scripts are too big to be compiled by the target
320-
tests_skip += ("bm_chaos.py", "bm_hexiom.py", "misc_raytrace.py")
321331
tests = sorted(
322332
BENCH_SCRIPT_DIR + test_file
323333
for test_file in os.listdir(BENCH_SCRIPT_DIR)
324-
if test_file.endswith(".py") and test_file not in tests_skip
334+
if test_file.endswith(".py") and test_file != "benchrun.py"
325335
)
326336
else:
327337
tests = sorted(args.files)

0 commit comments

Comments
 (0)