fix(ci): recognize native test helper libraries #12167

Merged
Queuse merged 1 commit from upstream-pr/12167 into main 2026-11-02 12:29:34 +00:00
Queuse commented 2026-10-28 01:01:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Queuse on 2026-10-28T01:01:27Z.


What

A native helper declared in core/libs/CMakeLists.txt is classified as a product library even when all of its sources are tests. This suppresses consumers such as host_thread_local_tests from the Windows host-only link check.

Use original test-source locations for helper classification, with the existing declaration-directory fallback for targets without original sources. Follow actual linked helpers transitively so private links to product libraries or guest libc still exclude their consumers. Build-order dependencies do not determine this qualification.

Tested

Rebased head 421ce3f49e on main 3a2b919816. The helper-classification patch is unchanged; the rebase retains main's CMake File API validation.

  • Windows 11/Python 3.12.10 and Ubuntu under WSL/Python 3.14.4: focused selector suite passes 19/19 on each platform.
  • Real CMake/Ninja fixtures on Windows/WinLibs GCC 15.2.0 r7 and Ubuntu WSL: a root-declared native shared helper is selected, a helper privately linked to a product library is excluded, and the selected executable links and runs.
  • A clean private merge-tree combination with #12159 head 9d6c2de6f1 passes 25/25 selector tests on both platforms. This is a source-suite check, not a published combined head or full product build.
  • Conventions and whitespace checks pass. The canonical overlap scan checked 1,379 open PRs and reported no overlap.
  • Earlier head 33d17a635b passed the relinker-only build and three focused CTests, plus hosted Windows host-only linking, all four relinker jobs and ASan in run 40612490212. Those results belong to the preceding head.

Hosted run 40793193313 has since passed on rebased head 421ce3f49e: Windows host-only linking, all four relinker jobs and ASan. Linux product, register-context and write-watch jobs were skipped.

Full product, title and GPU tests were not run on this rebase.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5043475229 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12167). Originally posted by [Queuse](https://github.com/Queuse) on 2026-10-28T01:01:27Z. --- ### What A native helper declared in `core/libs/CMakeLists.txt` is classified as a product library even when all of its sources are tests. This suppresses consumers such as `host_thread_local_tests` from the Windows host-only link check. Use original test-source locations for helper classification, with the existing declaration-directory fallback for targets without original sources. Follow actual linked helpers transitively so private links to product libraries or guest libc still exclude their consumers. Build-order dependencies do not determine this qualification. ### Tested Rebased head `421ce3f49e` on main `3a2b919816`. The helper-classification patch is unchanged; the rebase retains main's CMake File API validation. - Windows 11/Python 3.12.10 and Ubuntu under WSL/Python 3.14.4: focused selector suite passes 19/19 on each platform. - Real CMake/Ninja fixtures on Windows/WinLibs GCC 15.2.0 r7 and Ubuntu WSL: a root-declared native shared helper is selected, a helper privately linked to a product library is excluded, and the selected executable links and runs. - A clean private merge-tree combination with #12159 head `9d6c2de6f1` passes 25/25 selector tests on both platforms. This is a source-suite check, not a published combined head or full product build. - Conventions and whitespace checks pass. The canonical overlap scan checked 1,379 open PRs and reported no overlap. - Earlier head `33d17a635b` passed the relinker-only build and three focused CTests, plus hosted Windows host-only linking, all four relinker jobs and ASan in [run 40612490212](https://github.com/boykopovar/AnyPS5/actions/runs/40612490212). Those results belong to the preceding head. Hosted [run 40793193313](https://github.com/boykopovar/AnyPS5/actions/runs/40793193313) has since passed on rebased head `421ce3f49e`: Windows host-only linking, all four relinker jobs and ASan. Linux product, register-context and write-watch jobs were skipped. Full product, title and GPU tests were not run on this rebase. <!-- 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. --> ### 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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
rooklz commented 2026-10-28 01:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T01:17:35Z.

Review: APPROVED


Evidence review (macOS, host-only):

Red/green on a genuine CMake File-API reply. Built a scratch project (core/libs/CMakeLists.txt declaring host_thread_local_test_library SHARED from core/libs/tests/HostThreadLocalLibrary.cpp + host_thread_local_tests exe linking it) and configured with the codemodel-v2 query:

  • base c96d9fff00: No changed host-only core/libs test executables require a link check — the helper is misclassified as a product library by declaration directory and the host test is silently dropped from the lane (the claimed bug, reproduced end-to-end);
  • head 33d17a63: selects host_thread_local_tests.

No false positives. Two control replies: (1) test directly linking a product_lib built from core/libs/utility/src/Utility.cpp — excluded on base AND head; (2) test → test-source helper → product_lib (transitive) — excluded on head via the new BFS. Both stay excluded, so the relaxation does not over-select.

Real-tree parity. On a genuine 42-target relinker-only codemodel reply of this repo, base and head produce byte-identical selections (both empty — relinker-only has no core/libs test exes; the run still proves no over-selection or uncontrolled exception on real data).

Red projection. The 8 new tests against the base tool: exactly the 4 behavior-flip tests fail (root_declared_native_helper, nested_test_directory_helper, order_only_dependency_on_product_target, finite_helper_link_cycle); the other 4 pin pre-existing behaviour (mixed sources, transitive product, helper→guest-libc, no-sources fallback). Module 17/17 on this Mac (macOS runners share the symlinked /var TMPDIR — all probes here ran under it; read_reply resolves consistently, no iter-#12159-style mismatch).

Notes (non-blocking). (a) A core/libs library whose non-generated sources are not all under a tests/ directory is now classified product even when declared under core/libs/tests — stricter than base; direction is conservative (drops lane coverage rather than linking guest code) and pinned by test_excludes_library_with_mixed_test_and_product_sources. (b) The new invalid library sources ValueError lands in main()'s existing catch tuple → controlled exit 1. (c) BFS is O(N²) in targets; 42 targets here → negligible.

pr_overlap for this head vs all open PRs: no overlap; base is an ancestor of current main with zero drift on both touched files.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5676612645 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12167#pullrequestreview-5676612645). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-28T01:17:35Z. **Review:** APPROVED --- Evidence review (macOS, host-only): **Red/green on a genuine CMake File-API reply.** Built a scratch project (`core/libs/CMakeLists.txt` declaring `host_thread_local_test_library` SHARED from `core/libs/tests/HostThreadLocalLibrary.cpp` + `host_thread_local_tests` exe linking it) and configured with the codemodel-v2 query: - base `c96d9fff00`: `No changed host-only core/libs test executables require a link check` — the helper is misclassified as a product library by declaration directory and the host test is silently dropped from the lane (the claimed bug, reproduced end-to-end); - head `33d17a63`: selects `host_thread_local_tests`. **No false positives.** Two control replies: (1) test directly linking a `product_lib` built from `core/libs/utility/src/Utility.cpp` — excluded on base AND head; (2) test → test-source helper → `product_lib` (transitive) — excluded on head via the new BFS. Both stay excluded, so the relaxation does not over-select. **Real-tree parity.** On a genuine 42-target relinker-only codemodel reply of this repo, base and head produce byte-identical selections (both empty — relinker-only has no core/libs test exes; the run still proves no over-selection or uncontrolled exception on real data). **Red projection.** The 8 new tests against the base tool: exactly the 4 behavior-flip tests fail (`root_declared_native_helper`, `nested_test_directory_helper`, `order_only_dependency_on_product_target`, `finite_helper_link_cycle`); the other 4 pin pre-existing behaviour (mixed sources, transitive product, helper→guest-libc, no-sources fallback). Module 17/17 on this Mac (macOS runners share the symlinked /var TMPDIR — all probes here ran under it; `read_reply` resolves consistently, no iter-#12159-style mismatch). **Notes (non-blocking).** (a) A core/libs library whose non-generated sources are not all under a `tests/` directory is now classified product even when declared under `core/libs/tests` — stricter than base; direction is conservative (drops lane coverage rather than linking guest code) and pinned by `test_excludes_library_with_mixed_test_and_product_sources`. (b) The new `invalid library sources` ValueError lands in main()'s existing catch tuple → controlled exit 1. (c) BFS is O(N²) in targets; 42 targets here → negligible. pr_overlap for this head vs all open PRs: no overlap; base is an ancestor of current main with zero drift on both touched files.
THEMANnt commented 2026-10-28 04:30:15 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed 33d17a635b77b13fecfb8d82a197b47faec90143 — approve. Native test-helper libraries are classified by their original sources, while product/guest-libc links are still excluded transitively.

Windows/Python 3.11: head 17 passed (17 total); author base 9 passed (9 total). Current tests against old production fail four helper-selection assertions. The suite covers mixed sources, nested helpers, order-only dependencies and cycles. This tests the selection graph, not every selected native executable.

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:5677804053 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12167#pullrequestreview-5677804053). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-28T04:30:15Z. **Review:** APPROVED --- Reviewed `33d17a635b77b13fecfb8d82a197b47faec90143` — approve. Native test-helper libraries are classified by their original sources, while product/guest-libc links are still excluded transitively. Windows/Python 3.11: head 17 passed (17 total); author base 9 passed (9 total). Current tests against old production fail four helper-selection assertions. The suite covers mixed sources, nested helpers, order-only dependencies and cycles. This tests the selection graph, not every selected native executable. 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 10:05:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T10:05:53Z.

Review: CHANGES_REQUESTED


The implementation, test evidence, and compatibility review look sound. Current-main freshness remains: live main is 3a40945e62 and head 33d17a635b is 474 commits behind it (merge base c96d9fff00). Please rebase and rerun the focused Python suite/conventions checks before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680891580 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12167#pullrequestreview-5680891580). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T10:05:53Z. **Review:** CHANGES_REQUESTED --- The implementation, test evidence, and compatibility review look sound. Current-main freshness remains: live `main` is `3a40945e62` and head `33d17a635b` is 474 commits behind it (merge base `c96d9fff00`). Please rebase and rerun the focused Python suite/conventions checks before merge.
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!12167
No description provided.