parity: leave out of the prebuild probes that no longer exist

A record naming an example since renamed or deleted made the whole Cargo
run fail ("no example target named ..."), so no probe was prebuilt and
every harness built its own: the probe binaries rename ~250 of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-23 16:30:27 +02:00
parent ac54227465
commit 7c42cc63ce
2 changed files with 11 additions and 4 deletions
+4 -1
View File
@@ -35,10 +35,13 @@ class ParityRunnerTests(unittest.TestCase):
*parity.artifacts_of(["cargo", "build", "--release", "-p", "horizon-world", "--bin", "horizon-world"]),
*parity.artifacts_of(["cargo", "build", "--release", "--bin", "horizon-world"]),
*parity.artifacts_of(["cargo", "run", "--profile", "fast", "-p", "horizon-client", "--example", "c"]),
*parity.artifacts_of(["cargo", "build", "--release", "-p", "horizon-world", "--example", "renamed"]),
["example", "old", "release"], # recorded before selections were kept: its own crate's -p
["example", "unknown", "release"], # no longer in the workspace: left to its harness
]
self.assertEqual(parity.prebuild_commands(artifacts, {("example", "old"): "horizon-world"}), [
packages = {("example", "a"): "horizon-world", ("example", "b"): "horizon-world", ("example", "c"): "horizon-client",
("bin", "horizon-world"): "horizon-world", ("example", "old"): "horizon-world"}
self.assertEqual(parity.prebuild_commands(artifacts, packages), [
["cargo", "build", "--locked", "--profile", "fast", "-p", "horizon-client", "--example", "c"],
["cargo", "build", "--locked", "--profile", "release", "--bin", "horizon-world"],
["cargo", "build", "--locked", "--profile", "release", "-p", "horizon-world", "--bin", "horizon-world"],
+7 -3
View File
@@ -555,10 +555,14 @@ def prebuild_commands(artifacts, packages=None):
"""The Cargo runs that build the recorded probes exactly as their harnesses do: one per profile, package and
feature selection, and whether examples are among the command's targets (see artifacts_of).
A [kind, name, profile] record from before selections were kept is taken as built with `-p` and its own crate,
as nearly every harness does (packages: target_packages()); the harness's next run records the real one."""
packages: target_packages(). Records of targets that no longer exist (a probe renamed or deleted since a harness
ran it) are left out, since one unknown target fails its whole Cargo run. A [kind, name, profile] record from
before selections were kept is taken as built with `-p` and its own crate, as nearly every harness does; the
harness's next run records the real one."""
groups = {}
for artifact in artifacts:
if packages and artifact[1] and tuple(artifact[:2]) not in packages:
continue
if len(artifact) == 3 and (packages or {}).get(tuple(artifact[:2])):
kind, name, profile = artifact
artifact = [kind, name, profile, ["-p", packages[(kind, name)]], kind == "example"]
@@ -578,7 +582,7 @@ def prebuild(artifacts, jobs):
environment = run_environment()
environment["CARGO_BUILD_JOBS"] = str(jobs)
errors = ""
packages = target_packages() if any(len(artifact) == 3 for artifact in artifacts) else None
packages = target_packages()
for command in prebuild_commands(artifacts, packages):
result = subprocess.run(command, cwd=ROOT, env=environment, capture_output=True, text=True)
if result.returncode: