Keep a Rust test in a file of its own as planted in a task-bench fix
This commit is contained in:
+12
-3
@@ -42,8 +42,10 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
|
||||
inline `#[cfg(test)]` module stands as the planted file has it, and the rest is as Haiku left it. Where the planted file has such
|
||||
modules and Haiku's file lacks one of them, or its modules cannot be told apart, the planted file stands whole; where the planted
|
||||
file has none, or its modules cannot be told apart, Haiku's stands. A Rust mutant whose file's modules cannot be told apart, as where two share a name or a brace, string or comment
|
||||
is never closed, is passed over. A Rust test in a file of its own, as `#[cfg(test)] mod tests;` names, counts, since the bench
|
||||
tells no such file from code.
|
||||
is never closed, is passed over. A Rust file that a `#[cfg(test)] mod name;` in another file of the planted tree names, as
|
||||
`src/name.rs` or `src/name/mod.rs` beside a `lib.rs`, `main.rs` or `mod.rs`, or in the folder of any other file's name, is a
|
||||
test: it stands as the planted tree has it, and no mutant is planted in it. A Rust mutant in a tree where such a declaration
|
||||
names no file there, as one that `#[path]` moves does, is passed over.
|
||||
|
||||
--image is the project's development image, such as golang:1.27.4. The bench adds Claude Code to it, as its installer installs it,
|
||||
so the image needs curl and bash; the result names the version. Haiku works in that image. So does --test: sh runs that text at
|
||||
@@ -200,7 +202,7 @@ from task_bench.tasks import Asked, Bench, BUG, check_made, committed, DATA_SOUR
|
||||
from task_bench.bugs.planted_mutant import bug_at_sides, Mutant
|
||||
from claude_code.reply import Claude
|
||||
from task_bench.bench_folder import clear_left, held
|
||||
from task_bench.runs import closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, TimedOut, TOKEN, WORK
|
||||
from task_bench.runs import closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, rust_test_files, TimedOut, TOKEN, WORK
|
||||
from task_bench.figures.digest import counted, digest, Run, TaskRuns
|
||||
from machine_load.slots import CPUS_PER_SLOT
|
||||
from git_cli.git_repo import default_ref, Git, top
|
||||
@@ -588,6 +590,13 @@ def planted(bench: Bench, number: int, mutant: Mutant) -> Task | Failure | None:
|
||||
# The check keeps a Rust file's test modules as planted, which it can only do where it tells them apart.
|
||||
if bugs is None or not all(tells_apart(mutant.path, source) for source in bugs.values()):
|
||||
return None
|
||||
# ... and a Rust test in a file of its own, which it can only keep where it finds each such file.
|
||||
if mutant.path.endswith(".rs"):
|
||||
standing = on_disk(f"find the Rust test files beside {mutant.path}", lambda: [rust_test_files(tree) for tree in bench.trees.values()])
|
||||
if isinstance(standing, Failure):
|
||||
return standing
|
||||
if any(tests is None or mutant.path in tests for tests in standing):
|
||||
return None
|
||||
trees: dict[Side, str] = {}
|
||||
messages: dict[Side, str] = {}
|
||||
for side, changed in bugs.items():
|
||||
|
||||
Reference in New Issue
Block a user