Skip to content

Commit

Permalink
RegTest: Improve -maxframes option
Browse files Browse the repository at this point in the history
Grab the last N frames instead of first N. Better for showing crashes.
  • Loading branch information
stenzek committed Nov 11, 2024
1 parent 5caadec commit 596cca9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 13 additions & 15 deletions scripts/check_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div class=\"item\">")
write("<h1>{}</h1>".format(name))
write("<table width=\"100%\">")
first_fail = False

imguri1 = Path(path1).as_uri()
imguri2 = Path(path2).as_uri()
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))
for (framenum, path1, path2) in diff_frames[-MAX_DIFF_FRAMES:]:
if first_fail:
write("<div class=\"item\">")
write("<h1>{}</h1>".format(name))
write("<table width=\"100%\">")
first_fail = False

if len(diff_frames) == MAX_DIFF_FRAMES:
break
imguri1 = Path(path1).as_uri()
imguri2 = Path(path2).as_uri()
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 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
Expand Down
2 changes: 0 additions & 2 deletions scripts/run_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

0 comments on commit 596cca9

Please sign in to comment.