Test a shipped feature's binary file, linked test, removed test and passing test, a checkout that drops a diff's prefixes, and a bench run from a folder inside the checkout

This commit is contained in:
2026-11-24 00:54:52 +01:00
parent 74ffd6da53
commit 7e4854bd8e
2 changed files with 77 additions and 20 deletions
+7 -2
View File
@@ -81,7 +81,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned
for feature in shipped.found:
if len(tasks) == count:
break
folder = bench.folder / "shipped-features" / "-".join(feature.name.replace(",", "").split())
folder = bench.folder / "shipped-features" / folder_name(feature.name)
taken_out = on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder))
why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature)
if isinstance(why, Failure):
@@ -97,6 +97,11 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned
return Planned(tasks, [f"Passed over {line}" for line in passed_over], {})
def folder_name(name: str) -> str:
"""The folder that keeps the trees of the feature called name: `items-7-8` for `items 7, 8`."""
return "-".join(name.replace(",", "").split())
class TakenOut(typing.NamedTuple):
"""A shipped feature taken out of the bench's trees: each side's tree without it, committed once, and the feature that
builds it there again."""
@@ -112,7 +117,7 @@ def without(bench: Bench, shipped: Shipped, records: list[str], folder: pathlib.
Raises OSError where a file cannot be copied."""
change = (shipped.before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records))
# A path that is not UTF-8 is replaced, so the head's tree doesn't hold it and it is left out.
names = bench.git("diff", "--name-only", "-z", *PLAIN_DIFF, *change, cwd=bench.checkout, errors="replace")
names = bench.git("diff", "--name-only", "-z", *change, cwd=bench.checkout, errors="replace")
if isinstance(names, Failure):
return names
tests = [path for path in names.split("\x00") if path and of_tests(path) and os.path.lexists(os.path.join(bench.trees["head"], path))]