test(libwebrtc): cover odd-width rate bucket rounding #16419

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

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


What

Adds a Linux regression for odd-width RateTracker bucket rounding, after #16381.
The parent's valid fixtures use 100ms buckets, where floor-half and ceil-half both equal 50.
This test uses a 3ms bucket, one retained bucket, a controlled clock, and the real exports and default guest heap.
One sample at time 0 must yield zero at time 5. A ceil-half mutation incorrectly yields 1000.0 / 3.0.

The topic contains only the new test and its additive registration. It needs #16381 to build.
It does not copy or change that PR's production code, headers, fixture, or targets.
The expected arithmetic follows WebRTC rate_tracker.cc.
This does not establish console behavior.

Tested

Ubuntu 24.04.2 LTS under WSL2, x86-64 i7-13700K, GCC 13.3.0, Release.

  • Tested main: 23d549a9c7b9994e14f76fcb96ff2c92a5a1beec. A separate probe uses main's declarations and confirms its constructor throws not implemented. This proves absence only.
  • Parent #16381: 533e376f517a7a54372bdaa2057cb5a77bf5bf42. Its registered fixture and this new test both pass against the exact parent modules.
  • Test head: 83ba1bff597347eb23cae84ed9e26b091c69bb39. The final build integrates main, that exact parent, and this topic.
  • Local integration commit: 45e24ed200f69e5a31219dd86861a61fa319d099; tree: 89f3053593b977847032682be0b78026d577e167. All 6,801 tracked source files match this tree. Parent production and fixture bytes remain unchanged.

The integrated CTest run passes 2/2. The new test asserts exact binary64 values with FE_TONEAREST:

Clock, ms Expected rate
Before initialization; then 0, 1, 2 0.0
3, 4 1000.0 / 3.0
5, 6 0.0
9, after adding seven samples at 6 7000.0 / 3.0

Mutation: change only production bucketMilliseconds >> 1 to (bucketMilliseconds + 1) >> 1.
The unchanged parent fixture still passes. The new test fails first at time 5: 333.33333333333331, expected 0.
Direct D1 cleanup completes on success and the expected failure. After restoration, 2/2 pass again.
Both test executables remain fixed through mutation. Restored module and executable hashes match the baseline.
Loader traces confirm the final executable loads the integration's libwebrtc and libc.
Each test finishes below 0.01 seconds; the registered timeout is 20 seconds.

Final integration and mutation commands (W is the integration source; B is its build).
Builds hold the shared lock and run without credential variables:

cmake -S "$W" -B "$B" -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFFMPEG_PREBUILT_DIR=/home/ahmad/work/anyps5/builds/main/externals/ffmpeg-9ac4cfd195f1
cmake --build "$B" --target guest_webrtc_rate_tracker_tests guest_webrtc_rate_tracker_odd_bucket_tests -j 16
ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker(_odd_bucket)?$' -V
ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker$' -V
ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker_odd_bucket$' -V
python3 tools/check_conventions.py --base origin/main
python3 tools/pr_overlap.py --branch fix/anyps5-ratetracker-odd-bucket-regression --repo boykopovar/AnyPS5

The exact-parent control builds guest_webrtc_rate_tracker_tests, runs ctest -R '^guest_webrtc_rate_tracker$' -V,
and compiles the new fixture directly with g++ -std=c++20 -O2 -fno-fast-math -fno-reciprocal-math -frounding-math,
the parent include directory, and its libwebrtc/libc paths and rpath. That executable passes all nine checks.
The main control builds libwebrtc libc and links a small probe against those exact main modules and declarations.
It calls the no-argument constructor stub and requires the not implemented exception. It does not compile the new fixture on main.

Conventions pass. The complete ownership audit finds no competing odd-bucket test; shared CMake additions concern other targets.
The overlap tool exits 2 because #15154, #15211, and #15285 conflict with main.
Full manual comparison confirms their CurrentThreadId, LogMessage/PendingTaskSafetyFlag, and FieldTrial registrations are disjoint.
No full product build, full suite, Windows/macOS run, title, console, allocator leak check, or GPU test is claimed.
This is CPU coverage. Maintainer CI remains external.

Publication refresh: main advances to 2a696e1eade4fafffb2d22f7979748f6fe078d98 after the tests.
Its full delta changes only unrelated AGC files and documentation; no inputs of these CPU tests change.
The topic and exact parent still merge cleanly with that head. This is a source merge check, not another runtime result.

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: #16381
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5191462065 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16419). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-06T16:54:12Z. --- ### What Adds a Linux regression for odd-width RateTracker bucket rounding, after #16381. The parent's valid fixtures use 100ms buckets, where floor-half and ceil-half both equal 50. This test uses a 3ms bucket, one retained bucket, a controlled clock, and the real exports and default guest heap. One sample at time 0 must yield zero at time 5. A ceil-half mutation incorrectly yields `1000.0 / 3.0`. The topic contains only the new test and its additive registration. It needs #16381 to build. It does not copy or change that PR's production code, headers, fixture, or targets. The expected arithmetic follows [WebRTC rate_tracker.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/rate_tracker.cc). This does not establish console behavior. ### Tested Ubuntu 24.04.2 LTS under WSL2, x86-64 i7-13700K, GCC 13.3.0, Release. - Tested main: `23d549a9c7b9994e14f76fcb96ff2c92a5a1beec`. A separate probe uses main's declarations and confirms its constructor throws `not implemented`. This proves absence only. - Parent #16381: `533e376f517a7a54372bdaa2057cb5a77bf5bf42`. Its registered fixture and this new test both pass against the exact parent modules. - Test head: `83ba1bff597347eb23cae84ed9e26b091c69bb39`. The final build integrates main, that exact parent, and this topic. - Local integration commit: `45e24ed200f69e5a31219dd86861a61fa319d099`; tree: `89f3053593b977847032682be0b78026d577e167`. All 6,801 tracked source files match this tree. Parent production and fixture bytes remain unchanged. The integrated CTest run passes 2/2. The new test asserts exact binary64 values with FE_TONEAREST: | Clock, ms | Expected rate | | --- | --- | | Before initialization; then 0, 1, 2 | `0.0` | | 3, 4 | `1000.0 / 3.0` | | 5, 6 | `0.0` | | 9, after adding seven samples at 6 | `7000.0 / 3.0` | Mutation: change only production `bucketMilliseconds >> 1` to `(bucketMilliseconds + 1) >> 1`. The unchanged parent fixture still passes. The new test fails first at time 5: `333.33333333333331`, expected `0`. Direct D1 cleanup completes on success and the expected failure. After restoration, 2/2 pass again. Both test executables remain fixed through mutation. Restored module and executable hashes match the baseline. Loader traces confirm the final executable loads the integration's libwebrtc and libc. Each test finishes below 0.01 seconds; the registered timeout is 20 seconds. Final integration and mutation commands (`W` is the integration source; `B` is its build). Builds hold the shared lock and run without credential variables: ```sh cmake -S "$W" -B "$B" -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFFMPEG_PREBUILT_DIR=/home/ahmad/work/anyps5/builds/main/externals/ffmpeg-9ac4cfd195f1 cmake --build "$B" --target guest_webrtc_rate_tracker_tests guest_webrtc_rate_tracker_odd_bucket_tests -j 16 ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker(_odd_bucket)?$' -V ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker$' -V ctest --test-dir "$B" -R '^guest_webrtc_rate_tracker_odd_bucket$' -V python3 tools/check_conventions.py --base origin/main python3 tools/pr_overlap.py --branch fix/anyps5-ratetracker-odd-bucket-regression --repo boykopovar/AnyPS5 ``` The exact-parent control builds `guest_webrtc_rate_tracker_tests`, runs `ctest -R '^guest_webrtc_rate_tracker$' -V`, and compiles the new fixture directly with `g++ -std=c++20 -O2 -fno-fast-math -fno-reciprocal-math -frounding-math`, the parent include directory, and its libwebrtc/libc paths and rpath. That executable passes all nine checks. The main control builds `libwebrtc libc` and links a small probe against those exact main modules and declarations. It calls the no-argument constructor stub and requires the `not implemented` exception. It does not compile the new fixture on main. Conventions pass. The complete ownership audit finds no competing odd-bucket test; shared CMake additions concern other targets. The overlap tool exits 2 because #15154, #15211, and #15285 conflict with main. Full manual comparison confirms their CurrentThreadId, LogMessage/PendingTaskSafetyFlag, and FieldTrial registrations are disjoint. No full product build, full suite, Windows/macOS run, title, console, allocator leak check, or GPU test is claimed. This is CPU coverage. Maintainer CI remains external. Publication refresh: main advances to `2a696e1eade4fafffb2d22f7979748f6fe078d98` after the tests. Its full delta changes only unrelated AGC files and documentation; no inputs of these CPU tests change. The topic and exact parent still merge cleanly with that head. This is a source merge check, not another runtime result. <!-- 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: #16381 <!-- #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 -->
gabichuuuuu commented 2026-11-08 21:44:18 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Windows run of head 83ba1bff59, 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_webrtc_rate_tracker_odd_bucket_tests is registered only when CMAKE_SYSTEM_NAME is Linux, so a Windows build has no such target.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819794515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16419#pullrequestreview-5819794515). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T21:44:18Z. **Review:** COMMENTED --- Windows run of head `83ba1bff59`, 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_webrtc_rate_tracker_odd_bucket_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!16419
No description provided.