harness v1.3: create repo/ symlink inside run_tests (after clean_state)
Browse files- scripts/verify.py +14 -11
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (v1.
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -41,6 +41,11 @@ repo/Cargo.toml) from the upstream /testbed/repo convention -- a self-symlink no
|
|
| 41 |
makes both layouts resolve. Context expansion skips test files referenced by the
|
| 42 |
test_patch that don't exist on disk instead of crashing the row (eza 0070).
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
Usage (inside a job with the right language toolchain image):
|
| 45 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 46 |
"""
|
|
@@ -238,6 +243,14 @@ def run_tests(row, repo_dir, lang, phase_tag=""):
|
|
| 238 |
"""Run rebuild_cmds, test_cmds, print_cmds, then collect the report files the
|
| 239 |
test frameworks wrote (surefire/gradle XML, gradle HTML, reports/*) and feed
|
| 240 |
them to the log parser. Returns (tests_dict, combined_output_tail)."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
disk_guard(f"{phase_tag}-pre")
|
| 242 |
parser = get_parser(row)
|
| 243 |
dep_err = ensure_js_deps(repo_dir)
|
|
@@ -343,16 +356,6 @@ def verify_row(row, lang):
|
|
| 343 |
return rec
|
| 344 |
log_disk(f"cloned:{row['id']}")
|
| 345 |
|
| 346 |
-
# v1.2: some rows reference a nested repo/ layout (e.g. test_cmds using
|
| 347 |
-
# "cd repo" or paths ending in /repo) that our flat clone does not have.
|
| 348 |
-
# Create a self-symlink so both layouts resolve; idempotent on reruns.
|
| 349 |
-
_cmds = (row.get("test_cmds") or []) + (row.get("rebuild_cmds") or []) + (row.get("print_cmds") or [])
|
| 350 |
-
if any(("repo/" in c) or c.rstrip().endswith("/repo") for c in _cmds):
|
| 351 |
-
_sl = os.path.join(repo_dir, "repo")
|
| 352 |
-
if not (os.path.islink(_sl) or os.path.exists(_sl)):
|
| 353 |
-
os.symlink(repo_dir, _sl)
|
| 354 |
-
print("repo-layout symlink created")
|
| 355 |
-
|
| 356 |
if lang == "rust":
|
| 357 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
| 358 |
# v1.1: a dev-profile build with debuginfo hit 43G on the 50G container
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v1.3).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 41 |
makes both layouts resolve. Context expansion skips test files referenced by the
|
| 42 |
test_patch that don't exist on disk instead of crashing the row (eza 0070).
|
| 43 |
|
| 44 |
+
v1.3: the v1.2 repo-layout symlink was created in verify_row BEFORE clean_state, and
|
| 45 |
+
clean_state runs git clean -fdxq which deleted it -- noir rows ran with no repo/
|
| 46 |
+
self-link and parsed 0 tests. The symlink is now created inside run_tests, after
|
| 47 |
+
every clean_state, so both layouts resolve in every phase.
|
| 48 |
+
|
| 49 |
Usage (inside a job with the right language toolchain image):
|
| 50 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 51 |
"""
|
|
|
|
| 243 |
"""Run rebuild_cmds, test_cmds, print_cmds, then collect the report files the
|
| 244 |
test frameworks wrote (surefire/gradle XML, gradle HTML, reports/*) and feed
|
| 245 |
them to the log parser. Returns (tests_dict, combined_output_tail)."""
|
| 246 |
+
# v1.3: rows whose cmds reference a nested repo/ layout need a self-symlink,
|
| 247 |
+
# and it must exist AFTER every clean_state (which git-cleans it away).
|
| 248 |
+
_cmds = (row.get("test_cmds") or []) + (row.get("rebuild_cmds") or []) + (row.get("print_cmds") or [])
|
| 249 |
+
if any(("repo/" in c) or c.rstrip().endswith("/repo") for c in _cmds):
|
| 250 |
+
_sl = os.path.join(repo_dir, "repo")
|
| 251 |
+
if not (os.path.islink(_sl) or os.path.exists(_sl)):
|
| 252 |
+
os.symlink(repo_dir, _sl)
|
| 253 |
+
print("repo-layout symlink created", flush=True)
|
| 254 |
disk_guard(f"{phase_tag}-pre")
|
| 255 |
parser = get_parser(row)
|
| 256 |
dep_err = ensure_js_deps(repo_dir)
|
|
|
|
| 356 |
return rec
|
| 357 |
log_disk(f"cloned:{row['id']}")
|
| 358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
if lang == "rust":
|
| 360 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
| 361 |
# v1.1: a dev-profile build with debuginfo hit 43G on the 50G container
|