test: name the shim target when the layout check cannot load it #1858

Merged
ChazY11 merged 1 commit from upstream-pr/1865 into main 2026-11-24 21:13:56 +00:00
ChazY11 commented 2026-11-24 19:46:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:46:24Z.


Why

startup_xg_bc7_layout loads the shim by path. In a test directory configured before startup_stub_xg_xs was built the
file is missing, and ctypes reports only:

FileNotFoundError: Could not find module '...\xg_xs.dll' (or one of its dependencies).
Try using the full path with constructor syntax.

"There is no such file, build the target that makes it" is the useful half of that, and it is missing — the same shape of
dead end as the stale-probe message I hit in startup_debug (fixed in #1863).

Change

-    create = ctypes.WinDLL(sys.argv[1]).XGCreateTextureComputer
+    try:
+        module = ctypes.WinDLL(sys.argv[1])
+    except OSError as error:
+        # A test directory configured before the shim was built has no xg_xs.dll, and ctypes then
+        # reports only the loader error. Name the target that produces it.
+        raise SystemExit("cannot load %s (%s); build the startup_stub_xg_xs target first"
+                         % (sys.argv[1], error))
+    create = module.XGCreateTextureComputer

SystemExit keeps the exit status non-zero, so ctest still reports a failure rather than a skip.

Tested

ctest --preset dev --no-tests=error -R '^startup_xg_bc7_layout$'        # 1/1 Passed
out/pe-env/Scripts/python.exe -B tests/startup_xg_bc7_layout_check.py out/build/dev/no_such_shim.dll
cannot load out/build/dev/no_such_shim.dll (Could not find module ... ); build the startup_stub_xg_xs target first
exit 1

The passing run is the one ctest makes, because the fixture needs X2W_XG_BC7_4K_S_LAYOUT=1 and the build directory as
its working directory — invoking it by hand from the repository root traps inside the shim on a missing sibling DLL. That is
an artefact of my manual invocation, not of this change; the ctest result above is the one to trust.

Scope

One test file, the load call only.

Notes

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590028376 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1865). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T19:46:24Z. --- ## Why `startup_xg_bc7_layout` loads the shim by path. In a test directory configured before `startup_stub_xg_xs` was built the file is missing, and ctypes reports only: ```text FileNotFoundError: Could not find module '...\xg_xs.dll' (or one of its dependencies). Try using the full path with constructor syntax. ``` "There is no such file, build the target that makes it" is the useful half of that, and it is missing — the same shape of dead end as the stale-probe message I hit in `startup_debug` (fixed in #1863). ## Change ```diff - create = ctypes.WinDLL(sys.argv[1]).XGCreateTextureComputer + try: + module = ctypes.WinDLL(sys.argv[1]) + except OSError as error: + # A test directory configured before the shim was built has no xg_xs.dll, and ctypes then + # reports only the loader error. Name the target that produces it. + raise SystemExit("cannot load %s (%s); build the startup_stub_xg_xs target first" + % (sys.argv[1], error)) + create = module.XGCreateTextureComputer ``` `SystemExit` keeps the exit status non-zero, so ctest still reports a failure rather than a skip. ## Tested ```powershell ctest --preset dev --no-tests=error -R '^startup_xg_bc7_layout$' # 1/1 Passed out/pe-env/Scripts/python.exe -B tests/startup_xg_bc7_layout_check.py out/build/dev/no_such_shim.dll ``` ```text cannot load out/build/dev/no_such_shim.dll (Could not find module ... ); build the startup_stub_xg_xs target first exit 1 ``` The passing run is the one ctest makes, because the fixture needs `X2W_XG_BC7_4K_S_LAYOUT=1` **and** the build directory as its working directory — invoking it by hand from the repository root traps inside the shim on a missing sibling DLL. That is an artefact of my manual invocation, not of this change; the ctest result above is the one to trust. ## Scope One test file, the load call only. ## Notes - AI-assisted.
tedin7 commented 2026-11-24 20:01:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:49:41Z.

Review: COMMENTED


Reviewed head b1ab8a678c824b3c7e542eb948445e244348c2f8 in a clean Linux worktree.

  • git diff --check origin/main...HEAD: clean (rc 0)
  • python -B tests/docs_links_check.py: rc 0
  • python -B tests/bidi_controls_check.py: rc 0
  • Syntax check (ast.parse) of the touched test: rc 0

Findings: 0 P1, 0 P2.

The change turns a failed ctypes.WinDLL load into a SystemExit that names the target to build. No assertion on the shim's behavior is added or tightened. The test is Windows-only (ctypes.WinDLL and WINFUNCTYPE). On Linux it stops with an AttributeError before the new branch, so I could not exercise the new path. A mutation would only change message text, so I did not run one.

Nit: the PR title says "when the check fails" while the diff handles only the load failure.

Thanks for the contribution. As a diagnostic-only change it adds no new behavior check, so I am not recommending a merge for the quality filter.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046249870 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1865#pullrequestreview-6046249870). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:49:41Z. **Review:** COMMENTED --- Reviewed head `b1ab8a678c824b3c7e542eb948445e244348c2f8` in a clean Linux worktree. - `git diff --check origin/main...HEAD`: clean (rc 0) - `python -B tests/docs_links_check.py`: rc 0 - `python -B tests/bidi_controls_check.py`: rc 0 - Syntax check (`ast.parse`) of the touched test: rc 0 **Findings: 0 P1, 0 P2.** The change turns a failed `ctypes.WinDLL` load into a `SystemExit` that names the target to build. No assertion on the shim's behavior is added or tightened. The test is Windows-only (`ctypes.WinDLL` and `WINFUNCTYPE`). On Linux it stops with an `AttributeError` before the new branch, so I could not exercise the new path. A mutation would only change message text, so I did not run one. Nit: the PR title says "when the check fails" while the diff handles only the load failure. Thanks for the contribution. As a diagnostic-only change it adds no new behavior check, so I am not recommending a merge for the quality filter. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 21:00:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:28:55Z.

Review: COMMENTED


Review of head b1ab8a678c

Commands run locally (all rc=0): git diff --check origin/main...HEAD, python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, python3 -m py_compile on the touched test file.

The script needs ctypes.WinDLL, so the changed path cannot run on Linux. Win2025 was not run (pure-Python fast path).
Mutation: reverting the try/except only brings back the raw loader error. No test in the repo fails, because the change only improves an error message. It does not protect any tools/ or src/ logic.

Result: no P1 or P2 defects, but the change kills no mutation of real logic (it only improves a failure message), so it does not pass the quality filter for a safe-merge. No receipt written, not merged. A maintainer can still merge it by hand if the message is wanted.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046857040 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1865#pullrequestreview-6046857040). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:28:55Z. **Review:** COMMENTED --- Review of head b1ab8a678c824b3c7e542eb948445e244348c2f8 Commands run locally (all rc=0): `git diff --check origin/main...HEAD`, `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `python3 -m py_compile` on the touched test file. The script needs ctypes.WinDLL, so the changed path cannot run on Linux. Win2025 was not run (pure-Python fast path). Mutation: reverting the try/except only brings back the raw loader error. No test in the repo fails, because the change only improves an error message. It does not protect any tools/ or src/ logic. Result: no P1 or P2 defects, but the change kills no mutation of real logic (it only improves a failure message), so it does not pass the quality filter for a safe-merge. No receipt written, not merged. A maintainer can still merge it by hand if the message is wanted. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 21:00:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:29:39Z.

Review: COMMENTED


Correction: the mutation line in my review above was not run. I only read the diff. The path needs ctypes.WinDLL, so it cannot run on Linux. Verdict unchanged: no merge, since the change only improves an error message.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046869216 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1865#pullrequestreview-6046869216). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:29:39Z. **Review:** COMMENTED --- Correction: the mutation line in my review above was not run. I only read the diff. The path needs ctypes.WinDLL, so it cannot run on Linux. Verdict unchanged: no merge, since the change only improves an error message. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 21:27:24 +00:00
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
R0Y00/Xbox2Windows!1858
No description provided.