Ignore MASM macros/prefixes and inspect JUnit children in form_coverage #227

Manually merged
github merged 2 commits from gh-pr/227/head into gh-pr/227/base 2026-11-26 21:35:47 +00:00
Owner

@⁠alexander-src on GitHub · 2026-11-21 18:48 UTC · original
alexander-src:fix/form-coverage-masm-junit → main · +41 −11 · 2 files · 2 commits · merged 2026-11-21 19:55 UTC

Change

Fix MASM mnemonic filtering and JUnit testcase child-element handling in tools/form_coverage.py:

  • Add "local" to MASM_DIRECTIVES and track macro names defined via <name> MACRO in masm_mnemonics() so LOCAL declarations and macro invocations (such as plane_request in tests/cpu/bink_descriptors.asm and delta in tests/cpu/working_set_delta.asm) are not reported as unmatched x64 mnemonics. On the current repository fixtures, x64_zen2.fixture_forms_not_in_reference drops from ['delta', 'local', 'plane_request'] to [].
  • Strip leading x64 instruction prefixes (lock, rep, repe, repz, repne, repnz) in masm_mnemonics() so prefixed instructions (e.g. lock cmpxchg, rep movsb) map to their canonical x64_zen2.tsv mnemonics.
  • Check <failure>, <error>, and <skipped> child elements on <testcase> nodes in read_results() so a JUnit case with status="run" and a <failure>, <error>, or <skipped> child is not classified as "pass".
  • Expand check_parsing() in tests/form_coverage_check.py to cover all three cases and assert fixture_forms_not_in_reference == [] on the repository fixtures.

Verification

Run on Linux x86_64 (python3 3.14) against main e8895ad:

  • Ran check_example, check_jump_tables, check_unclassified, check_shader_records, and check_parsing in tests/form_coverage_check.py: all 5 passed.
  • Negative control against main:tools/form_coverage.py: check_parsing() failed on <failure>, <error>, and <skipped> testcases (all reported as "pass"), and measure({})["x64_zen2"]["fixture_forms_not_in_reference"] returned ['delta', 'local', 'plane_request'] vs [] with this change.
  • Not run locally: check_denominators() in tests/form_coverage_check.py requires iced-x86 (not installed in the host Python environment; installed by python-linux CI via requirements-dev.txt), and Windows build-and-test CI (no Windows host).

Evidence and follow-up

All new test inputs in tests/form_coverage_check.py are synthetic MASM and JUnit XML snippets authored inline under the repository's MIT license. No game files or external dumps were used.

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.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes.

**@⁠alexander-src** on GitHub · 2026-11-21 18:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/227) `alexander-src:fix/form-coverage-masm-junit` → `main` · +41 −11 · 2 files · 2 commits · merged 2026-11-21 19:55 UTC ## Change Fix MASM mnemonic filtering and JUnit testcase child-element handling in `tools/form_coverage.py`: - Add `"local"` to `MASM_DIRECTIVES` and track macro names defined via `<name> MACRO` in `masm_mnemonics()` so `LOCAL` declarations and macro invocations (such as `plane_request` in `tests/cpu/bink_descriptors.asm` and `delta` in `tests/cpu/working_set_delta.asm`) are not reported as unmatched x64 mnemonics. On the current repository fixtures, `x64_zen2.fixture_forms_not_in_reference` drops from `['delta', 'local', 'plane_request']` to `[]`. - Strip leading x64 instruction prefixes (`lock`, `rep`, `repe`, `repz`, `repne`, `repnz`) in `masm_mnemonics()` so prefixed instructions (e.g. `lock cmpxchg`, `rep movsb`) map to their canonical `x64_zen2.tsv` mnemonics. - Check `<failure>`, `<error>`, and `<skipped>` child elements on `<testcase>` nodes in `read_results()` so a JUnit case with `status="run"` and a `<failure>`, `<error>`, or `<skipped>` child is not classified as `"pass"`. - Expand `check_parsing()` in `tests/form_coverage_check.py` to cover all three cases and assert `fixture_forms_not_in_reference == []` on the repository fixtures. ## Verification Run on Linux x86_64 (`python3 3.14`) against `main` `e8895ad`: - Ran `check_example`, `check_jump_tables`, `check_unclassified`, `check_shader_records`, and `check_parsing` in `tests/form_coverage_check.py`: all 5 passed. - Negative control against `main:tools/form_coverage.py`: `check_parsing()` failed on `<failure>`, `<error>`, and `<skipped>` testcases (all reported as `"pass"`), and `measure({})["x64_zen2"]["fixture_forms_not_in_reference"]` returned `['delta', 'local', 'plane_request']` vs `[]` with this change. - Not run locally: `check_denominators()` in `tests/form_coverage_check.py` requires `iced-x86` (not installed in the host Python environment; installed by `python-linux` CI via `requirements-dev.txt`), and Windows `build-and-test` CI (no Windows host). ## Evidence and follow-up All new test inputs in `tests/form_coverage_check.py` are synthetic MASM and JUnit XML snippets authored inline under the repository's MIT license. No game files or external dumps were used. ## 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. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:35:47 +00:00
github manually merged commit 8f7457d32b into gh-pr/227/base 2026-11-26 21:35:47 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 19:12 UTC · original

In check_parsing, the final fixture_forms_not_in_reference == [] assertion makes every future source fixture with a genuine unmatched mnemonic fail the parser test. Reporting those forms is a supported outcome of the coverage tool. Please scope the assertion to the macro names and local, or use the isolated fixture already in this test. Keep the prefix and JUnit child-element controls.

**@⁠R0Y00** on GitHub · 2026-11-21 19:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/227#issuecomment-7067846697) In `check_parsing`, the final `fixture_forms_not_in_reference == []` assertion makes every future source fixture with a genuine unmatched mnemonic fail the parser test. Reporting those forms is a supported outcome of the coverage tool. Please scope the assertion to the macro names and `local`, or use the isolated fixture already in this test. Keep the prefix and JUnit child-element controls.
Author
Owner

@⁠alexander-src on GitHub · 2026-11-21 19:17 UTC · original

Good catch. Updated in 8f7457d: check_parsing now checks fixture_forms_not_in_reference == [] on the isolated synthetic fixture, and only asserts that {"delta", "local", "plane_request"} stay out of the full repo's unmatched forms list. Kept the prefix and JUnit child-element checks intact.

**@⁠alexander-src** on GitHub · 2026-11-21 19:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/227#issuecomment-7067912167) Good catch. Updated in `8f7457d`: `check_parsing` now checks `fixture_forms_not_in_reference == []` on the isolated synthetic fixture, and only asserts that `{"delta", "local", "plane_request"}` stay out of the full repo's unmatched forms list. Kept the prefix and JUnit child-element checks intact.
This discussion has been locked. Commenting is limited to contributors.
No description provided.