run_semantic_tests: name a failed module's exit code, and a crash that printed nothing (SEMANTIC-RUNNER-EXIT-CODE) #1051
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1051"
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 shwepz on 2026-11-24T17:21:04Z.
Claimed in the coordination issue as: SEMANTIC-RUNNER-EXIT-CODE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138999168)
What and why
scripts/run_semantic_tests.pyprinted a failed module as==== FAILED: <name>followed by its output, but never its exit code. A module whose interpreter crashes prints nothing, so it showed up as a bare header with nothing under it, and the run gave no clue why it failed.I hit this on a Windows 11 machine: a different 4-9 files failed each full run, every one as an empty
==== FAILEDblock. With the exit code printed they turned out to bepython.exeexiting0xC0000005(access violation) in pure-Python tests that pass when run alone, and that pass in a 12-job run on Linux. So the fault is that machine, not the tests, but there was no way to tell from the runner's output.The header now carries the exit code:
describe_exit(code): a POSIX signal by name, a Windows NTSTATUS (>= 0xC0000000) in hex with its meaning for the common crash codes (access violation, illegal instruction, out of memory, stack overflow, Ctrl+C, heap corruption, fail fast), otherwiseexit code N.(no output ...)line.main()changes.run_moduleis untouched, so this does not overlap #662, which rewritesrun_module's test counting. The existing tests match the header as a prefix (==== FAILED: test_f), so they still hold.Tested
python -I tests/test_run_semantic_tests.py, three new tests:test_a_failure_header_names_the_exit_codetest_a_crash_that_prints_nothing_is_named: a module that really dies on import, with SIGSEGV on POSIX and exit code 0xC0000005 on Windowstest_describe_exittest_empty_package_alone_is_not_a_false_green (jobs=1), fails the same way onmainwithout this change. Python 3.11'sunittest discoverexits 0 when nothing ran; the exit code 5 the test expects is 3.12+.python -m compileall -qon both files.test_control_flow_vcc,test_lds_src2,test_vs_readfirstlaneandtest_wave64_halves_soundness, each exit code 3221225477 (0xC0000005), 0 tests run, 0 chars of output.describe_exit(3221225477)turns that into the access-violation line above.GPUs tested: n/a (no GPU code)
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)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T17:27:22Z.
Review: CHANGES_REQUESTED
Verified on exact head 02118b22548d4c063949a707f349a71d0a34134f.
tests/test_run_semantic_tests.pypasses 22/22; changed-file no-game-data andgit diff --checkpass; merge-tree onto current main is clean. One correctness issue remains indescribe_exit(scripts/run_semantic_tests.py:63): every code >= 0xC0000000 is labeled “the process crashed,” including unknown codes such as 0xC0001234 (the new test explicitly expects that wording). A child process can deliberately return an arbitrary 32-bit status, so the numeric range alone does not establish a crash. Please keep the crash label for recognized crash statuses and report unknown values neutrally as an exit code; update the unknown-code assertion accordingly. The reported Windows runs are author-provided; I ran the tests on Linux. No GPU/game data.Imported from ubiquitarianism/leonida. Originally posted by shwepz on 2026-11-24T17:32:02Z.
Thanks, agreed. A value in the NTSTATUS range is not proof of a crash. Fixed in 0c10c6b:
NTSTATUS_CRASHES(access violation, illegal instruction, out of memory, stack overflow, heap corruption, fail fast) get "(the process crashed)".0xC000013A) had the same problem: it's an interrupt, not a crash. It is now in a separateNTSTATUS_OTHERtable, named but not called a crash:exit code 0xC000013A, interrupted with Ctrl+C.exit code 0xC0001234(hex above 0xFFFF, decimal below).test_describe_exitnow asserts the neutral form for0xC0001234and0xDEADBEEF, plus the Ctrl+C case and a plain255.Re-run:
tests/test_run_semantic_tests.py22/22 OK;git diff --checkandcompileallclean.test_empty_package_alone_is_not_a_false_green (jobs=1)fails. It fails the same way onmain, because 3.11's discover exits 0 when nothing ran.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T17:35:56Z.
Review: APPROVED
Thanks for addressing the crash-classification issue. On updated head 0c10c6b128beda0843fb8efff688a1259c9b506b, the runner now labels only enumerated NTSTATUS crash codes as crashes, treats Ctrl+C separately, and reports unknown high exit values neutrally. passes 22/22; the printed failing fixture is an intentional subprocess-output assertion fixture and the outer suite exits 0. No-game-data and diff checks pass; merge-tree onto current main is clean. Windows execution remains author-reported; this independent run was on Linux.
Imported from ubiquitarianism/leonida. Originally posted by shwepz on 2026-11-25T08:46:25Z.
Rebased onto current
main(now0f58c3e5) because of theneeds rebaselabel.The conflicts all came from main's rework of the test count (
CHILD_PROGRAM, which reads the count from unittest's result object). I kept main's version and added this PR's pieces next to it:NTSTATUS_CRASHES/NTSTATUS_OTHER,describe_exitand theCRASHfixture. The changes this PR makes are the same as in the approved0c10c6b.git range-diffshows only context changes.Local results on Windows 11 with Python 3.12.10:
python -I tests/test_run_semantic_tests.pypasses 25/25, twice in a row.Side note: on Python 3.11, three tests in that file fail on plain
mainas well (empty package initializer and-p/--pattern, exit code 5). That is not caused by this PR.@KernelSmoker, the force-push cleared your approval. Could you take another look when you get a chance?
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:56:36Z.
Hi @shwepz, thanks for this pull request. It currently conflicts with
main(conflicting file(s):scripts/run_semantic_tests.py), so it carries theneeds rebaselabel. CONTRIBUTING.md asks authors to rebase their branch onmain; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:01:57Z.
Merged into
main(merge commit77d7d4ebb), approved by DadaCap (maintainer). Thanks!Checked before merging:
tests/test_run_semantic_tests.pypasses with main merged in (28 passed, 1 skipped). The merge was pinned to the head commit that was tested (8bde3ce19).AI-assisted (Claude Code), posted for DadaCap.