test: name the stale fixture DLL when an export is missing #1915

Merged
ChazY11 merged 1 commit from upstream-pr/1922 into main 2026-11-24 21:27:59 +00:00
ChazY11 commented 2026-11-24 21:20:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:20:30Z.


What

tests/cpu/x87_add.py resolves a fixture export with getattr(self.lib, name). When a variant DLL is stale — which happens
whenever a partial build leaves one of the eleven apart — that raises

AttributeError: function 'fstsw_top' not found

which names neither the file nor the reason. I hit it twice reviewing #1861 and misread it as a broken fixture both times.

Change

One helper, used by both call sites (__call__ and with_live_value):

def export(self, name):
    """The fixture export `name`, or a message that names the stale DLL."""
    try:
        return getattr(self.lib, name)
    except AttributeError:
        # A partial build leaves the variants at their previous revision, so the newest
        # export can be missing from one of them. Say which file and what to rebuild.
        raise AssertionError(
            f"{self.path.name} has no export {name!r}: this fixture DLL predates the export. "
            f"Rebuild the target that produces {self.path.name} before running this check."
        ) from None

self.path is stored in __init__ for the message. No behaviour changes when the export is present.

Tested

ctest --preset dev --no-tests=error -R '^cpu_aot_x87'
100% tests passed, 0 tests failed out of 21

Negative control, end to end: remove legacy_controls from tests/cpu/x87_examine.def, rebuild only
cpu_x87_examine (leaving the variants as they are), run the fixture:

AssertionError: cpu_x87_examine.dll has no export 'legacy_controls': this fixture DLL predates the export.
Rebuild the target that produces cpu_x87_examine.dll before running this check.

then restore the .def and rebuild:

100% tests passed, 0 tests failed out of 1

So the message fires on the real path with the real file name, not only in a unit test of the wrapper.

Scope

One file, one helper, one stored attribute. No fixture, no CMake and no production code changes; every x87 check that consumes
this module still passes.

Notes

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6591647521 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1922). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T21:20:30Z. --- ## What `tests/cpu/x87_add.py` resolves a fixture export with `getattr(self.lib, name)`. When a variant DLL is stale — which happens whenever a partial build leaves one of the eleven apart — that raises ```text AttributeError: function 'fstsw_top' not found ``` which names neither the file nor the reason. I hit it twice reviewing #1861 and misread it as a broken fixture both times. ## Change One helper, used by both call sites (`__call__` and `with_live_value`): ```python def export(self, name): """The fixture export `name`, or a message that names the stale DLL.""" try: return getattr(self.lib, name) except AttributeError: # A partial build leaves the variants at their previous revision, so the newest # export can be missing from one of them. Say which file and what to rebuild. raise AssertionError( f"{self.path.name} has no export {name!r}: this fixture DLL predates the export. " f"Rebuild the target that produces {self.path.name} before running this check." ) from None ``` `self.path` is stored in `__init__` for the message. No behaviour changes when the export is present. ## Tested ```powershell ctest --preset dev --no-tests=error -R '^cpu_aot_x87' 100% tests passed, 0 tests failed out of 21 ``` **Negative control**, end to end: remove `legacy_controls` from `tests/cpu/x87_examine.def`, rebuild only `cpu_x87_examine` (leaving the variants as they are), run the fixture: ```text AssertionError: cpu_x87_examine.dll has no export 'legacy_controls': this fixture DLL predates the export. Rebuild the target that produces cpu_x87_examine.dll before running this check. ``` then restore the `.def` and rebuild: ```text 100% tests passed, 0 tests failed out of 1 ``` So the message fires on the real path with the real file name, not only in a unit test of the wrapper. ## Scope One file, one helper, one stored attribute. No fixture, no CMake and no production code changes; every x87 check that consumes this module still passes. ## Notes - AI-assisted.
tedin7 commented 2026-11-24 21:27:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:23:26Z.

Review: COMMENTED


Review of #1922 at head 8730bc1204 (tier TIER_B_TESTS, file tests/cpu/x87_add.py). No P1/P2 defects.

Commands run locally:

  • git merge-tree --write-tree --name-only origin/main HEAD: no conflicts
  • git diff --check origin/main...HEAD: rc=0
  • python3 tests/docs_links_check.py: rc=0 (18 files, 384 links)
  • python3 tests/bidi_controls_check.py: rc=0 (1345 files)
  • python3 -m py_compile tests/cpu/x87_add.py: rc=0
  • python3 -B tests/cpu/x87_add.py without arguments: rc=1 (needs the fixture DLLs from the build; the changed path cannot run on Linux)

The change wraps getattr(self.lib, name) so a missing export raises an AssertionError that names the stale DLL. It adds no assertion and no new expected value. The only code path it touches is the failure message of a missing export, so there is no mutation of tools/ or src/ logic that this change makes any test fail. Reverting the wrapper only brings back the raw AttributeError.

Result: the change is a diagnostic improvement and does not pass the quality filter for a safe-merge. No receipt written, not merged. The GitHub check "Build and test on Windows" was still pending at review time. A maintainer can merge it by hand if the clearer message is wanted.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6047641172 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1922#pullrequestreview-6047641172). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:23:26Z. **Review:** COMMENTED --- Review of #1922 at head 8730bc1204b3d254d6b3bf643b13f6265b8e399a (tier TIER_B_TESTS, file tests/cpu/x87_add.py). No P1/P2 defects. Commands run locally: - git merge-tree --write-tree --name-only origin/main HEAD: no conflicts - git diff --check origin/main...HEAD: rc=0 - python3 tests/docs_links_check.py: rc=0 (18 files, 384 links) - python3 tests/bidi_controls_check.py: rc=0 (1345 files) - python3 -m py_compile tests/cpu/x87_add.py: rc=0 - python3 -B tests/cpu/x87_add.py without arguments: rc=1 (needs the fixture DLLs from the build; the changed path cannot run on Linux) The change wraps getattr(self.lib, name) so a missing export raises an AssertionError that names the stale DLL. It adds no assertion and no new expected value. The only code path it touches is the failure message of a missing export, so there is no mutation of tools/ or src/ logic that this change makes any test fail. Reverting the wrapper only brings back the raw AttributeError. Result: the change is a diagnostic improvement and does not pass the quality filter for a safe-merge. No receipt written, not merged. The GitHub check "Build and test on Windows" was still pending at review time. A maintainer can merge it by hand if the clearer message is wanted. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 22:00:51 +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!1915
No description provided.