diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfdd78a9ec..73381c5b20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,8 +20,8 @@ checked before anything else; a PR that does not meet them waits (or is closed a 3. **A PR that changes the runtime** (`crates/xcl/src` outside tests) **has a regression run on a real title**: `scripts/smoke.ps1 -Game ` built from `main` and built from the PR's head commit, both `xcl-smoke` blocks pasted under **Regression run**, of the same title for the same - time. The PR's block must name its head commit with no uncommitted changes (rerun it after every - push); the other must be made on a commit of `main`. The PR's run must show no device removal and + time. Both runs need clean checkouts. The PR's block must name its head commit (rerun it after every + push), and the other must name a commit of `main`. The PR's run must show no device removal and no crash (the `main` run may: a PR that fixes a crash shows it there), at least 80 % of `main`'s frames and at most 125 % of its peak commit. A run on a title that does not reach the code the PR changes still counts as a regression check; say what it does not cover under **Not tested**. diff --git a/scripts/pr_check.py b/scripts/pr_check.py index 2c624773c6..c8b43fbe78 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -93,10 +93,10 @@ def check(body, head, files, is_main_ancestor, *, test_only=False): if not clean: problems.append(f"the PR changes the runtime: **Regression run** needs an `xcl-smoke` block made on this PR's " f"head commit {head[:12]} with no uncommitted changes (rerun scripts/smoke.ps1 after every push)") - main = [b for b in base if is_main_ancestor(b["commit"].split()[0])] + main = [b for b in base if "uncommitted" not in b["commit"] and is_main_ancestor(b["commit"].split()[0])] if not main: - 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") + problems.append("**Regression run** needs an `xcl-smoke` block from a clean checkout of main, " + "using the same title and time as the PR's") if clean: pr = clean[-1] for key in ("device removals", "crashes"): diff --git a/scripts/test_pr_check.py b/scripts/test_pr_check.py index f1d6c2c8f4..87f69c72e2 100644 --- a/scripts/test_pr_check.py +++ b/scripts/test_pr_check.py @@ -49,6 +49,20 @@ def test_test_paths_do_not_need_approval(self): class SmokeBlockTests(unittest.TestCase): + def test_main_baseline_must_have_no_uncommitted_changes(self): + baseline = "xcl-smoke v1\ncommit: 1111111aaaa{}\ntitle: G\nseconds: 60\n" + head = "xcl-smoke v1\ncommit: 1234567890\ntitle: G\nseconds: 60\n" + files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")] + is_main_ancestor = lambda sha: sha == "1111111aaaa" + + dirty = baseline.format(" (uncommitted changes)") + problems = check(BODY + dirty + head, HEAD, files, is_main_ancestor) + self.assertEqual(1, len(problems), problems) + self.assertIn("clean checkout of main", problems[0]) + + clean = baseline.format("") + self.assertEqual([], check(BODY + dirty + clean + head, HEAD, files, is_main_ancestor)) + def test_two_blocks_in_one_fence_are_two_blocks(self): body = ("```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: G\nseconds: 60\n\n" "xcl-smoke v1\ncommit: 1234567890\ntitle: G\nseconds: 60\n```\n")