cpu: reject four import bindings the call translator should refuse #649

Merged
Leyukaka merged 1 commit from upstream-pr/655 into main 2026-11-22 18:31:39 +00:00
Leyukaka commented 2026-11-22 18:02:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T18:02:15Z.


Change

This closes four coverage gaps in resolve_import (tools/cpu_call_aot.py). Each was a one-line mutation that let a binding through that the translator should refuse, and every cpu_ test still passed on main with it applied. Only tests/cpu/import_check.py changes (53 added lines); the translator does not.

The named-import case now also calls resolve_import directly with the parsed import entry of the built fixture, and expects these rejections:

Input Expected error Mutation it covers
symbol MIX_ARGS for import mix_args unbound import symbol compared case-insensitively
module name with a trailing dot unbound import trailing dots stripped before the DLL comparison
a second ordinary import at the same IAT slot no unique ordinary import len(matches) != 1 relaxed to not matches
a copy of the provider whose export section lost IMAGE_SCN_MEM_EXECUTE non-executable export execute bit not checked

The unmodified binding is checked first and must resolve to mix_args, so each rejection is reached with otherwise valid inputs. The modified provider is written to the test's temporary directory.

Verification

On d9c6bf6 (branch on 2bb9ee0), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14:

ctest --preset dev --no-tests=error -j 4

All 292 tests pass.

Each mutation was applied to tools/cpu_call_aot.py one at a time, and all cpu_ tests were run. On main, all of them passed for each mutation. On this branch, each fails cpu_aot_import_call.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (No capability changed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6545808162 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/655). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T18:02:15Z. --- ## Change This closes four coverage gaps in `resolve_import` (`tools/cpu_call_aot.py`). Each was a one-line mutation that let a binding through that the translator should refuse, and every `cpu_` test still passed on `main` with it applied. Only `tests/cpu/import_check.py` changes (53 added lines); the translator does not. The named-import case now also calls `resolve_import` directly with the parsed import entry of the built fixture, and expects these rejections: | Input | Expected error | Mutation it covers | |---|---|---| | symbol `MIX_ARGS` for import `mix_args` | `unbound import` | symbol compared case-insensitively | | module name with a trailing dot | `unbound import` | trailing dots stripped before the DLL comparison | | a second ordinary import at the same IAT slot | `no unique ordinary import` | `len(matches) != 1` relaxed to `not matches` | | a copy of the provider whose export section lost `IMAGE_SCN_MEM_EXECUTE` | `non-executable export` | execute bit not checked | The unmodified binding is checked first and must resolve to `mix_args`, so each rejection is reached with otherwise valid inputs. The modified provider is written to the test's temporary directory. ## Verification On `d9c6bf6` (branch on `2bb9ee0`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14: ```text ctest --preset dev --no-tests=error -j 4 ``` All 292 tests pass. Each mutation was applied to `tools/cpu_call_aot.py` one at a time, and all `cpu_` tests were run. On `main`, all of them passed for each mutation. On this branch, each fails `cpu_aot_import_call`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. (No capability changed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:44:10 +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!649
No description provided.