fix(tools): reject a sanitizer report that lists a test twice #12226

Merged
rooklz merged 1 commit from upstream-pr/12226 into main 2026-10-28 23:10:13 +00:00
rooklz commented 2026-10-28 03:58:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T03:58:28Z.


What

sanitizer_report.results() stored each JUnit testcase in a dict keyed by its name, so when a report listed the same test twice the later entry silently replaced the earlier one. A report with fiber failing and then fiber passing was summarized as 1 tests: 1 passed, 0 skipped, 0 failed. and exited 0, so the nightly Sanitizers job could hide a real failure. The order also mattered: with the two entries swapped the same data counted as failed. results() now refuses a report that lists a test name more than once, using the existing unreadable-report path (sanitizer_report: <file>: testcase <name> is listed more than once, exit 2, nothing written to stdout or --summary). This also covers a testsuites root whose nested suites repeat a name. Reports with unique names are classified as before.

Tested

macOS 26.2, Apple M5 (arm64), CMake/Ninja, ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON (Python 3.13). Base: 2a81f0969f (upstream/main), head: 792c8791f0.

Measured on base: <testsuite><testcase name="a" status="run"><failure/></testcase><testcase name="a" status="run"/></testsuite> printed 1 tests: 1 passed, 0 skipped, 0 failed. and returned 0.

Real ctest 4.3.1 output: --repeat until-pass:3 and --repeat until-fail:2 both write one testcase per test (the final attempt only). Duplicates therefore do not appear in reports ctest writes, so this refusal does not affect today's workflow input. It only stops a merged or hand-edited report from hiding a failure.

tools/tests/test_sanitizer_report.py test_a_test_listed_twice_is_rejected covers fail-then-pass, pass-then-fail, pass-pass and a duplicate across nested testsuites. Each case exits 2 with an empty stdout and leaves --summary untouched. Red on base source (4 failures in the new test), green at head, 22/22. Full relinker ctest 366/366. check_conventions.py --base upstream/main PASS. pr_overlap.py --branch fix/sanitizer-report-duplicate-tests clean (#12096 touches main(), a disjoint hunk; it merges cleanly). Host-only tools change. No title, GPU or console involved.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#12096 touches the same files; hunks disjoint, pr_overlap clean)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5044979792 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12226). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-28T03:58:28Z. --- ### What `sanitizer_report.results()` stored each JUnit `testcase` in a dict keyed by its name, so when a report listed the same test twice the later entry silently replaced the earlier one. A report with `fiber` failing and then `fiber` passing was summarized as `1 tests: 1 passed, 0 skipped, 0 failed.` and exited 0, so the nightly Sanitizers job could hide a real failure. The order also mattered: with the two entries swapped the same data counted as failed. `results()` now refuses a report that lists a test name more than once, using the existing unreadable-report path (`sanitizer_report: <file>: testcase <name> is listed more than once`, exit 2, nothing written to stdout or `--summary`). This also covers a `testsuites` root whose nested suites repeat a name. Reports with unique names are classified as before. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> macOS 26.2, Apple M5 (arm64), CMake/Ninja, `ANYPS5_RELINKER_ONLY=ON`, `BUILD_TESTING=ON` (Python 3.13). Base: `2a81f0969f` (`upstream/main`), head: `792c8791f0`. Measured on base: `<testsuite><testcase name="a" status="run"><failure/></testcase><testcase name="a" status="run"/></testsuite>` printed `1 tests: 1 passed, 0 skipped, 0 failed.` and returned 0. Real ctest 4.3.1 output: `--repeat until-pass:3` and `--repeat until-fail:2` both write one `testcase` per test (the final attempt only). Duplicates therefore do not appear in reports ctest writes, so this refusal does not affect today's workflow input. It only stops a merged or hand-edited report from hiding a failure. `tools/tests/test_sanitizer_report.py` `test_a_test_listed_twice_is_rejected` covers fail-then-pass, pass-then-fail, pass-pass and a duplicate across nested `testsuite`s. Each case exits 2 with an empty stdout and leaves `--summary` untouched. Red on base source (4 failures in the new test), green at head, 22/22. Full relinker ctest 366/366. `check_conventions.py --base upstream/main` PASS. `pr_overlap.py --branch fix/sanitizer-report-duplicate-tests` clean (#12096 touches `main()`, a disjoint hunk; it merges cleanly). Host-only tools change. No title, GPU or console involved. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none (#12096 touches the same files; hunks disjoint, `pr_overlap` clean) - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-28 04:01:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T04:01:45Z.

Review: APPROVED


I reviewed the exact head and ran python3 -m unittest tools.tests.test_sanitizer_report: 22 tests passed. tools/check_conventions.py --base refs/review/main, git diff --check and a merge preview with current main all pass. The duplicate rejection occurs before any summary output or write, and the test covers both orderings, duplicate passes and duplicates across nested suites. No blocking issue found. Hosted conventions, intake and labels pass; the relinker matrix was still pending, and full platform builds are path-skipped for this Python-only change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677639897 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12226#pullrequestreview-5677639897). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T04:01:45Z. **Review:** APPROVED --- I reviewed the exact head and ran `python3 -m unittest tools.tests.test_sanitizer_report`: 22 tests passed. `tools/check_conventions.py --base refs/review/main`, `git diff --check` and a merge preview with current `main` all pass. The duplicate rejection occurs before any summary output or write, and the test covers both orderings, duplicate passes and duplicates across nested suites. No blocking issue found. Hosted conventions, intake and labels pass; the relinker matrix was still pending, and full platform builds are path-skipped for this Python-only change.
THEMANnt commented 2026-10-28 04:29:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T04:29:37Z.

Review: APPROVED


Reviewed 792c8791f0fb1487b64ce519788df5d0afde1f83 — approve. Duplicate JUnit testcase names are rejected rather than letting a later pass hide an earlier failure.

Windows/Python 3.11: head 22 passed (22 total); author base 21 passed (21 total). The new duplicate-order/nested-suite cases distinguish old production, and the complete head suite passes. The refusal is for merged or hand-edited reports; ordinary unique-name CTest output is retained. No nightly sanitizer run was performed locally.

The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677800297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12226#pullrequestreview-5677800297). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-28T04:29:37Z. **Review:** APPROVED --- Reviewed `792c8791f0fb1487b64ce519788df5d0afde1f83` — approve. Duplicate JUnit testcase names are rejected rather than letting a later pass hide an earlier failure. Windows/Python 3.11: head 22 passed (22 total); author base 21 passed (21 total). The new duplicate-order/nested-suite cases distinguish old production, and the complete head suite passes. The refusal is for merged or hand-edited reports; ordinary unique-name CTest output is retained. No nightly sanitizer run was performed locally. The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.
MarcZX10 commented 2026-10-28 09:02:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T09:02:07Z.

Review: APPROVED


Rejecting a duplicate testcase name prevents the dict from silently discarding one result and hiding a failure, regardless of ordering or whether duplicate names are in nested suites. The tests cover fail/pass orderings, duplicate passes, nested suites, and the no-summary-on-error behavior; the report notes that normal CTest output does not use duplicate entries. Current relinker/ASan and conventions checks pass. No blocking issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680112565 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12226#pullrequestreview-5680112565). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T09:02:07Z. **Review:** APPROVED --- Rejecting a duplicate testcase name prevents the dict from silently discarding one result and hiding a failure, regardless of ordering or whether duplicate names are in nested suites. The tests cover fail/pass orderings, duplicate passes, nested suites, and the no-summary-on-error behavior; the report notes that normal CTest output does not use duplicate entries. Current relinker/ASan and conventions checks pass. No blocking issue found.
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
boykopovar/AnyPS5!12226
No description provided.