build(libSceAgcDriver): compile the tests on macOS #15700

Merged
javierUDP merged 1 commit from upstream-pr/15700 into main 2026-11-08 00:26:42 +00:00
javierUDP commented 2026-11-04 07:32:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by javierUDP on 2026-11-04T07:32:10Z.


What

Four libSceAgcDriver tests guarded Linux-only code with #ifndef _WIN32, so a macOS build compiled it and failed:

  • HostImportSparseDmaBuf.cpp and execution/SparseDmaBufImport.cpp: memfd_create sealing (MFD_ALLOW_SEALING, F_ADD_SEALS, F_SEAL_SHRINK).
  • SharedWrites.cpp: RUSAGE_THREAD, and /proc/self/maps at run time.
  • GcnColorTarget.cpp: MAP_FIXED_NOREPLACE.

The two udmabuf tests already had a branch that prints "skipped, udmabuf imports are Linux only" and skips. Its condition is now !__linux__ instead of _WIN32.

SharedWrites.cpp guards with __linux__ the fault count of its benchmark (printed, never checked), the /proc/self/maps leak check, and the two blocks that write through the shared backing writer. DirectMemory.cpp registers that writer only under __linux__, so on macOS GuestArenaWriteSharedBacking returns false: the first block failed with "shared writer rejected direct backing", and the second would have passed without checking anything. #7631 brings direct memory to macOS and can widen that guard. With these guards the rest of the test runs on macOS for the first time, and passes.

GcnColorTarget.cpp takes its memory below 1 TiB from the guest arena on macOS, as it does on Windows. The arena takes the Windows protection value on every host, so the macOS branch passes ReadWriteProtection = 0x04, the name GuestHeap.cpp uses.

Windows and Linux compile the same code as before.

Tested

macOS 27.2 (Apple M5), x86-64 under Rosetta, Release, AppleClang. main does not build on macOS by itself, so this ran with #11049, #11119, #7804 and #4630 merged in: on main b8efa6292a, and the tests again on 5b1d381d5a after the rebase, where none of these files had changed. The macOS CI builds only the relinker and a few narrow targets, which is how these got in.

  • With the compile command from the build: 8, 4, 2 and 1 errors in the four files on main, none with this change.
  • agc_gcn_color_target, agc_shared_write and agc_shared_write_partial_collect pass.
  • agc_host_import_sparse and agc_driver_sparse_dma_buf_import skip with "udmabuf imports are Linux only".

Linux and Windows not built here.

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: none; no Vulkan device here, and the tests that run do not need one
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5150650556 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15700). Originally posted by [javierUDP](https://github.com/javierUDP) on 2026-11-04T07:32:10Z. --- ### What Four libSceAgcDriver tests guarded Linux-only code with `#ifndef _WIN32`, so a macOS build compiled it and failed: - `HostImportSparseDmaBuf.cpp` and `execution/SparseDmaBufImport.cpp`: `memfd_create` sealing (`MFD_ALLOW_SEALING`, `F_ADD_SEALS`, `F_SEAL_SHRINK`). - `SharedWrites.cpp`: `RUSAGE_THREAD`, and `/proc/self/maps` at run time. - `GcnColorTarget.cpp`: `MAP_FIXED_NOREPLACE`. The two udmabuf tests already had a branch that prints "skipped, udmabuf imports are Linux only" and skips. Its condition is now `!__linux__` instead of `_WIN32`. `SharedWrites.cpp` guards with `__linux__` the fault count of its benchmark (printed, never checked), the `/proc/self/maps` leak check, and the two blocks that write through the shared backing writer. `DirectMemory.cpp` registers that writer only under `__linux__`, so on macOS `GuestArenaWriteSharedBacking` returns false: the first block failed with "shared writer rejected direct backing", and the second would have passed without checking anything. #7631 brings direct memory to macOS and can widen that guard. With these guards the rest of the test runs on macOS for the first time, and passes. `GcnColorTarget.cpp` takes its memory below 1 TiB from the guest arena on macOS, as it does on Windows. The arena takes the Windows protection value on every host, so the macOS branch passes `ReadWriteProtection = 0x04`, the name `GuestHeap.cpp` uses. Windows and Linux compile the same code as before. ### Tested macOS 27.2 (Apple M5), x86-64 under Rosetta, Release, AppleClang. `main` does not build on macOS by itself, so this ran with #11049, #11119, #7804 and #4630 merged in: on `main` b8efa6292a, and the tests again on 5b1d381d5a after the rebase, where none of these files had changed. The macOS CI builds only the relinker and a few narrow targets, which is how these got in. - With the compile command from the build: 8, 4, 2 and 1 errors in the four files on `main`, none with this change. - `agc_gcn_color_target`, `agc_shared_write` and `agc_shared_write_partial_collect` pass. - `agc_host_import_sparse` and `agc_driver_sparse_dma_buf_import` skip with "udmabuf imports are Linux only". Linux and Windows not built here. ### 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: none; no Vulkan device here, and the tests that run do not need one - [x] AI-assisted: yes
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!15700
No description provided.