[PR #1051] run_semantic_tests: name a failed module's exit code, and a crash that printed nothing (SEMANTIC-RUNNER-EXIT-CODE) #1089

Open
opened 2026-11-26 20:20:03 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1051
Author: @shwepz
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: semantic-runner-exit-code


📝 Commits (2)

  • 448e09c run_semantic_tests: name a failed module's exit code, and a crash that printed nothing (SEMANTIC-RUNNER-EXIT-CODE)
  • 0f58c3e run_semantic_tests: call only known crash statuses a crash (review on #1051)

📊 Changes

2 files changed (+80 additions, -3 deletions)

View changed files

📝 scripts/run_semantic_tests.py (+41 -3)
📝 tests/test_run_semantic_tests.py (+39 -0)

📄 Description

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.py printed 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 ==== FAILED block. With the exit code printed they turned out to be python.exe exiting 0xC0000005 (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:

==== FAILED: test_f (exit code 1)
==== FAILED: test_crash (killed by SIGSEGV (-11))
==== FAILED: test_lds_src2 (exit code 0xC0000005, access violation (the process crashed))
(no output: the process ended before printing anything)
  • 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), otherwise exit code N.
  • A module that printed nothing gets the (no output ...) line.
  • Only the FAILED print in main() changes. run_module is untouched, so this does not overlap #662, which rewrites run_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_code
    • test_a_crash_that_prints_nothing_is_named: a module that really dies on import, with SIGSEGV on POSIX and exit code 0xC0000005 on Windows
    • test_describe_exit
  • Linux (Ubuntu, Python 3.12.3): 22/22 OK.
  • Windows 11 (Python 3.11.6): the three new tests pass, 21/22 overall. The one failure, test_empty_package_alone_is_not_a_false_green (jobs=1), fails the same way on main without this change. Python 3.11's unittest discover exits 0 when nothing ran; the exit code 5 the test expects is 3.12+.
  • python -m compileall -q on both files.
  • On the Windows machine above, a full translator-suite run with an earlier debug copy of this change, which printed the raw code, named the 4 crashing files: test_control_flow_vcc, test_lds_src2, test_vs_readfirstlane and test_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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1051 **Author:** [@shwepz](https://github.com/shwepz) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `semantic-runner-exit-code` --- ### 📝 Commits (2) - [`448e09c`](https://github.com/ubiquitarianism/leonida/commit/448e09c635c54a0a78489cdc9bc9e36eea5f5b39) run_semantic_tests: name a failed module's exit code, and a crash that printed nothing (SEMANTIC-RUNNER-EXIT-CODE) - [`0f58c3e`](https://github.com/ubiquitarianism/leonida/commit/0f58c3e5165623b6842c02506882ca6b81d5bcef) run_semantic_tests: call only known crash statuses a crash (review on #1051) ### 📊 Changes **2 files changed** (+80 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `scripts/run_semantic_tests.py` (+41 -3) 📝 `tests/test_run_semantic_tests.py` (+39 -0) </details> ### 📄 Description 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.py` printed 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 `==== FAILED` block. With the exit code printed they turned out to be `python.exe` exiting `0xC0000005` (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: ``` ==== FAILED: test_f (exit code 1) ==== FAILED: test_crash (killed by SIGSEGV (-11)) ==== FAILED: test_lds_src2 (exit code 0xC0000005, access violation (the process crashed)) (no output: the process ended before printing anything) ``` - `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), otherwise `exit code N`. - A module that printed nothing gets the `(no output ...)` line. - Only the FAILED print in `main()` changes. `run_module` is untouched, so this does not overlap #662, which rewrites `run_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_code` - `test_a_crash_that_prints_nothing_is_named`: a module that really dies on import, with SIGSEGV on POSIX and exit code 0xC0000005 on Windows - `test_describe_exit` - Linux (Ubuntu, Python 3.12.3): 22/22 OK. - Windows 11 (Python 3.11.6): the three new tests pass, 21/22 overall. The one failure, `test_empty_package_alone_is_not_a_false_green (jobs=1)`, fails the same way on `main` without this change. Python 3.11's `unittest discover` exits 0 when nothing ran; the exit code 5 the test expects is 3.12+. - `python -m compileall -q` on both files. - On the Windows machine above, a full translator-suite run with an earlier debug copy of this change, which printed the raw code, named the 4 crashing files: `test_control_flow_vcc`, `test_lds_src2`, `test_vs_readfirstlane` and `test_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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1089
No description provided.