Skip to content

build(cmake): include the libkernel test fragments only when BUILD_TESTING is on - #1634

Open
Thimo188 wants to merge 3 commits into
mainfrom
upstream-pr/27717
Open

Thimo188 wants to merge 3 commits into
mainfrom
upstream-pr/27717

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#27717, originally opened by milescoviello.

Source commit: aaca612fae86a71968583139e117c56ffadb83db. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

libkernel includes every tests/cmake/*.cmake fragment at the top level of its CMakeLists.txt, outside if(BUILD_TESTING), so each fragment has to gate itself. On main 520d66172a, 2 of the 26 libkernel fragments have no BUILD_TESTING in them, so a -DBUILD_TESTING=OFF configure still defines their test executables, and a fragment that used something defined only with tests on would break that configure.

This moves libkernel's file(GLOB ...)/include loop inside if(BUILD_TESTING), so the fragments are read only when tests are on. A fragment that already gates itself is unchanged; its own if(BUILD_TESTING) just nests.

This is the libkernel part of boykopovar#20899, split out after the Windows job of the combined pull request was cancelled at its 90 minute limit on 11-24 and 11-26. Correction (11-27): I split these changes so that each Windows job would select only one library's tests, but that premise was wrong. tools/build_changed_guest_tests.py treats a change to any CMakeLists.txt under core/libs/ as a broad change and selects every guest test, so each of boykopovar#20899, boykopovar#27716 and boykopovar#27717 still selects the full set (3,619 targets on boykopovar#27716). Whether the Windows job fits its 90 minutes may depend on the runner (I have three runs): on 11-27 it passed in 86 minutes on boykopovar#20899 and was cancelled at 90 minutes on boykopovar#27716, and on 11-28 it was cancelled at 90 minutes on boykopovar#27717 (head aaca612fae). This branch's commit message repeats the same wrong premise ("selects only libkernel's tests"); this correction applies to it too. It was stacked on boykopovar#26695, which moved the guest_kernel_sockname_truncation_bounds block into the test section next to this loop; boykopovar#26695 merged on 11-27, and the branch now has main merged in, so its diff is only this change.

Tested

11-27, head aaca612fae (main 65cf7ea917 merged in after boykopovar#26695 merged, so the diff is now only the if(BUILD_TESTING) wrap): with -DBUILD_TESTING=ON, ctest -N lists the same 7,192 tests on main and on this head; with OFF the default all target builds 28 *_tests executables against 30 on main, the 2 dropped being guest_exec_variadic_tests and guest_mkfifo_tests from the ungated fragments. (These are this check's measured counts; they differ from the earlier 26 against 30 below because main has changed since 520d66172a, including boykopovar#26695.)

Earlier, configure-only checks on main 520d66172a (Linux, GCC 15.2, Ninja, Release, -DANYPS5_ENABLE_SPIRV_TOOLS=OFF), at this branch's head (boykopovar#26695 plus this change):

  • -DBUILD_TESTING=ON: ctest -N lists the same 7,094 tests on main and on this branch, and the sorted test-name lists are identical.
  • -DBUILD_TESTING=OFF: configures on both. ninja -t targets all lists 2,934 *_tests executables here against 2,946 on main, and the default all target (ninja -t inputs all) builds 26 of them here against 30 on main. Of the 4 dropped from all, guest_exec_variadic_tests and guest_mkfifo_tests come from the 2 ungated fragments, and guest_kernel_socket_type_error_readonly_bounds_tests and guest_kernel_sockname_truncation_bounds_tests from fix(libkernel): keep the sockname truncation bounds test inside BUILD_TESTING boykopovar/AnyPS5#26695's move.
  • tools/check_conventions.py passes.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (it was stacked on fix(libkernel): keep the sockname truncation bounds test inside BUILD_TESTING boykopovar/AnyPS5#26695, which merged on 11-27)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (build-only change)
  • AI-assisted: yes

Summary by CodeRabbit

  • Build
    • Test-related build configuration is now included only when testing is enabled, keeping non-testing builds free of test configuration.

milescoviello and others added 3 commits November 26, 2026 23:51
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…STING is on

libkernel includes every `tests/cmake/*.cmake` fragment at the top level of its `CMakeLists.txt`, outside `if(BUILD_TESTING)`, so each fragment has to gate itself. On `main` `520d66172a`, 2 of the 26 libkernel fragments have no `BUILD_TESTING` in them, so a `-DBUILD_TESTING=OFF` configure still defines their test executables, and a fragment that used something defined only with tests on would break that configure.

This moves libkernel's `file(GLOB ...)`/`include` loop inside `if(BUILD_TESTING)`, so the fragments are read only when tests are on. A fragment that already gates itself is unchanged; its own `if(BUILD_TESTING)` just nests.

This is the libkernel part of boykopovar#20899, split out so that the Windows job selects only libkernel's tests (with three libraries in one pull request it was cancelled at its 90 minute limit on 11-24 and 11-26). It is stacked on boykopovar#26695, which moves the `guest_kernel_sockname_truncation_bounds` block into the test section next to this loop; until boykopovar#26695 merges, this branch also shows that commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: libkernel test setup

Layer / File(s) Summary
Gate test-fragment setup
core/libs/prx/libkernel/CMakeLists.txt
Test-fragment discovery, sorting, and inclusion now run only when BUILD_TESTING is enabled.

Change: Bug fix

Merge Risk: Minimal · up to aaca6

This change stops libkernel from defining test executables when testing is disabled, so non-test builds do less work. Test-enabled builds are unchanged. No merge-blocking risk was identified.

Architecture risk: Low · up to aaca6

Test-fragment setup moved behind the BUILD_TESTING condition.

Changed areas: core

Review details

Systems and components

  • observed — 1 changed file mapped to core.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 1
  • Waived: $0.25 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 366b0605-652e-40bc-b3fb-beea7fba8e1f
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and aaca612.

Files selected for processing: 1

  • core/libs/prx/libkernel/CMakeLists.txt

Limit details: You’ve used all 10 included reviews currently available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants