tests: the stack reserve need not be the last link option (TEST-BUILD-FALLBACK-STACK-OPTION) #2618

Merged
imShangLi merged 4 commits from upstream-pr/2618 into main 2026-11-29 19:01:03 +00:00
imShangLi commented 2026-11-29 17:49:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-29T17:49:14Z.


Rebased replacement for #2573.

  • Rebased onto ProjectLeonida/mandy@4364a4f.
  • Diff: 1 insertion, 1 deletion in tests/test_build_runtime_fallback.py.
  • The regex now allows additional linker options after /STACK:${GTA6RT_STACK}.
  • Local regex validation passed; full repository tests are covered by CI.
  • The original branch snapshot is retained at Mby159/leonida@backup/pr-2573-ae7a0936a6.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5553417637 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-29T17:49:14Z. --- Rebased replacement for #2573. - Rebased onto `ProjectLeonida/mandy@4364a4f`. - Diff: 1 insertion, 1 deletion in `tests/test_build_runtime_fallback.py`. - The regex now allows additional linker options after `/STACK:${GTA6RT_STACK}`. - Local regex validation passed; full repository tests are covered by CI. - The original branch snapshot is retained at `Mby159/leonida@backup/pr-2573-ae7a0936a6`. AI-assisted: yes.
merzleckeier commented 2026-11-29 17:54:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T17:54:04Z.


Independent check of c76c322b on 4364a4fa6. The standalone fallback suite has ten passing cases and one Windows-only skip on Linux, on both unmodified trees. The new regex correctly accepts a valid option after /STACK:${GTA6RT_STACK}. It also accepts source that links a different reserve than the unchanged 8 MiB fallback.

I ran the exact Python assertion with five CMake variants, then linked tiny Windows PEs using each variant’s actual target_link_options with clang-cl/xwin and lld-link. llvm-readobj reported these reserves.

Variation Main assertion PR assertion PE reserve
Current flags Pass Pass 8 MiB
Append /INCREMENTAL:NO Fail Pass 8 MiB
Append 0 directly to ${GTA6RT_STACK} Fail Pass 80 MiB
Comment out the stack option on its own line Fail Pass 1 MiB
Add a later /STACK:16777216 Fail Pass 16 MiB

The existing PE check is a minimum check. I confirmed it rejects the 1 MiB case; it also accepts 16 and 80 MiB. Equality with the fallback still needs the static guard. One tested way to preserve it with the current flat CMake flag list is to split the option block and match the exact stack token once:

link_options = re.search(r"target_link_options\(gta6rt PRIVATE([^)]*)\)", cmake)
self.assertIsNotNone(link_options)
options = re.sub(r"(?m)#.*$", "", link_options[1]).split()
self.assertEqual([opt for opt in options if opt.upper().startswith("/STACK:")],
                 ["/STACK:${GTA6RT_STACK}"])

That passes the two 8 MiB cases, rejects all three mismatches, and passes the full standalone fallback suite with the same Linux skip. AI-assisted with OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260051449 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260051449). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T17:54:04Z. --- Independent check of `c76c322b` on `4364a4fa6`. The standalone fallback suite has ten passing cases and one Windows-only skip on Linux, on both unmodified trees. The new regex correctly accepts a valid option after `/STACK:${GTA6RT_STACK}`. It also accepts source that links a different reserve than the unchanged 8 MiB fallback. I ran the exact Python assertion with five CMake variants, then linked tiny Windows PEs using each variant’s actual `target_link_options` with clang-cl/xwin and lld-link. `llvm-readobj` reported these reserves. | Variation | Main assertion | PR assertion | PE reserve | | --- | --- | --- | ---: | | Current flags | Pass | Pass | 8 MiB | | Append `/INCREMENTAL:NO` | Fail | Pass | 8 MiB | | Append `0` directly to `${GTA6RT_STACK}` | Fail | Pass | 80 MiB | | Comment out the stack option on its own line | Fail | Pass | 1 MiB | | Add a later `/STACK:16777216` | Fail | Pass | 16 MiB | The existing PE check is a minimum check. I confirmed it rejects the 1 MiB case; it also accepts 16 and 80 MiB. Equality with the fallback still needs the static guard. One tested way to preserve it with the current flat CMake flag list is to split the option block and match the exact stack token once: ```python link_options = re.search(r"target_link_options\(gta6rt PRIVATE([^)]*)\)", cmake) self.assertIsNotNone(link_options) options = re.sub(r"(?m)#.*$", "", link_options[1]).split() self.assertEqual([opt for opt in options if opt.upper().startswith("/STACK:")], ["/STACK:${GTA6RT_STACK}"]) ``` That passes the two 8 MiB cases, rejects all three mismatches, and passes the full standalone fallback suite with the same Linux skip. AI-assisted with OpenAI Codex (GPT-6).
Mby159 commented 2026-11-29 17:59:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mby159 on 2026-11-29T17:59:04Z.


CI baseline comparison for the current red checks:

  • PR base 4364a4fa61f6bc42eefc94452c3a565fc530dd34 already has failing semantic-tests (ubuntu-latest), translator-tests, stdlib-tests-linux, check, and macos-python jobs.
  • On this PR, semantic-tests fails in test_interp_computed_ij_fallback; translator-tests fails in six tests/test_mesh_serial_waves.py cases. Neither file is touched by this PR.
  • no-game-data, change-scope, and viewer-tests pass.
  • The only changed file is tests/test_build_runtime_fallback.py; local validation confirmed the old regex rejects a valid /STACK option followed by another linker option, while the new regex accepts it.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260116314 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260116314). Originally posted by [Mby159](https://github.com/Mby159) on 2026-11-29T17:59:04Z. --- CI baseline comparison for the current red checks: - PR base `4364a4fa61f6bc42eefc94452c3a565fc530dd34` already has failing `semantic-tests (ubuntu-latest)`, `translator-tests`, `stdlib-tests-linux`, `check`, and `macos-python` jobs. - On this PR, `semantic-tests` fails in `test_interp_computed_ij_fallback`; `translator-tests` fails in six `tests/test_mesh_serial_waves.py` cases. Neither file is touched by this PR. - `no-game-data`, `change-scope`, and `viewer-tests` pass. - The only changed file is `tests/test_build_runtime_fallback.py`; local validation confirmed the old regex rejects a valid `/STACK` option followed by another linker option, while the new regex accepts it. AI-assisted: yes.
Mby159 commented 2026-11-29 18:08:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mby159 on 2026-11-29T18:08:02Z.


Updated head eace3acd, with current main (eedd72e3) merged into the branch.

The assertion now anchors target_link_options(gta6rt ...) at line start, strips comments from the captured option list, and requires exactly one /STACK:${GTA6RT_STACK} token. This keeps the original equality check while allowing unrelated trailing linker options.

Local validation: two valid variants pass (current flags; appended /INCREMENTAL:NO), and three invalid variants are rejected (wrong reserve suffix, fully commented-out stack option, second overriding /STACK).

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260238060 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260238060). Originally posted by [Mby159](https://github.com/Mby159) on 2026-11-29T18:08:02Z. --- Updated head `eace3acd`, with current `main` (`eedd72e3`) merged into the branch. The assertion now anchors `target_link_options(gta6rt ...)` at line start, strips comments from the captured option list, and requires exactly one `/STACK:${GTA6RT_STACK}` token. This keeps the original equality check while allowing unrelated trailing linker options. Local validation: two valid variants pass (current flags; appended `/INCREMENTAL:NO`), and three invalid variants are rejected (wrong reserve suffix, fully commented-out stack option, second overriding `/STACK`). AI-assisted: yes.
merzleckeier commented 2026-11-29 18:16:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T18:16:08Z.


Retested eace3acd on eedd72e30 against the same linked PE fixtures. Stock and the extra unrelated option pass at 8 MiB. The numeric suffix (80 MiB), commented-out option (1 MiB), and later CMake override (16 MiB) are now all rejected.

One analogous case remains in the PowerShell fallback assertion. Appending /stack:16777216 after /STACK:8388608 on the /Fe:gta6rt.exe line passes the Python check. A minimal PE linked with those two flags in that order with lld-link has SizeOfStackReserve = 16777216. Checking the complete list of stack options on both sides would close that gap. I tested replacing just the fallback assertion with:

_, separator, flags = lines[0].partition(" /link ")
self.assertEqual(separator, " /link ")
self.assertEqual(
    [option[1:].upper() for option in flags.split()
     if option.upper().startswith(("/STACK:", "-STACK:"))],
    [f"STACK:{reserve}"],
)

This rejects the fallback override and preserves the other six results. Both standalone runs on Linux passed 10 tests with one Windows-only skip. This used tiny synthetic PEs to verify the link flags. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260346982 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260346982). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T18:16:08Z. --- Retested `eace3acd` on `eedd72e30` against the same linked PE fixtures. Stock and the extra unrelated option pass at 8 MiB. The numeric suffix (80 MiB), commented-out option (1 MiB), and later CMake override (16 MiB) are now all rejected. One analogous case remains in the PowerShell fallback assertion. Appending `/stack:16777216` after `/STACK:8388608` on the `/Fe:gta6rt.exe` line passes the Python check. A minimal PE linked with those two flags in that order with `lld-link` has `SizeOfStackReserve = 16777216`. Checking the complete list of stack options on both sides would close that gap. I tested replacing just the fallback assertion with: ```python _, separator, flags = lines[0].partition(" /link ") self.assertEqual(separator, " /link ") self.assertEqual( [option[1:].upper() for option in flags.split() if option.upper().startswith(("/STACK:", "-STACK:"))], [f"STACK:{reserve}"], ) ``` This rejects the fallback override and preserves the other six results. Both standalone runs on Linux passed 10 tests with one Windows-only skip. This used tiny synthetic PEs to verify the link flags. AI-assisted with OpenAI Codex.
Mby159 commented 2026-11-29 18:21:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mby159 on 2026-11-29T18:21:07Z.


Updated head c680918.

The PowerShell fallback assertion now partitions the /link flags and requires exactly one matching stack option, accepting both /STACK: and -STACK: spellings. Local validation passes the current flag, an unrelated trailing option, and -STACK; it rejects a later overriding /stack and a wrong reserve.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260413059 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260413059). Originally posted by [Mby159](https://github.com/Mby159) on 2026-11-29T18:21:07Z. --- Updated head `c680918`. The PowerShell fallback assertion now partitions the `/link` flags and requires exactly one matching stack option, accepting both `/STACK:` and `-STACK:` spellings. Local validation passes the current flag, an unrelated trailing option, and `-STACK`; it rejects a later overriding `/stack` and a wrong reserve. AI-assisted: yes.
TheGeogeo commented 2026-11-29 18:48:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T18:48:29Z.


Tested c68091870 merged (no commit) with main 7c330c76d: Python 3.12.4, Windows 11 10.0.26300, CPU only.

  • Test-only change (tests/test_build_runtime_fallback.py): 11 of 11 pass on the merge, 0 skipped.
  • No red is possible from the code here. The main version passes too, since the current runtime/CMakeLists.txt still puts /STACK: last. The change only lets the check accept /STACK:${GTA6RT_STACK} anywhere among the gta6rt link options, and in the fallback /link line, instead of last.
  • git merge-tree against #2566's head 7b5cb2941: no conflict.
  • No game data check passes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260774510 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260774510). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T18:48:29Z. --- Tested c68091870 merged (no commit) with main 7c330c76d: Python 3.12.4, Windows 11 10.0.26300, CPU only. - Test-only change (`tests/test_build_runtime_fallback.py`): 11 of 11 pass on the merge, 0 skipped. - No red is possible from the code here. The main version passes too, since the current `runtime/CMakeLists.txt` still puts `/STACK:` last. The change only lets the check accept `/STACK:${GTA6RT_STACK}` anywhere among the `gta6rt` link options, and in the fallback `/link` line, instead of last. - `git merge-tree` against #2566's head `7b5cb2941`: no conflict. - No game data check passes. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 19:00:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T19:00:59Z.


Merging. Head c68091870 has red/green verdicts from reviewers other than the author (above), merges cleanly with main b8346588d, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-tests mesh, semantic-tests f16) are pre-existing. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260938423 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2618#issuecomment-7260938423). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T19:00:59Z. --- Merging. Head `c68091870` has red/green verdicts from reviewers other than the author (above), merges cleanly with `main` `b8346588d`, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (`translator-tests` mesh, `semantic-tests` f16) are pre-existing. Merged by MoonEyes. AI-assisted (Claude Code).
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!2618
No description provided.