From 50f9dd7f5f6b188e28b3bceb5514951e4ff23717 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:17:09 +0100 Subject: [PATCH] fix: pr checklist generates the site first validate.yml generates the pages before the suite, and the site tests fail on a clone without them. --- CONTRIBUTING.md | 1 + scripts/generate_readme.py | 1 + tests/test_doc_surfaces.py | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7f1dafdcf..2fa3a8ece 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,6 +68,7 @@ python scripts/validate_pr.py --changed # the BIOS files the branch add python scripts/validate_schemas.py --source-only # profiles and platform files python scripts/profile_sync.py --changed --strict # each profile the branch adds or edits python scripts/refresh_data_dirs.py # data directories the pack-building tests read +python scripts/generate_site.py # the pages the site tests read python -m unittest discover -s tests -t . ``` diff --git a/scripts/generate_readme.py b/scripts/generate_readme.py index cf3a1fea1..aba4e9c9f 100644 --- a/scripts/generate_readme.py +++ b/scripts/generate_readme.py @@ -975,6 +975,7 @@ python scripts/validate_pr.py --changed # the BIOS files the branch add python scripts/validate_schemas.py --source-only # profiles and platform files python scripts/profile_sync.py --changed --strict # each profile the branch adds or edits python scripts/refresh_data_dirs.py # data directories the pack-building tests read +python scripts/generate_site.py # the pages the site tests read python -m unittest discover -s tests -t . ``` diff --git a/tests/test_doc_surfaces.py b/tests/test_doc_surfaces.py index 6431b3afd..d7cee518a 100644 --- a/tests/test_doc_surfaces.py +++ b/tests/test_doc_surfaces.py @@ -364,6 +364,24 @@ class ContributorChecksMatchCi(unittest.TestCase): workflow.index("python -m unittest discover"), ) + def test_the_pr_checklist_generates_the_site_before_the_tests(self): + # validate.yml generates the pages before the suite. Without them + # the 228 tests that read the gitignored pages fail on a clone. + workflow = _read(".github/workflows/validate.yml") + self.assertLess( + workflow.index("run: python scripts/generate_site.py"), + workflow.index("python -m unittest discover"), + ) + for text in ( + contributing_text(lambda page: page, "# C", "here"), + _read("CONTRIBUTING.md"), + ): + block = _section(text, "## Before opening a PR") + self.assertIn("python scripts/generate_site.py", block) + self.assertLess( + block.index("generate_site.py"), block.index("unittest discover") + ) + class PagesOpenOnTheirContent(unittest.TestCase): """The download page said "This page picks the right pack for a setup" @@ -382,3 +400,31 @@ class PagesOpenOnTheirContent(unittest.TestCase): if __name__ == "__main__": unittest.main() + + +class CoreCountsReadFromTheData(unittest.TestCase): + """The cores page said "623 cores across 18 platforms": that was every + profile, and 91 of them no platform runs.""" + + def test_the_run_count_is_what_the_platforms_resolve(self): + import yaml + from common import load_emulator_profiles, load_platform_config, resolve_platform_cores + + from tests import sitepages + + sitepages.require() + text = sitepages.page("cross-reference.md").read_text(encoding="utf-8") + profiles = load_emulator_profiles(str(REPO_ROOT / "emulators")) + unique = {k: v for k, v in profiles.items() if v.get("type") not in ("alias", "test")} + registry = yaml.safe_load((REPO_ROOT / "platforms" / "_registry.yml").read_text( + encoding="utf-8"))["platforms"] + run = set() + for name in registry: + config = load_platform_config(name, str(REPO_ROOT / "platforms")) + run |= set(resolve_platform_cores(config, unique)) + said = re.search(r"([\d,]+) cores are profiled, ([\d,]+) of them run by the (\d+) platforms", + text) + self.assertIsNotNone(said, "the page says how many profiled cores the platforms run") + self.assertEqual(int(said[1].replace(",", "")), len(unique)) + self.assertEqual(int(said[2].replace(",", "")), len(run)) + self.assertEqual(int(said[3]), len(registry))