test(macos): add the homebrew guest and MoltenVK square smokes #16793

Open
wanderingbug wants to merge 1 commit from upstream-pr/16793 into main
wanderingbug commented 2026-11-07 16:45:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wanderingbug on 2026-11-07T16:45:14Z.


What

Open #16801 (fix/macos-test-compile, 38bddbff44) edits only ResourceRequest.cpp, RtcpTransportFeedback.cpp, and GuestCesGbSetters.cpp: <initializer_list> and ResourceRequestBase value initialization. None of those symbols are in this pull request.

Adds two homebrew macOS smokes and the square fixture they relink. tools/macos_guest_smoke.sh runs a small guest ELF. tools/macos_moltenvk_smoke.sh fetches MoltenVK, relinks square.c, and checks frame_000.bmp. tools/fetch_apple_vulkan.sh and tools/macos_address_space.cpp support that run. docs/dev/BUILD.md and docs/dev/ENVIRONMENT.md name the scripts.

Tested

In the cache-reuse run on an Apple M2 Max, macOS 27.2, x86_64 under Rosetta, snapshot 7a6e44ece4 plus the six overlays:

  • macos_guest_smoke exited 0. The guest printed hello from a PS5 ELF on macOS and guest thread.
  • macos_moltenvk_smoke exited 0. MoltenVK 1.4.2, Vulkan-Loader 1.4.321 x86_64, square presented, frame_000.bmp 320x180. The record describes a green square, a blue player, and two yellow coins. Image sha256 c4d55b77b2a7c531ecddda86b0fbef1bfa7604928d966f96b23dffefefd37b93.

This head was not rebuilt alone. The run is one existing build tree, not a fresh full runner. Not tested on a second machine; no game tested.

Checklist

  • Based on current main; no other open PR implements the same functions. Unchecked: parent is 30a863d12d, and upstream main is now daad891ea6. #16801 does not implement these functions. Other open pull requests were not fully scanned.
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt. The diff adds no // comments.
  • Unimplemented paths throw. No new guest export.
  • No notes, investigation .md files or images added to the repository. Existing development documentation is edited; maintainer confirmation of this rule is still needed. The markdown edits are the build and environment docs for the scripts.
  • New third-party code is a submodule built from source. MoltenVK is fetched by the smoke script, not vendored.
  • Generic behaviour, not specific to one title
  • Depends on: none. The smoke needs a built relinker and libs in the same tree. Test-only #7804 and #4630 were in the Mac tree and are not in this branch.
  • Fixes: none found in this pass. No issue search.
  • Unblocks: none claimed. No title bring-up check.
  • GPUs tested: n/a for the AGC, shader, and VideoOut rule. The smoke itself used Apple M2 Max, macOS 27.2, MoltenVK 1.4.2. That was not the validation-layer comparison with main.
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5203796434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16793). Originally posted by [wanderingbug](https://github.com/wanderingbug) on 2026-11-07T16:45:14Z. --- ### What Open #16801 (`fix/macos-test-compile`, `38bddbff44`) edits only `ResourceRequest.cpp`, `RtcpTransportFeedback.cpp`, and `GuestCesGbSetters.cpp`: `<initializer_list>` and `ResourceRequestBase` value initialization. None of those symbols are in this pull request. Adds two homebrew macOS smokes and the square fixture they relink. `tools/macos_guest_smoke.sh` runs a small guest ELF. `tools/macos_moltenvk_smoke.sh` fetches MoltenVK, relinks `square.c`, and checks `frame_000.bmp`. `tools/fetch_apple_vulkan.sh` and `tools/macos_address_space.cpp` support that run. `docs/dev/BUILD.md` and `docs/dev/ENVIRONMENT.md` name the scripts. ### Tested In the cache-reuse run on an Apple M2 Max, macOS 27.2, x86_64 under Rosetta, snapshot `7a6e44ece4` plus the six overlays: - `macos_guest_smoke` exited 0. The guest printed `hello from a PS5 ELF on macOS` and `guest thread`. - `macos_moltenvk_smoke` exited 0. MoltenVK 1.4.2, Vulkan-Loader 1.4.321 x86_64, `square presented`, `frame_000.bmp` 320x180. The record describes a green square, a blue player, and two yellow coins. Image sha256 `c4d55b77b2a7c531ecddda86b0fbef1bfa7604928d966f96b23dffefefd37b93`. This head was not rebuilt alone. The run is one existing build tree, not a fresh full runner. Not tested on a second machine; no game tested. ### Checklist - [ ] Based on current `main`; no other open PR implements the same functions. Unchecked: parent is `30a863d12d`, and upstream `main` is now `daad891ea6`. #16801 does not implement these functions. Other open pull requests were not fully scanned. - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt. The diff adds no `//` comments. - [x] Unimplemented paths throw. No new guest export. - [ ] No notes, investigation `.md` files or images added to the repository. Existing development documentation is edited; maintainer confirmation of this rule is still needed. The markdown edits are the build and environment docs for the scripts. - [x] New third-party code is a submodule built from source. MoltenVK is fetched by the smoke script, not vendored. - [x] Generic behaviour, not specific to one title - [x] Depends on: none. The smoke needs a built `relinker` and `libs` in the same tree. Test-only #7804 and #4630 were in the Mac tree and are not in this branch. - [ ] Fixes: none found in this pass. No issue search. - [ ] Unblocks: none claimed. No title bring-up check. - [x] GPUs tested: n/a for the AGC, shader, and VideoOut rule. The smoke itself used Apple M2 Max, macOS 27.2, MoltenVK 1.4.2. That was not the validation-layer comparison with `main`. - [x] AI-assisted: yes
adriadam10 commented 2026-11-11 10:31:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-11T10:31:01Z.

Review: CHANGES_REQUESTED


  • Conventions fails: four template lines are unchecked (based on current main, no notes/.md files, Fixes, Unblocks). Rebase onto main, then tick them or fill them with none; the check needs every box ticked.
  • core/relinker/relinker/tests/macos/square_elf.py:212-214 embeds a ~10 KB base64+zlib ELF that nobody can review or tie to square.c. Generate the guest at run time from square.c (or build it with the relinker's existing fixture helpers like import_fixture.py), or state how a reviewer reproduces the exact bytes and check them in CI.
  • Nothing here runs in CI or ctest: tools/macos_guest_smoke.sh and tools/macos_moltenvk_smoke.sh are manual, and macos_guest_thread_self is EXCLUDE_FROM_ALL with no add_test (core/libs/CMakeLists.txt:323). A change that adds test scripts needs at least one registered test that fails without it, or an explanation of why a macOS job is not possible.
  • docs/dev/BUILD.md:380 says libc and libkernel still do not compile on macOS, which contradicts the smokes in the same section that claim to run them; either state which commits the scripts need, or mark them as blocked on those PRs and wait for them.
  • tools/macos_moltenvk_smoke.sh:108-141 checks pixels of frame_000.bmp, which depends on APS5_DUMP_FRAMES/APS5_NO_GPU_DUMP/APS5_SYNC_FLIP; please name the code that writes that file so the check can be tied to main.
  • tools/fetch_apple_vulkan.sh downloads two archives with no checksum; pin SHA-256s.
  • core/libs/CMakeLists.txt:320-329 adds macos_address_space as a default target for every Apple build from a probe tool in tools/; make it EXCLUDE_FROM_ALL like the other target or drop it from this PR (one topic).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5857336104 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16793#pullrequestreview-5857336104). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-11T10:31:01Z. **Review:** CHANGES_REQUESTED --- - Conventions fails: four template lines are unchecked (based on current `main`, no notes/`.md` files, Fixes, Unblocks). Rebase onto `main`, then tick them or fill them with `none`; the check needs every box ticked. - `core/relinker/relinker/tests/macos/square_elf.py:212-214` embeds a ~10 KB base64+zlib ELF that nobody can review or tie to `square.c`. Generate the guest at run time from `square.c` (or build it with the relinker's existing fixture helpers like `import_fixture.py`), or state how a reviewer reproduces the exact bytes and check them in CI. - Nothing here runs in CI or ctest: `tools/macos_guest_smoke.sh` and `tools/macos_moltenvk_smoke.sh` are manual, and `macos_guest_thread_self` is `EXCLUDE_FROM_ALL` with no `add_test` (`core/libs/CMakeLists.txt:323`). A change that adds test scripts needs at least one registered test that fails without it, or an explanation of why a macOS job is not possible. - `docs/dev/BUILD.md:380` says `libc` and `libkernel` still do not compile on macOS, which contradicts the smokes in the same section that claim to run them; either state which commits the scripts need, or mark them as blocked on those PRs and wait for them. - `tools/macos_moltenvk_smoke.sh:108-141` checks pixels of `frame_000.bmp`, which depends on `APS5_DUMP_FRAMES`/`APS5_NO_GPU_DUMP`/`APS5_SYNC_FLIP`; please name the code that writes that file so the check can be tied to main. - `tools/fetch_apple_vulkan.sh` downloads two archives with no checksum; pin SHA-256s. - `core/libs/CMakeLists.txt:320-329` adds `macos_address_space` as a default target for every Apple build from a probe tool in `tools/`; make it `EXCLUDE_FROM_ALL` like the other target or drop it from this PR (one topic).
MarcZX10 commented 2026-11-17 04:54:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T04:54:46Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: the guest smoke must build the binary it runs, or the target must be built by default.

What I ran

  • Head 5a3664277e326e604e996fc513d714d02323b4cc, base main. No build and no smoke run; the review is read-only.
  • Repository files read at head with the reader, commands below.
Commands
python3 repo_read.py cat core/relinker/relinker/tests/macos/import_fixture.py 1 5
python3 repo_read.py cat core/libs/tests/GuestThreadSelf.cpp 1 40
python3 repo_read.py search UNPATCHED_DIR core/libs/CMakeLists.txt
python3 repo_read.py search "pthread_getattr_np|host thread id" core
python3 repo_read.py search pthread_getattr_np core
python3 repo_read.py search HeapDiagnostics core
python3 repo_read.py search "add_executable(relinker" core/relinker
python3 repo_read.py search "add_library(libkernel" core
python3 repo_read.py cat core/libs/prx/libc/src/HeapDiagnostics.cpp 1 60
python3 repo_read.py search thread core/libs/prx/libc/src/HeapDiagnostics.cpp

Also a search of the added lines in diff.patch for // and /*.

Results

Check Result Note
Fixture and test source exist at head passed Read at head
Default build includes the guest thread binary failed Target is EXCLUDE_FROM_ALL
Added code comments passed None found
Smoke scripts run on this head not run See Not verified
Author's macOS runs not run Author-reported, not repeated

Findings

Blocking

  1. tools/macos_guest_smoke.sh:34 runs $build/macos_guest_thread_self, but core/libs/CMakeLists.txt:320 declares that target EXCLUDE_FROM_ALL. Nothing in the script or the docs builds it, so on a default build the last step fails because the binary is missing. Drop EXCLUDE_FROM_ALL, or build the target in the script before it runs.

Non-blocking

  • docs/dev/BUILD.md:375 says libc does not compile on macOS until the SYS_gettid use in core/libs/prx/libc/src/HeapDiagnostics.cpp:53 is fixed. This head still has that code, so the smoke cannot be expected to pass on it as is. The author's run used a different tree; say so in the PR body.
  • core/relinker/relinker/tests/macos/square_elf.py:227 runs clang -c without a target. On macOS that emits Mach-O and read_elf_object exits with "not ELF64". The docstring describes a Linux toolchain but does not say --rebuild must run there. square.elf.o is also left in the source folder.
  • core/relinker/relinker/tests/macos/square_elf.py:250 has two identical branches. For - it still opens a file named - rather than writing to stdout, and the handle is never closed.
  • core/relinker/relinker/tests/macos/square.c:184 never fires: started is set on the line before it in every interactive iteration. Remove it or fix the intent.
  • docs/dev/ENVIRONMENT.md:28 says a value that is not a positive integer uses 180, but square_frames reads leading digits, so 5x gives 5. docs/dev/ENVIRONMENT.md:29 says "other than 0", but any value starting with 0 disables the mode. Match the code or the wording.
  • tools/fetch_apple_vulkan.sh:16 and :46 download MoltenVK and Vulkan-Loader and run them without a checksum. Pin a SHA-256 for each archive.

Sources

Not verified

  • Nothing was built or run here. The macOS runs in the PR body are the author's report, on snapshot 7a6e44ece4 plus six overlays. The head was not rebuilt alone, so they do not show that this head passes.
  • libc on macOS was not compiled. The SYS_gettid point comes from reading the source and BUILD.md; the macOS headers were not checked.
  • The image hash, the 320x180 frame and the pixel checks in tools/macos_moltenvk_smoke.sh were checked by reading only.
  • The interactive "Escape closes" behaviour: square.c does not read the keyboard, and the source of that behaviour was not found.
  • MoltenVK and Vulkan-Loader download paths and tarball member names were not checked against the upstream releases.
  • tools/macos_address_space.cpp was not compiled; the behaviour of VM_FLAGS_FIXED on macOS was not checked.
  • The base claims in the description (parent 30a863d12d, upstream main daad891ea6) and the other open PRs were not checked.
  • pthread_getattr_np in libkernel matches the BUILD.md note. PR #7804 was not checked.
  • Files read: the diff hunks of all nine files in reviewed. The full head texts in files/ were not opened. Files excluded: none.

To get this to a good state

  • Make macos_guest_thread_self build by default: drop EXCLUDE_FROM_ALL at core/libs/CMakeLists.txt:320, or add a build step to tools/macos_guest_smoke.sh.
  • On the new head, in a fresh build tree, rerun tools/macos_guest_smoke.sh and tools/macos_moltenvk_smoke.sh and attach the output.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5933108805 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16793#pullrequestreview-5933108805). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T04:54:46Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: the guest smoke must build the binary it runs, or the target must be built by default. ## What I ran - Head `5a3664277e326e604e996fc513d714d02323b4cc`, base `main`. No build and no smoke run; the review is read-only. - Repository files read at head with the reader, commands below. <details> <summary>Commands</summary> ``` python3 repo_read.py cat core/relinker/relinker/tests/macos/import_fixture.py 1 5 python3 repo_read.py cat core/libs/tests/GuestThreadSelf.cpp 1 40 python3 repo_read.py search UNPATCHED_DIR core/libs/CMakeLists.txt python3 repo_read.py search "pthread_getattr_np|host thread id" core python3 repo_read.py search pthread_getattr_np core python3 repo_read.py search HeapDiagnostics core python3 repo_read.py search "add_executable(relinker" core/relinker python3 repo_read.py search "add_library(libkernel" core python3 repo_read.py cat core/libs/prx/libc/src/HeapDiagnostics.cpp 1 60 python3 repo_read.py search thread core/libs/prx/libc/src/HeapDiagnostics.cpp ``` Also a search of the added lines in `diff.patch` for `//` and `/*`. </details> ## Results | Check | Result | Note | |---|---|---| | Fixture and test source exist at head | passed | Read at head | | Default build includes the guest thread binary | failed | Target is `EXCLUDE_FROM_ALL` | | Added code comments | passed | None found | | Smoke scripts run on this head | not run | See Not verified | | Author's macOS runs | not run | Author-reported, not repeated | ## Findings **Blocking** 1. `tools/macos_guest_smoke.sh:34` runs `$build/macos_guest_thread_self`, but `core/libs/CMakeLists.txt:320` declares that target `EXCLUDE_FROM_ALL`. Nothing in the script or the docs builds it, so on a default build the last step fails because the binary is missing. Drop `EXCLUDE_FROM_ALL`, or build the target in the script before it runs. **Non-blocking** - `docs/dev/BUILD.md:375` says `libc` does not compile on macOS until the `SYS_gettid` use in `core/libs/prx/libc/src/HeapDiagnostics.cpp:53` is fixed. This head still has that code, so the smoke cannot be expected to pass on it as is. The author's run used a different tree; say so in the PR body. - `core/relinker/relinker/tests/macos/square_elf.py:227` runs `clang -c` without a target. On macOS that emits Mach-O and `read_elf_object` exits with "not ELF64". The docstring describes a Linux toolchain but does not say `--rebuild` must run there. `square.elf.o` is also left in the source folder. - `core/relinker/relinker/tests/macos/square_elf.py:250` has two identical branches. For `-` it still opens a file named `-` rather than writing to stdout, and the handle is never closed. - `core/relinker/relinker/tests/macos/square.c:184` never fires: `started` is set on the line before it in every interactive iteration. Remove it or fix the intent. - `docs/dev/ENVIRONMENT.md:28` says a value that is not a positive integer uses 180, but `square_frames` reads leading digits, so `5x` gives 5. `docs/dev/ENVIRONMENT.md:29` says "other than 0", but any value starting with `0` disables the mode. Match the code or the wording. - `tools/fetch_apple_vulkan.sh:16` and `:46` download MoltenVK and Vulkan-Loader and run them without a checksum. Pin a SHA-256 for each archive. ## Sources - libc `SYS_gettid`: https://github.com/boykopovar/AnyPS5/blob/5a3664277e326e604e996fc513d714d02323b4cc/core/libs/prx/libc/src/HeapDiagnostics.cpp#L53 - `pthread_getattr_np` call in libkernel: https://github.com/boykopovar/AnyPS5/blob/5a3664277e326e604e996fc513d714d02323b4cc/core/libs/prx/libkernel/Pthread/src/Thread.cpp#L394 ## Not verified - Nothing was built or run here. The macOS runs in the PR body are the author's report, on snapshot `7a6e44ece4` plus six overlays. The head was not rebuilt alone, so they do not show that this head passes. - `libc` on macOS was not compiled. The `SYS_gettid` point comes from reading the source and `BUILD.md`; the macOS headers were not checked. - The image hash, the 320x180 frame and the pixel checks in `tools/macos_moltenvk_smoke.sh` were checked by reading only. - The interactive "Escape closes" behaviour: `square.c` does not read the keyboard, and the source of that behaviour was not found. - MoltenVK and Vulkan-Loader download paths and tarball member names were not checked against the upstream releases. - `tools/macos_address_space.cpp` was not compiled; the behaviour of `VM_FLAGS_FIXED` on macOS was not checked. - The base claims in the description (parent `30a863d12d`, upstream `main` `daad891ea6`) and the other open PRs were not checked. - `pthread_getattr_np` in libkernel matches the `BUILD.md` note. PR #7804 was not checked. - Files read: the diff hunks of all nine files in `reviewed`. The full head texts in `files/` were not opened. Files excluded: none. ## To get this to a good state - Make `macos_guest_thread_self` build by default: drop `EXCLUDE_FROM_ALL` at `core/libs/CMakeLists.txt:320`, or add a build step to `tools/macos_guest_smoke.sh`. - On the new head, in a fresh build tree, rerun `tools/macos_guest_smoke.sh` and `tools/macos_moltenvk_smoke.sh` and attach the output.
ligmaSec commented 2026-12-03 17:18:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:18:44Z.

Review: COMMENTED


The smoke script relinks the embedded ELF written by square_elf.py. Can the build docs identify the compiler version used to generate that payload and say when to rebuild it? I ran the generator against the checked-in square.c with Clang 19.1.7 and 21.1.8 on Linux. Both rebuilt x86-64 ELF images had 14 import relocations, but each differed from the embedded image, including in its executable segment. Documenting the generating toolchain would make it easier to verify the fixture after source changes.

The three shell scripts passed syntax checks. I verified the embedded and regenerated ELF headers on Linux. Running the two smokes still requires macOS and MoltenVK.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6174796160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16793#pullrequestreview-6174796160). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T17:18:44Z. **Review:** COMMENTED --- The smoke script relinks the embedded ELF written by `square_elf.py`. Can the build docs identify the compiler version used to generate that payload and say when to rebuild it? I ran the generator against the checked-in `square.c` with Clang 19.1.7 and 21.1.8 on Linux. Both rebuilt x86-64 ELF images had 14 import relocations, but each differed from the embedded image, including in its executable segment. Documenting the generating toolchain would make it easier to verify the fixture after source changes. The three shell scripts passed syntax checks. I verified the embedded and regenerated ELF headers on Linux. Running the two smokes still requires macOS and MoltenVK. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/16793:upstream-pr/16793'
git switch 'upstream-pr/16793'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/16793'
git switch 'upstream-pr/16793'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/16793'
git switch 'upstream-pr/16793'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/16793'
git switch 'main'
git merge --squash 'upstream-pr/16793'
git switch 'main'
git merge --ff-only 'upstream-pr/16793'
git switch 'main'
git merge 'upstream-pr/16793'
git push origin 'main'
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!16793
No description provided.