Repository navigation
scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH) - #2814
Conversation
…ST-RED-GREEN-COMPILER-CRASH) A verification's only trial said "red does not build" while rustc had crashed (0xC0000005). A side whose cargo output shows rustc or a build script ending with a Windows crash status, an internal compiler error or a failed allocation now builds again once, and the report says so; a second crash gives the verdict `compiler crashed` (exit 1), not `red does not build`. A test binary that crashes stays a test result.
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head MEASURED
READ IN CODE
AI-assisted: Claude Code |
KelboLive
left a comment
There was a problem hiding this comment.
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):
python -I tests/test_red_green.py Ran 16 tests, OK (88 s)
real rustc error[E0425] no_build set, crash None -> no retry
rustc (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) crash set, cargo called 2x, rerun_after set -> red then green
that same crash twice cargo_crashed set, no_build empty -> compiler crashed (exit 1)
rustc (exit code: 1) / Python traceback crash None -> build error
test binary (exit code: 0xc0000005) crash None -> stays a test result
The headline claim holds, and the JSON/report fields come out as documented.
Two gaps worth fixing:
- A crash is ignored once the side has printed any test line.
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. - The generic allocator phrase misclassifies a test binary.
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 rustc SIGSEGV is 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/main 86c30fcea, and both orders produce the same tree.
Verification — VERIFY-2814Verdict: PASS
AI-assisted: yes (Muse Wonder, Muse by Meta) |
|
Thanks @KelboLive and @aegish-zagi. Both of KelboLive's points hold in the code:
The Unix 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 |
|
Merging. Head AI-assisted (Claude Code). |
Claimed in the coordination issue as: TEST-RED-GREEN-COMPILER-CRASH (#2570 (comment))
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)