test(libkernel_sys): cover raw getcwd internal path limit #16414

Closed
ahmadmuj wants to merge 1 commit from upstream-pr/16414 into main
ahmadmuj commented 2026-11-06 16:28:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T16:28:05Z.


What

Adds a standalone Linux test for the raw getcwd internal path limit from #16370. Existing short-path tests miss this boundary.

Guest paths of 1023 bytes must succeed with exact bytes and NUL. Paths of 1024 bytes must return ENOMEM (12).
Both use caller capacity 4096. The test checks all output sentinels and ENOMEM precedence over a null output pointer.
It uses an isolated directory tree and restores both working directories before removing that tree.

The contract follows FreeBSD 11.4's cap and copyout order.
This adds coverage only. The parent keeps its production changes and existing test cases.

Tested

Ubuntu 24.04.2 under WSL2, x86-64 Intel Core i7-13700K, GCC 13.3, Release.

  • Tested main: bfbb25cb725a74f1ca7413adc9237f3542c48bb3.
  • This head: ee6e8b6a7ede17f4d272e7a6e69ce97045e64537.
  • Parent #16370: c9708515bdeffcd9d6dc89bb154e5620f9d9abcd.
  • Tested integration tree: c3a9a330a99beaeda1cd1be72e390f0a412a092e.

Publication refresh: main 9a4320c062d202ac74f23dd4f648d77590c84742 merges cleanly with this branch.
Its two newer files are outside both test targets. Runtime results below remain pinned to the tested main.

The branch starts on main. Parent changes are present only in the separate integration build.
Both source snapshots match all 6796 files from their declared Git trees, with pinned dependency sources.
The new test intentionally fails without #16370. Please merge that dependency first, or select both PRs for CI.

Build Existing guest_kernel_sys New guest_raw_getcwd_cap
Main / this head without parent Pass Fails at the 1024-byte boundary
This head with parent integrated Pass Pass
Integration with only ERANGE-to-ENOMEM mapping removed Pass Fails both ENOMEM assertions
Restored integration Pass Pass

The mutation replaces only Fail(error == GuestErange ? GuestEnomem : error) with Fail(error).
Source bytes restore, and both test executables stay unchanged across the mutation. No fixture directories remain.
Each CTest finishes below one second; the new test has a 20-second timeout.

Commands from the contribution workspace:

cmake --build builds/anyps5-raw-getcwd-cap-regression/current/main --target guest_kernel_sys_tests guest_raw_getcwd_cap_tests -j 16
ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/main -R '^guest_kernel_sys$' -V
ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/main -R '^guest_raw_getcwd_cap$' -V
cmake --build builds/anyps5-raw-getcwd-cap-regression/current/integrated --target guest_kernel_sys_tests guest_raw_getcwd_cap_tests -j 16
ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/integrated -R '^(guest_kernel_sys|guest_raw_getcwd_cap)$' -V

Builds use an environment without credential variables. Both targets link the actual guest libraries from their selected build.
Conventions pass. The complete overlap tool reports no confirmed collision, but cannot compare 16 branches that conflict with main.
I checked each shared CMake diff at its exact head. They change other registrations or library setup; none adds this test.
Those PRs are #5021, #7275, #8650, #9156, #9293, #9297, #9302, #9383, #12642, #13486, #14304, #14798, #15111, #15804, #15807 and #15836.
Full suite, Windows, macOS, titles and console behavior are not tested. This CPU-only change needs no GPU run.

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: #16370
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5191104027 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16414). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-06T16:28:05Z. --- ### What Adds a standalone Linux test for the raw getcwd internal path limit from #16370. Existing short-path tests miss this boundary. Guest paths of 1023 bytes must succeed with exact bytes and NUL. Paths of 1024 bytes must return ENOMEM (12). Both use caller capacity 4096. The test checks all output sentinels and ENOMEM precedence over a null output pointer. It uses an isolated directory tree and restores both working directories before removing that tree. The contract follows [FreeBSD 11.4's cap and copyout order](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/sys/kern/vfs_cache.c#L2130-L2179). This adds coverage only. The parent keeps its production changes and existing test cases. ### 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. --> Ubuntu 24.04.2 under WSL2, x86-64 Intel Core i7-13700K, GCC 13.3, Release. - Tested main: `bfbb25cb725a74f1ca7413adc9237f3542c48bb3`. - This head: `ee6e8b6a7ede17f4d272e7a6e69ce97045e64537`. - Parent #16370: `c9708515bdeffcd9d6dc89bb154e5620f9d9abcd`. - Tested integration tree: `c3a9a330a99beaeda1cd1be72e390f0a412a092e`. Publication refresh: main `9a4320c062d202ac74f23dd4f648d77590c84742` merges cleanly with this branch. Its two newer files are outside both test targets. Runtime results below remain pinned to the tested main. The branch starts on main. Parent changes are present only in the separate integration build. Both source snapshots match all 6796 files from their declared Git trees, with pinned dependency sources. The new test intentionally fails without #16370. Please merge that dependency first, or select both PRs for CI. | Build | Existing `guest_kernel_sys` | New `guest_raw_getcwd_cap` | |---|---|---| | Main / this head without parent | Pass | Fails at the 1024-byte boundary | | This head with parent integrated | Pass | Pass | | Integration with only ERANGE-to-ENOMEM mapping removed | Pass | Fails both ENOMEM assertions | | Restored integration | Pass | Pass | The mutation replaces only `Fail(error == GuestErange ? GuestEnomem : error)` with `Fail(error)`. Source bytes restore, and both test executables stay unchanged across the mutation. No fixture directories remain. Each CTest finishes below one second; the new test has a 20-second timeout. Commands from the contribution workspace: ```sh cmake --build builds/anyps5-raw-getcwd-cap-regression/current/main --target guest_kernel_sys_tests guest_raw_getcwd_cap_tests -j 16 ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/main -R '^guest_kernel_sys$' -V ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/main -R '^guest_raw_getcwd_cap$' -V cmake --build builds/anyps5-raw-getcwd-cap-regression/current/integrated --target guest_kernel_sys_tests guest_raw_getcwd_cap_tests -j 16 ctest --test-dir builds/anyps5-raw-getcwd-cap-regression/current/integrated -R '^(guest_kernel_sys|guest_raw_getcwd_cap)$' -V ``` Builds use an environment without credential variables. Both targets link the actual guest libraries from their selected build. Conventions pass. The complete overlap tool reports no confirmed collision, but cannot compare 16 branches that conflict with main. I checked each shared CMake diff at its exact head. They change other registrations or library setup; none adds this test. Those PRs are #5021, #7275, #8650, #9156, #9293, #9297, #9302, #9383, #12642, #13486, #14304, #14798, #15111, #15804, #15807 and #15836. Full suite, Windows, macOS, titles and console behavior are not tested. This CPU-only change needs no GPU run. ### 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 --> #16370 - [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
gabichuuuuu commented 2026-11-08 21:44:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T21:44:13Z.

Review: COMMENTED


Windows run of head ee6e8b6a7e, merged onto main 095ff72367 in one tree with other open PRs that touch different files (each PR's test is its own file, so they don't interact). Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release, BUILD_TESTING=ON.

  • Not run: guest_raw_getcwd_cap_tests is registered only when CMAKE_SYSTEM_NAME is Linux, so a Windows build has no such target.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819794249 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16414#pullrequestreview-5819794249). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T21:44:13Z. **Review:** COMMENTED --- Windows run of head `ee6e8b6a7e`, merged onto `main` `095ff72367` in one tree with other open PRs that touch different files (each PR's test is its own file, so they don't interact). Setup: Windows 11, WinLibs GCC 15.2 r7 (`x86_64-ucrt-posix-seh`, the CI toolchain), Release, `BUILD_TESTING=ON`. - Not run: `guest_raw_getcwd_cap_tests` is registered only when `CMAKE_SYSTEM_NAME` is `Linux`, so a Windows build has no such target.

Pull request closed

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!16414
No description provided.