From 596cca9be20b6b5d1e755b88740ada9920bcd6b2 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 11 Nov 2024 02:38:10 +1000 Subject: [PATCH] RegTest: Improve -maxframes option Grab the last N frames instead of first N. Better for showing crashes. --- scripts/check_regression_tests.py | 28 +++++++++++++--------------- scripts/run_regression_tests.py | 2 -- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/scripts/check_regression_tests.py b/scripts/check_regression_tests.py index 7ed4af3e4..4dc314edd 100644 --- a/scripts/check_regression_tests.py +++ b/scripts/check_regression_tests.py @@ -310,27 +310,25 @@ def check_regression_test(baselinedir, testdir, name): has_any = True if not compare_frames(path1, path2): - diff_frames.append(framenum) + diff_frames.append((framenum, path1, path2)) - if first_fail: - write("
") - write("

{}

".format(name)) - write("") - first_fail = False + for (framenum, path1, path2) in diff_frames[-MAX_DIFF_FRAMES:]: + if first_fail: + write("
") + write("

{}

".format(name)) + write("
") + first_fail = False - imguri1 = Path(path1).as_uri() - imguri2 = Path(path2).as_uri() - write("" % (framenum)) - write("" % (imguri1, imguri2)) - - if len(diff_frames) == MAX_DIFF_FRAMES: - break + imguri1 = Path(path1).as_uri() + imguri2 = Path(path2).as_uri() + write("" % (framenum)) + write("" % (imguri1, imguri2)) if not first_fail: write("
Frame %d
Frame %d
") - write("
Difference in frames [%s] for %s
" % (",".join(map(str, diff_frames)), name)) + write("
Difference in frames [%s] for %s
" % (",".join(map(lambda x: str(x[0]), diff_frames)), name)) write("
") - print("*** Difference in frames [%s] for %s" % (",".join(map(str, diff_frames)), name)) + print("*** Difference in frames [%s] for %s" % (",".join(map(lambda x: str(x[0]), diff_frames)), name)) #assert has_any return len(diff_frames) == 0 diff --git a/scripts/run_regression_tests.py b/scripts/run_regression_tests.py index d55ae50b8..657c73f40 100644 --- a/scripts/run_regression_tests.py +++ b/scripts/run_regression_tests.py @@ -55,8 +55,6 @@ def run_regression_tests(runner, gamedir, destdir, dump_interval, frames, parall for filename in pool.imap_unordered(func, gamepaths, chunksize=1): completed += 1 print("[%u%% %u/%u] %s" % ((completed * 100) // len(gamepaths), completed, len(gamepaths), filename)) - - pool.map(func, gamepaths, chunksize=1) pool.close()