diff --git a/scripts/campaign.py b/scripts/campaign.py index 090f24b83..de699b58d 100644 --- a/scripts/campaign.py +++ b/scripts/campaign.py @@ -1805,6 +1805,8 @@ def main(argv: Sequence[str] | None = None) -> int: scope.add_argument("--romfetch", default="", help=f"romfetch command (default: ${ROMFETCH_ENV}, else romfetch on PATH)") scope.add_argument("--offline", action="store_true", help="no buildbot, no romfetch, no build") + scope.add_argument("--content-file", default=str(CONTENT_FILE), + help="the test content list (default: tests/campaign/content.yml)") scope.add_argument("--allow-unsandboxed", action="store_true", help="run cores and builds without bubblewrap when it is missing (refused by default)") run_p = sub.add_parser("run", parents=[scope], help="one pass: cores, content, checks, rules") @@ -1862,6 +1864,8 @@ def main(argv: Sequence[str] | None = None) -> int: elif args.command == "references": settings = Settings(romfetch=args.romfetch, network=not args.offline, allow_unsandboxed=args.allow_unsandboxed) + if args.command in ("run", "references"): + paths.content_file = Path(args.content_file) campaign = Campaign(paths, settings) if args.command == "status": report = status_report(campaign) diff --git a/tests/test_campaign.py b/tests/test_campaign.py index 5fbd76cb1..f981cf3ed 100644 --- a/tests/test_campaign.py +++ b/tests/test_campaign.py @@ -882,6 +882,19 @@ class Findings(Workspace): self.assertIn("would commit 'chore: add campaign measurements'", out.getvalue()) +class ContentFile(Workspace): + def test_a_content_list_can_be_named(self) -> None: + other = self.tmp / "other.yml" + other.write_text(yaml.safe_dump({"systems": {"fake-system": { + "romfetch": "fakesys", "content": [{"name": "Other Game (Japan)", "catalog": "redump", + "reason": "r"}]}}}), encoding="utf-8") + out = io.StringIO() + with unittest.mock.patch.object(campaign.Paths, "default", return_value=self.paths), \ + contextlib.redirect_stdout(out): + self.assertEqual(campaign.main(["run", "--dry-run", "--content-file", str(other)]), 0) + self.assertIn("Other Game (Japan)", out.getvalue()) + + class InstallTimer(unittest.TestCase): def test_writes_the_units_and_enables_only_when_asked(self) -> None: calls = [] diff --git a/wiki/tools.md b/wiki/tools.md index eac3116e1..3fe00c65a 100644 --- a/wiki/tools.md +++ b/wiki/tools.md @@ -983,6 +983,7 @@ python scripts/campaign.py run --only beetle_psx,swanstation --dry-run python scripts/campaign.py run --commit --commit-every 10 python scripts/campaign.py run --only pcsx_rearmed --bench # with benchmarks python scripts/campaign.py references --only beetle_psx --system sony-playstation +python scripts/campaign.py references --only beetle_saturn --content-file other.yml # another content list python scripts/campaign.py status # done, failed, pending, and why python scripts/campaign.py findings # what waits for review python scripts/campaign.py gate # the checks behind a commit