RegTest: Improve -maxframes option

Grab the last N frames instead of first N. Better for showing crashes.
This commit is contained in:
Stenzek 2024-11-11 02:38:10 +10:00
parent 5caadec34d
commit 596cca9be2
No known key found for this signature in database
2 changed files with 13 additions and 17 deletions

View File

@ -310,8 +310,9 @@ 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))
for (framenum, path1, path2) in diff_frames[-MAX_DIFF_FRAMES:]:
if first_fail:
write("<div class=\"item\">")
write("<h1>{}</h1>".format(name))
@ -323,14 +324,11 @@ def check_regression_test(baselinedir, testdir, name):
write("<tr><td colspan=\"2\">Frame %d</td></tr>" % (framenum))
write("<tr><td><img class=\"before\" src=\"%s\" /></td><td><img class=\"after\" src=\"%s\" /></td></tr>" % (imguri1, imguri2))
if len(diff_frames) == MAX_DIFF_FRAMES:
break
if not first_fail:
write("</table>")
write("<pre>Difference in frames [%s] for %s</pre>" % (",".join(map(str, diff_frames)), name))
write("<pre>Difference in frames [%s] for %s</pre>" % (",".join(map(lambda x: str(x[0]), diff_frames)), name))
write("</div>")
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

View File

@ -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()