test(libkernel): cover invalid clock ID in clock_gettime #14618

Merged
slopgobblercobbler merged 1 commit from upstream-pr/14618 into main 2026-11-02 22:40:24 +00:00
slopgobblercobbler commented 2026-11-01 16:26:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-11-01T16:26:02Z.


What

Validate clock IDs in clock_gettime_nid_postfix so that out-of-bounds IDs (< 0 and not CPU clock, or >= 32) return -1 with errno EINVAL (22), and add test coverage for invalid clock IDs (-1, 999) returning EINVAL / SCE_KERNEL_ERROR_EINVAL in GuestFreebsdClocks.cpp.

Tested

Ran python tools/check_conventions.py --base upstream/main --head HEAD with 0 findings.

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:5109253352 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14618). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-11-01T16:26:02Z. --- ### What Validate clock IDs in clock_gettime_nid_postfix so that out-of-bounds IDs (< 0 and not CPU clock, or >= 32) return -1 with errno EINVAL (22), and add test coverage for invalid clock IDs (-1, 999) returning EINVAL / SCE_KERNEL_ERROR_EINVAL in GuestFreebsdClocks.cpp. ### Tested Ran python tools/check_conventions.py --base upstream/main --head HEAD with 0 findings. ### Checklist - [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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-01 16:33:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T16:33:29Z.

Review: COMMENTED


Reviewed — no blocking findings

I reviewed head 4e913b7444674e75fd2b21512b314f12d2c18cae; the invalid-ID path and its assertions are consistent, but hosted checks remain queued.

What I ran

Base: f2d874c1fdccf781c0fa5d86619bb5dd8894b958 (main); stack preview merged cleanly. Environment: Debian 12, Python 3.11.2, GCC 12.2.0. No build or C++ tests were run.

git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958 4e913b7444674e75fd2b21512b314f12d2c18cae
/usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --title test(libkernel): cover invalid clock ID in clock_gettime --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/pr-body.md
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --json
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestFreebsdClocks.cpp
python3 tools/pr_stack_check.py 14618 --repo boykopovar/AnyPS5
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14618

I read both changed files and verified the existing CMake registration. The precheck's two helper invocations failed because its detached snapshot lacks the workspace-only scripts; I ran both helpers separately against the exact head.

Results

Check Result Note
Diff and conventions passed No whitespace or convention findings
ABI audit passed No findings
Test registration passed Existing CMake entry registers this test
Test-quality heuristic passed Warning is a false positive; manual CMake inspection confirms registration
Stack preview passed Clean against current base
Hosted CI not run Six jobs are queued
C++ build/tests not run No-build first review
Precheck report check table (verbatim)
| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` |
| diff_check | passed | `git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...4e913b7444674e75fd2b21512b314f12d2c18cae` |
| conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --title test(libkernel): cover invalid clock ID in clock_gettime --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/pr-body.md` |
| changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --json` |
| python_syntax | not_applicable | `No changed Python implementation files.` |
| related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` |
| python_test_registration | not_applicable | `No changed test_*.py files.` |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14618 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/stack` |
| build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` |
| test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/head-4e913b744467-6529480b/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/head-4e913b744467-6529480b --json core/libs/prx/libkernel/Time/Time.cpp core/libs/tests/GuestFreebsdClocks.cpp` |
| negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` |

Negative control

Not run: the changed C++ behavior requires an exact-head binary. The new test checks both the direct libc-style result (-1 and EINVAL) and the guest wrapper error, and checks that the output remains unchanged.

Findings

Blocking

None found in the two changed files.

Non-blocking

The test-quality heuristic does not recognize the existing macro-based registration; core/libs/prx/libkernel/CMakeLists.txt registers GuestFreebsdClocks.cpp as guest_freebsd_clocks.

Sources

Not verified

I did not build or execute this C++ test, nor verify behavior on Windows, macOS, or a console. Hosted CI was queued at review time.

To get this to a good state

No code change is indicated. Allow the six hosted checks to complete; I will recheck the exact head and results before approving.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729105878 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14618#pullrequestreview-5729105878). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T16:33:29Z. **Review:** COMMENTED --- # Reviewed — no blocking findings I reviewed head `4e913b7444674e75fd2b21512b314f12d2c18cae`; the invalid-ID path and its assertions are consistent, but hosted checks remain queued. ## What I ran Base: `f2d874c1fdccf781c0fa5d86619bb5dd8894b958` (`main`); stack preview merged cleanly. Environment: Debian 12, Python 3.11.2, GCC 12.2.0. No build or C++ tests were run. ```text git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958 4e913b7444674e75fd2b21512b314f12d2c18cae /usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --title test(libkernel): cover invalid clock ID in clock_gettime --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/pr-body.md python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --json python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestFreebsdClocks.cpp python3 tools/pr_stack_check.py 14618 --repo boykopovar/AnyPS5 python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14618 ``` I read both changed files and verified the existing CMake registration. The precheck's two helper invocations failed because its detached snapshot lacks the workspace-only scripts; I ran both helpers separately against the exact head. ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | No whitespace or convention findings | | ABI audit | passed | No findings | | Test registration | passed | Existing CMake entry registers this test | | Test-quality heuristic | passed | Warning is a false positive; manual CMake inspection confirms registration | | Stack preview | passed | Clean against current base | | Hosted CI | not run | Six jobs are queued | | C++ build/tests | not run | No-build first review | <details><summary>Precheck report check table (verbatim)</summary> ```text | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...4e913b7444674e75fd2b21512b314f12d2c18cae` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --title test(libkernel): cover invalid clock ID in clock_gettime --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 4e913b7444674e75fd2b21512b314f12d2c18cae --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14618 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/head-4e913b744467-6529480b/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14618-4e913b744467/head-4e913b744467-6529480b --json core/libs/prx/libkernel/Time/Time.cpp core/libs/tests/GuestFreebsdClocks.cpp` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ``` </details> ## Negative control Not run: the changed C++ behavior requires an exact-head binary. The new test checks both the direct libc-style result (`-1` and `EINVAL`) and the guest wrapper error, and checks that the output remains unchanged. ## Findings ### Blocking None found in the two changed files. ### Non-blocking The test-quality heuristic does not recognize the existing macro-based registration; `core/libs/prx/libkernel/CMakeLists.txt` registers `GuestFreebsdClocks.cpp` as `guest_freebsd_clocks`. ## Sources - [Clock ID validation and wrapper at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/4e913b7444674e75fd2b21512b314f12d2c18cae/core/libs/prx/libkernel/Time/Time.cpp) - [Invalid-ID regression assertions at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/4e913b7444674e75fd2b21512b314f12d2c18cae/core/libs/tests/GuestFreebsdClocks.cpp) - [Existing test registration at the reviewed base](https://github.com/boykopovar/AnyPS5/blob/f2d874c1fdccf781c0fa5d86619bb5dd8894b958/core/libs/prx/libkernel/CMakeLists.txt) ## Not verified I did not build or execute this C++ test, nor verify behavior on Windows, macOS, or a console. Hosted CI was queued at review time. ## To get this to a good state No code change is indicated. Allow the six hosted checks to complete; I will recheck the exact head and results before approving.
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!14618
No description provided.