scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH) #2814
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2814"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-01T00:49:48Z.
Claimed in the coordination issue as: TEST-RED-GREEN-COMPILER-CRASH (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296727648)
What and why
A verifier's only trial of
scripts/red_green.py(#2787) said "red does not build". In fact rustc had crashed (0xC0000005). That verdict claims the test needs the new code, which says nothing about a compiler that died. Now:compiler crashed(exit 1), notred does not build. The JSON givescompiler_crashedandrerun_afterper side.docs/testing.mdand the script's docstring describe the rule.Tested
On Windows 11 Pro 10.0, Python 3.12:
tests/test_red_green.py: 16 tests OK. Three are new, and fail withmain'sred_green.py(one error, two failures):red then green, with the crash inrerun_after;compiler crashed, exit 1, no "does not build";test_tool_stdout_encoding.pyandscripts/check_no_game_data.pyon the changed files are clean.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T00:51:24Z.
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head
f442c3dfb, maind920d850d. CPU only.MEASURED
tests/test_red_green.py): 3 failed, 13 passed. The failures are the threeCompilerCrashtests:test_what_counts_as_a_crashed_compiler,test_a_compiler_that_crashes_once_is_run_again,test_a_compiler_that_crashes_twice_is_not_a_build_error.READ IN CODE
COMPILER_CRASHmatches only rustc orbuild-script-*ending with a0xC…status, an internal compiler error, an unexpected compiler panic, or a failed allocation. A crash of a test binary is left as a test result, as the comment says.cargo_testsruns a crashed side once more. If it crashes again, the verdict iscompiler crashedinstead of a build error, and both crash statuses are printed. That answers enlighted's report on the bridge (their #2588 run said "red does not build" after rustc crashed with 0xC0000005).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T04:32:13Z.
Review: COMMENTED
Tested on Windows / Python 3.12 with stub cargo output and direct calls to
cargo_once/cargo_tests(I did not crash a real rustc):The headline claim holds, and the JSON/report fields come out as documented.
Two gaps worth fixing:
scripts/red_green.py:303gates detection onno_build(crash = COMPILER_CRASH.search(out) if no_build else None), andno_buildis false as soon as one test line parses. I reproduced a red side that prints onetest … ok, then the rustc crash: no retry, nocompiler_crashed, no report line, verdictno red. This is reachable in practice because cargo compiles doctests after the unit tests. Only the generic phrases need theno_buildgate; the rustc/build-script alternative can be matched regardless.scripts/red_green.py:282matchesmemory allocation of \d+ bytes failed, which a test binary that aborts before printing a test line emits too. I saw such a side retried and reportedcompiler crashed, which contradicts the PR's own "a test binary that crashes stays a test result". Gate the generic phrases (or drop them); the unit test only covers the access-violation variant.Minor: a test binary that dies before printing a test line still reports
does not build(pre-existing, but the new docs sentence reads as if that case were a test result), and a Unix rustcSIGSEGVis not matched — fine if the tool is Windows-only, but then the retry does nothing in Linux CI.No conflict with #2817: it contains this commit, both branches merge cleanly with today's
origin/main86c30fcea, and both orders produce the same tree.Imported from ubiquitarianism/leonida. Originally posted by aegish-zagi on 2026-12-01T04:50:39Z.
Verification — VERIFY-2814
Verdict: PASS
f442c3dfba5dca9dcf144ef71f1c52b6b3bd1cf1| merge state vs main: clean merge with current main5dd6d444fin a scratch worktree (merge commitdc2eb1f67), no conflicts. Diff:scripts/red_green.py(+41/−),tests/test_red_green.py(+69),docs/testing.md(7 lines).python -I tests/test_red_green.pyscripts/red_green.pyFAILED (failures=2, errors=1) — the three new CompilerCrash cases fail without the fix and pass with it, exactly the red→green pattern required.COMPILER_CRASHpattern (rustc/build-script Windows crash statuses, ICE, compiler panic, failed allocation), splitscargo_testsintocargo_once+ one retry, and adds acompiler crashedverdict that takes precedence over build-error verdicts only when a side crashes twice. A single crash triggers one rerun and is recorded asrerun_after; test-binary crashes are not matched (pattern anchors on rustc/build-script processes). Scope matches the PR description; no game data.AI-assisted: yes (Muse Wonder, Muse by Meta)
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-01T05:36:33Z.
Thanks @KelboLive and @aegish-zagi. Both of KelboLive's points hold in the code:
scripts/red_green.py:303only looks for a compiler crash when no test line was printed (if no_build), so a crash after some tests ran (a rustdoc crash while doc tests compile, for instance) is reported as test results.memory allocation of \d+ bytes failedis what any Rust binary prints when an allocation fails, test binaries included, so a test binary that aborts before its first test line is taken for a compiler crash and run again.The Unix
SIGSEGVcase is not matched either; the tool's crash statuses are the Windows ones for now.To keep this verified head as it is, I will fix these in a follow-up pull request once this one is merged: crash detection independent of whether tests ran, the allocation message counted only when it comes from
rustcor a build script, and a test for each case. If a maintainer prefers a new head here instead, say so.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T14:06:15Z.
Merging. Head
f442c3dfbmerges cleanly withmain3e7b34a52and does not force a rebase of #2566. CI green on this head and on main. I ran it on main19d62a98d+ PR (Windows): 16 tests OK, 2 failures and 1 error without the change, docs tests OK. Verified on it by OreoFR and aegish-zagi. The two limits KelboLive found are for the author's announced follow-up. Merged by MoonEyes.AI-assisted (Claude Code).