Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions scripts/pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,30 @@ def check(body, head, files, is_main_ancestor, *, test_only=False):
problems.append("**Regression run** needs an `xcl-smoke` block made on a commit of main (not the PR's), "
"with the same title and time as the PR's")
if clean:
pr = clean[-1]
problems += field_problems(pr, "the PR's")
for key in ("device removals", "crashes"):
if (number(pr.get(key)) or 0) > 0:
problems.append(f"the PR's regression run shows {key}: {pr.get(key)}")
if pr.get("exit", "").startswith("killed"):
problems.append("the PR's regression run did not end by itself (killed)")
if main:
m = next((b for b in main if b.get("title") == pr.get("title") and b.get("seconds") == pr.get("seconds")), None)
for b in [m] if m else main:
matched_main = []
for pr in clean:
problems += field_problems(pr, "the PR's")
for key in ("device removals", "crashes"):
if (number(pr.get(key)) or 0) > 0:
problems.append(f"the PR's regression run shows {key}: {pr.get(key)}")
if pr.get("exit", "").startswith("killed"):
problems.append("the PR's regression run did not end by itself (killed)")
if main:
m = next((b for b in main if b.get("title") == pr.get("title") and b.get("seconds") == pr.get("seconds")), None)
if m is not None:
if m not in matched_main:
matched_main.append(m)
problems += field_problems(m, "the main")
pf, mf = number(pr.get("frames shown")), number(m.get("frames shown"))
if mf and (pf is None or pf < FRAMES_KEPT * mf):
problems.append(f"the PR's run shows fewer frames than main's ({pf} against {mf})")
pc, mc = number(pr.get("peak commit")), number(m.get("peak commit"))
if pc and mc and pc > COMMIT_GROWTH * mc:
problems.append(f"the PR's run commits much more memory than main's ({pc} MB against {mc} MB)")
if main and not matched_main:
for b in main:
problems += field_problems(b, "the main")
if m is None:
problems.append("the main and PR regression runs are not of the same title for the same time")
else:
pf, mf = number(pr.get("frames shown")), number(m.get("frames shown"))
if mf and (pf is None or pf < FRAMES_KEPT * mf):
problems.append(f"the PR's run shows fewer frames than main's ({pf} against {mf})")
pc, mc = number(pr.get("peak commit")), number(m.get("peak commit"))
if pc and mc and pc > COMMIT_GROWTH * mc:
problems.append(f"the PR's run commits much more memory than main's ({pc} MB against {mc} MB)")
problems.append("the main and PR regression runs are not of the same title for the same time")
return problems


Expand Down
24 changes: 24 additions & 0 deletions scripts/test_pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,29 @@ def test_bare_bullets_and_html_comments_only_fail(self):
self.assertEqual(3, len(problems))


class MultiSmokeBlockTests(unittest.TestCase):
def test_earlier_pr_smoke_block_failures_are_not_hidden_by_a_later_clean_block(self):
files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")]
main_a = "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: A\nseconds: 60\nframes shown: 500\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n"
bad_pr_a = "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: A\nseconds: 60\nexit: killed (no exit)\nframes shown: 10\npeak commit: 9999 MB\ndevice removals: 2\ncrashes: 1\n```\n"
main_b = "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: B\nseconds: 60\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n"
good_pr_b = "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: B\nseconds: 60\nexit: 0x0\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n"
problems = check(BODY + main_a + bad_pr_a + main_b + good_pr_b, HEAD, files, lambda sha: sha == "1111111aaaa")
for expected in ("device removals: 2", "crashes: 1", "killed", "fewer frames", "more memory"):
self.assertTrue(any(expected in p for p in problems), (expected, problems))

def test_multiple_clean_pr_blocks_all_pass(self):
files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")]
run = "seconds: 60\nexit: 0x0\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n"
body = (
f"{BODY}"
f"```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: A\n{run}```\n"
f"```\nxcl-smoke v1\ncommit: 1234567890\ntitle: A\n{run}```\n"
f"```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: B\n{run}```\n"
f"```\nxcl-smoke v1\ncommit: 1234567890\ntitle: B\n{run}```\n"
)
self.assertEqual([], check(body, HEAD, files, lambda sha: sha == "1111111aaaa"))


if __name__ == "__main__":
unittest.main()
Loading