test(agc): write more pixels than a pipe holds in the closed-pipe case #6573

Merged
hashaam1217 merged 1 commit from upstream-pr/6573 into main 2026-10-16 10:48:14 +00:00
hashaam1217 commented 2026-10-15 21:04:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hashaam1217 on 2026-10-15T21:04:23Z.


What

agc_frame_dump_io is flaky on Linux. PixelFailure writes a 128x128x4 payload, which is exactly the 65,536 bytes a default Linux pipe holds. After the consumer thread reads the 54-byte header, the whole payload fits in the pipe, so WriteBmpAndClose can finish the pixel write before the consumer closes the read end. The write then succeeds, and the test fails with closed pipe pixel write was accepted.

This PR raises the payload to 512x512x4 (1 MiB). That is larger than the default pipe capacity on Linux (64 KiB) and macOS (at most 64 KiB), so the pixel write always blocks until the reader closes and fails with EPIPE. Windows was not affected, because the test creates its pipe with 4 KiB there. The production code is unchanged.

Tested

Linux (Ubuntu 24.04, kernel 6.8, GCC 13), Release, full build on main e16b2bcce, running build/tests/agc_frame_dump_io_tests directly:

Failures
main 147 / 300
this PR 0 / 300

The test still finishes in under 10 ms. python3 tools/check_conventions.py --base origin/main 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
  • 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
  • Unblocks: none
  • GPUs tested: n/a (host-only test)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4879826230 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6573). Originally posted by [hashaam1217](https://github.com/hashaam1217) on 2026-10-15T21:04:23Z. --- ### What `agc_frame_dump_io` is flaky on Linux. `PixelFailure` writes a 128x128x4 payload, which is exactly the 65,536 bytes a default Linux pipe holds. After the consumer thread reads the 54-byte header, the whole payload fits in the pipe, so `WriteBmpAndClose` can finish the pixel write before the consumer closes the read end. The write then succeeds, and the test fails with `closed pipe pixel write was accepted`. This PR raises the payload to 512x512x4 (1 MiB). That is larger than the default pipe capacity on Linux (64 KiB) and macOS (at most 64 KiB), so the pixel write always blocks until the reader closes and fails with `EPIPE`. Windows was not affected, because the test creates its pipe with 4 KiB there. The production code is unchanged. ### Tested Linux (Ubuntu 24.04, kernel 6.8, GCC 13), Release, full build on `main` `e16b2bcce`, running `build/tests/agc_frame_dump_io_tests` directly: | | Failures | |---|---| | `main` | 147 / 300 | | this PR | 0 / 300 | The test still finishes in under 10 ms. `python3 tools/check_conventions.py --base origin/main` passes. ### 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] Unblocks: none - [x] GPUs tested: n/a (host-only test) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-15 21:20:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T21:20:34Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6556 core/libs/prx/libSceAgcDriver/tests/FrameDumpIo.cpp L99-100
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202528086 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6573#issuecomment-6202528086). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T21:20:34Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6556](https://www.github.com/boykopovar/AnyPS5/pull/6556) | `core/libs/prx/libSceAgcDriver/tests/FrameDumpIo.cpp` [L99-100](https://github.com/boykopovar/AnyPS5/blob/e16b2bcce15f5cf441f8e7ad99b545e08fd24ef6/core/libs/prx/libSceAgcDriver/tests/FrameDumpIo.cpp#L99-L100) | | |
jotitadev commented 2026-10-15 22:31:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T22:31:57Z.

Review: COMMENTED


Checked the macOS side of the description ("at most 64 KiB") on Apple silicon.

Machine: Apple M2 Max, macOS 27.2, Apple clang 21.0.0 (libc++). Head 4b8ccd2e4, base main 5d9dcc42d.

Method: no full build (main does not build on macOS yet). FrameDumpIo.hpp is header-only, so I compiled tests/FrameDumpIo.cpp standalone (clang++ -std=c++20 -O1) once as on main and once with this PR's diff applied, natively (arm64) and as x86_64 under Rosetta, and ran each binary 500 times:

arm64 x86_64 (Rosetta)
main's test 42 / 500 13 / 500
this PR 0 / 500 0 / 500

Every main failure was closed pipe pixel write was accepted. A non-blocking write probe fills a default macOS pipe at exactly 65,536 bytes, so the 128x128x4 payload fits there just as on Linux and the test is flaky on macOS too; the 1 MiB payload fixes it.

Written with AI assistance (Claude Code). I ran the checks above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5540724098 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6573#pullrequestreview-5540724098). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-15T22:31:57Z. **Review:** COMMENTED --- Checked the macOS side of the description ("at most 64 KiB") on Apple silicon. Machine: Apple M2 Max, macOS 27.2, Apple clang 21.0.0 (libc++). Head `4b8ccd2e4`, base `main` `5d9dcc42d`. Method: no full build (`main` does not build on macOS yet). `FrameDumpIo.hpp` is header-only, so I compiled `tests/FrameDumpIo.cpp` standalone (`clang++ -std=c++20 -O1`) once as on `main` and once with this PR's diff applied, natively (arm64) and as x86_64 under Rosetta, and ran each binary 500 times: | | arm64 | x86_64 (Rosetta) | |---|---|---| | `main`'s test | 42 / 500 | 13 / 500 | | this PR | 0 / 500 | 0 / 500 | Every `main` failure was `closed pipe pixel write was accepted`. A non-blocking write probe fills a default macOS pipe at exactly 65,536 bytes, so the 128x128x4 payload fits there just as on Linux and the test is flaky on macOS too; the 1 MiB payload fixes it. Written with AI assistance (Claude Code). I ran the checks above on my machine.
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!6573
No description provided.