test_ctest_registration: read a named skip code (kSkip) by its value (red on main since #927) #1252

Merged
Boost9898 merged 1 commit from upstream-pr/1252 into main 2026-11-24 22:17:56 +00:00
Boost9898 commented 2026-11-24 20:52:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Boost9898 on 2026-11-24T20:52:47Z.


Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144141333

What and why

#927 added runtime/test/vk_host_region_import_test.cpp, registered twice with SKIP_RETURN_CODE 77. Its skip paths return kSkip;, where constexpr int kSkip = 77; (line 29). whole_test_skips_not_77 in tests/test_ctest_registration.py compares the returned token itself with "77", so it reports ('test/vk_host_region_import_test.cpp:341', 'kSkip') (once per registration), and test_whole_test_skips_return_the_skip_code fails on main 66d4f5aa3.

The test binary is right: it exits 77. This PR changes the check, not the test. A returned name now counts by the value of its constexpr int in the same source file. A name that resolves to something else, or that isn't defined there, is still reported. So the check stays as strict as before for literal codes, and a kSkip = 0 would still be caught.

A new unit test covers kSkip = 77 (passes), kSkip = 0 (reported) and an undefined name (reported), on a synthetic CMake text and source in a temp folder.

Tested

Apple M4, macOS 26.5.1, Python 3.14.8 and 3.12.10, CPU only, no game files.

  • tests/test_ctest_registration.py: fails on main 66d4f5aa3. With this change, 5 OK on both versions. With the old check and the new unit test, it fails again.
  • python -m compileall, git diff --check and scripts/check_no_game_data.py on the changed file: clean.

GPUs tested: n/a (no GPU tests involved)

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 rule changes)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480136037 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1252). Originally posted by [Boost9898](https://github.com/Boost9898) on 2026-11-24T20:52:47Z. --- Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144141333 ### What and why #927 added `runtime/test/vk_host_region_import_test.cpp`, registered twice with `SKIP_RETURN_CODE 77`. Its skip paths `return kSkip;`, where `constexpr int kSkip = 77;` (line 29). `whole_test_skips_not_77` in `tests/test_ctest_registration.py` compares the returned token itself with `"77"`, so it reports `('test/vk_host_region_import_test.cpp:341', 'kSkip')` (once per registration), and `test_whole_test_skips_return_the_skip_code` fails on `main` `66d4f5aa3`. The test binary is right: it exits 77. This PR changes the check, not the test. A returned name now counts by the value of its `constexpr int` in the same source file. A name that resolves to something else, or that isn't defined there, is still reported. So the check stays as strict as before for literal codes, and a `kSkip = 0` would still be caught. A new unit test covers `kSkip = 77` (passes), `kSkip = 0` (reported) and an undefined name (reported), on a synthetic CMake text and source in a temp folder. ### Tested Apple M4, macOS 26.5.1, Python 3.14.8 and 3.12.10, CPU only, no game files. - `tests/test_ctest_registration.py`: fails on `main` `66d4f5aa3`. With this change, 5 OK on both versions. With the old check and the new unit test, it fails again. - `python -m compileall`, `git diff --check` and `scripts/check_no_game_data.py` on the changed file: clean. GPUs tested: n/a (no GPU tests involved) 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator rule changes)
titoreinaldo commented 2026-11-24 20:57:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T20:57:02Z.


On Linux I compiled and ran tiny C++17 fixtures and compared exit codes with whole_test_skips_not_77 at a04f2036. With one actual constexpr int kSkip=77 the runtime exits 77 and the checker accepts it; with =0 the checker reports it. However, if an old // constexpr int kSkip=77; comment follows the real =0 declaration, the executable still exits 0 but the checker accepts it. I saw the same with an unrelated later function declaring another kSkip=77: the file-wide dictionary takes the last match. Could the checker ignore comments and conservatively reject ambiguous repeated names? No need to implement a C++ parser for the single unambiguous constant this PR needs. Synthetic CPU-only fixtures; AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144273470 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1252#issuecomment-7144273470). Originally posted by [titoreinaldo](https://github.com/titoreinaldo) on 2026-11-24T20:57:02Z. --- On Linux I compiled and ran tiny C++17 fixtures and compared exit codes with `whole_test_skips_not_77` at `a04f2036`. With one actual `constexpr int kSkip=77` the runtime exits 77 and the checker accepts it; with `=0` the checker reports it. However, if an old `// constexpr int kSkip=77;` comment follows the real `=0` declaration, the executable still exits 0 but the checker accepts it. I saw the same with an unrelated later function declaring another `kSkip=77`: the file-wide dictionary takes the last match. Could the checker ignore comments and conservatively reject ambiguous repeated names? No need to implement a C++ parser for the single unambiguous constant this PR needs. Synthetic CPU-only fixtures; AI-assisted.
QemmHD commented 2026-11-24 22:17:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T22:17:53Z.


Merging.

Why merged: main has been red on tests/test_ctest_registration.py::test_whole_test_skips_return_the_skip_code since #927. I merged #927, so this one's on me. It returns kSkip (constexpr int kSkip = 77;), and the checker compared the token itself with "77". This PR resolves a named code through its constexpr int in the same source, so return kSkip; counts as 77. A genuinely wrong value (kSkip = 0) or an unknown name is still reported, and the new test covers all three cases. titoreinaldo also checked the logic against compiled fixtures on Linux.

Why it's good: test-only, 20 lines. On Windows 11, tests/test_ctest_registration.py gives 1 failed / 3 passed on main and 5 passed with this PR. The repo-consistency set with it merged gives 573 passed / 5 skipped / 0 failed. There's no change to any runtime code or to what the checker rejects.

I'm also adding test_ctest_registration.py to the checks we run before each merge, so this kind of break gets caught before it lands, not after.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7146056179 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1252#issuecomment-7146056179). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T22:17:53Z. --- Merging. **Why merged:** main has been red on `tests/test_ctest_registration.py::test_whole_test_skips_return_the_skip_code` since #927. I merged #927, so this one's on me. It returns `kSkip` (`constexpr int kSkip = 77;`), and the checker compared the token itself with `"77"`. This PR resolves a named code through its `constexpr int` in the same source, so `return kSkip;` counts as 77. A genuinely wrong value (`kSkip = 0`) or an unknown name is still reported, and the new test covers all three cases. titoreinaldo also checked the logic against compiled fixtures on Linux. **Why it's good:** test-only, 20 lines. On Windows 11, `tests/test_ctest_registration.py` gives 1 failed / 3 passed on main and 5 passed with this PR. The repo-consistency set with it merged gives 573 passed / 5 skipped / 0 failed. There's no change to any runtime code or to what the checker rejects. I'm also adding `test_ctest_registration.py` to the checks we run before each merge, so this kind of break gets caught before it lands, not after. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1252
No description provided.