scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH) #2814
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2814
Loading…
Reference in a new issue
No description provided.
Delete branch "test-red-green-compiler-crash"
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?
Pull request successfully merged and closed
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)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
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)
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.Merging. Head
f442c3dfbmerges cleanly withmain3e7b34a52and does not force a rebase of #2566. CI green on this head and on main. I ran it on main 19d62a98d + 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).