test(libc): give each app archive test its own root directory #9741

Merged
prosperkartik merged 1 commit from upstream-pr/9741 into main 2026-10-24 07:45:21 +00:00
prosperkartik commented 2026-10-22 11:25:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by prosperkartik on 2026-10-22T11:25:04Z.


What

AppArchiveFixture::EnterFreshRoot named the test root from one steady_clock reading and accepted a directory that already existed. Under Rosetta 2, processes started together can read the same value, so parallel guest_app_archive_* runs shared a root and overwrote each other's app0.zar, aborting with app0.zar is not a readable ZArchive. The guest_kernel_app_archive_* tests use the same fixture. The root is now claimed with std::filesystem::create_directory, which returns false for an existing directory, and renamed from a new reading until the claim succeeds. Test-only change.

Tested

Mac mini, Apple M4, 16 GB, macOS 26.5.1 (25F80), x86_64 under Rosetta 2, Apple clang 21.0.0. main does not build on macOS, so for the runtime checks the change was applied on top of #8658 (1688e5abb):

  • guest_app_archive_tests present and guest_app_archive_tests damaged launched together, 300 pairs: 113 pairs fail without the change, 0 with it.
  • ctest -R app_archive -j7 --repeat until-fail:5 (the 4 guest_app_archive_* and 3 guest_kernel_app_archive_* tests): passes.
  • Cause: a minimal x86_64 program that prints steady_clock::now() at startup, launched in pairs 300 times, printed the same value in 18 pairs under Rosetta 2 and in 0 pairs built as arm64.
  • python3 tools/check_conventions.py --base origin/main: all checks pass.
  • Not built or run on Linux or Windows.

In the M1 run reported in #8658, guest_kernel_app_archive_plain failed in the full run and passed alone. It uses the same fixture, so it may be this collision; not verified on that machine.

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:4966567335 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9741). Originally posted by [prosperkartik](https://github.com/prosperkartik) on 2026-10-22T11:25:04Z. --- ### What `AppArchiveFixture::EnterFreshRoot` named the test root from one `steady_clock` reading and accepted a directory that already existed. Under Rosetta 2, processes started together can read the same value, so parallel `guest_app_archive_*` runs shared a root and overwrote each other's `app0.zar`, aborting with `app0.zar is not a readable ZArchive`. The `guest_kernel_app_archive_*` tests use the same fixture. The root is now claimed with `std::filesystem::create_directory`, which returns false for an existing directory, and renamed from a new reading until the claim succeeds. Test-only change. ### Tested Mac mini, Apple M4, 16 GB, macOS 26.5.1 (25F80), x86_64 under Rosetta 2, Apple clang 21.0.0. `main` does not build on macOS, so for the runtime checks the change was applied on top of #8658 (`1688e5abb`): - `guest_app_archive_tests present` and `guest_app_archive_tests damaged` launched together, 300 pairs: 113 pairs fail without the change, 0 with it. - `ctest -R app_archive -j7 --repeat until-fail:5` (the 4 `guest_app_archive_*` and 3 `guest_kernel_app_archive_*` tests): passes. - Cause: a minimal x86_64 program that prints `steady_clock::now()` at startup, launched in pairs 300 times, printed the same value in 18 pairs under Rosetta 2 and in 0 pairs built as arm64. - `python3 tools/check_conventions.py --base origin/main`: all checks pass. - Not built or run on Linux or Windows. In the M1 run reported in #8658, `guest_kernel_app_archive_plain` failed in the full run and passed alone. It uses the same fixture, so it may be this collision; not verified on that machine. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-22 11:59:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:59:27Z.

Review: CHANGES_REQUESTED


The fixture change is narrowly scoped and the author reports a strong 300-pair red/green reproduction. The branch is 4 commits behind current main. If it proceeds later, refresh and rerun the app-archive tests and overlap check on the updated head. Product Linux/Windows jobs are skipped on this PR.

I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613777927 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9741#pullrequestreview-5613777927). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:59:27Z. **Review:** CHANGES_REQUESTED --- The fixture change is narrowly scoped and the author reports a strong 300-pair red/green reproduction. The branch is 4 commits behind current `main`. If it proceeds later, refresh and rerun the app-archive tests and overlap check on the updated head. Product Linux/Windows jobs are skipped on this PR. I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
prosperkartik commented 2026-10-22 14:44:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by prosperkartik on 2026-10-22T14:44:16Z.


@MarcZX10, thanks. Rebased on main b7d1d47a5; the head is now 745c17331 (1 file, +5/-2, unchanged).

Rerun on the updated head, Apple M4, macOS 26.5.1, x86_64 under Rosetta 2. main does not build on macOS, so the change was applied on top of #8658's current head f3bc0258f for the runtime checks:

  • guest_app_archive_tests present and damaged launched together, 300 pairs: 104 fail without the change, 0 with it.
  • ctest -R app_archive -j7 --repeat until-fail:5 (the 4 guest_app_archive_* and 3 guest_kernel_app_archive_* tests): 7/7 pass.
  • python3 tools/check_conventions.py --base origin/main: all checks pass.
  • python3 tools/pr_overlap.py --branch fix/app-archive-fresh-root: no overlap with open pull requests.

Linux and Windows are not run locally. @iamthehimansh reports the same collision under load on an M2 Pro in #8658.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343572721 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9741#issuecomment-6343572721). Originally posted by [prosperkartik](https://github.com/prosperkartik) on 2026-10-22T14:44:16Z. --- @MarcZX10, thanks. Rebased on `main` `b7d1d47a5`; the head is now `745c17331` (1 file, +5/-2, unchanged). Rerun on the updated head, Apple M4, macOS 26.5.1, x86_64 under Rosetta 2. `main` does not build on macOS, so the change was applied on top of #8658's current head `f3bc0258f` for the runtime checks: - `guest_app_archive_tests present` and `damaged` launched together, 300 pairs: 104 fail without the change, 0 with it. - `ctest -R app_archive -j7 --repeat until-fail:5` (the 4 `guest_app_archive_*` and 3 `guest_kernel_app_archive_*` tests): 7/7 pass. - `python3 tools/check_conventions.py --base origin/main`: all checks pass. - `python3 tools/pr_overlap.py --branch fix/app-archive-fresh-root`: no overlap with open pull requests. Linux and Windows are not run locally. @iamthehimansh reports the same collision under load on an M2 Pro in #8658. AI-assisted: yes
MarcZX10 commented 2026-10-22 15:02:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T15:02:55Z.

Review: APPROVED


The requested refresh and rerun are complete. The PR is based directly on current main (b7d1d47a), and the reported Rosetta 2 rerun shows the collision reproduction fails in 104/300 paired baseline runs and 0/300 runs with this change; all seven app-archive CTest cases pass under --repeat until-fail:5. The author also reports no overlap with open PRs. This is a narrowly scoped test-fixture fix: atomically claiming the timestamp-derived directory and retrying on collision addresses the demonstrated race.

My local python tools/check_conventions.py --base upstream/main --head upstream/pr/9741 and git diff --check upstream/main...upstream/pr/9741 pass. I could not independently run the CTest suite here because this checkout has no configured build and only about 649 MB free. The hosted product build jobs did not run on this PR. I also did not dispatch a full workflow because the repository requires a collaborator with push access to do that, and the permission endpoint reports this account lacks push access.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5616318844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9741#pullrequestreview-5616318844). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T15:02:55Z. **Review:** APPROVED --- The requested refresh and rerun are complete. The PR is based directly on current `main` (`b7d1d47a`), and the reported Rosetta 2 rerun shows the collision reproduction fails in 104/300 paired baseline runs and 0/300 runs with this change; all seven app-archive CTest cases pass under `--repeat until-fail:5`. The author also reports no overlap with open PRs. This is a narrowly scoped test-fixture fix: atomically claiming the timestamp-derived directory and retrying on collision addresses the demonstrated race. My local `python tools/check_conventions.py --base upstream/main --head upstream/pr/9741` and `git diff --check upstream/main...upstream/pr/9741` pass. I could not independently run the CTest suite here because this checkout has no configured build and only about 649 MB free. The hosted product build jobs did not run on this PR. I also did not dispatch a full workflow because the repository requires a collaborator with push access to do that, and the permission endpoint reports this account lacks push access.
MarcZX10 commented 2026-10-22 17:05:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T17:05:53Z.

Review: COMMENTED


I confirmed the approved fixture change is still exact head 745c173319438bae1d5d9877e93e0e3e91eb32e1, based on current main b7d1d47a5f; merge-tree and diff-check against today’s 11f976b27c16ed91633f00039dba5dfd97dd7cc1 are clean. The author’s 104/300 baseline collision versus 0/300 fixed runs and repeated seven-test result substantiate the race fix. No further code issue found. Please refresh the base before merge, then rerun the app-archive tests and overlap check on that final head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5617965069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9741#pullrequestreview-5617965069). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T17:05:53Z. **Review:** COMMENTED --- I confirmed the approved fixture change is still exact head `745c173319438bae1d5d9877e93e0e3e91eb32e1`, based on current main `b7d1d47a5f`; merge-tree and diff-check against today’s `11f976b27c16ed91633f00039dba5dfd97dd7cc1` are clean. The author’s 104/300 baseline collision versus 0/300 fixed runs and repeated seven-test result substantiate the race fix. No further code issue found. Please refresh the base before merge, then rerun the app-archive tests and overlap check on that final head.
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!9741
No description provided.