feat(tools): run titles repeatably and report their outcome #7264
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7264"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-17T20:22:55Z.
What
A tool for running titles you already have the same way every time, so a run can be attached to a PR or an issue and compared with an earlier one.
python tools/title_run.py --games <directory> [ID ...]finds extracted packages (eboot.binandsce_sys/param.json) under--games, unwraps the SELFs withtools/unwrap_self.py, relinks with the title's flags and lays the title out asdocs/user/USAGE.mddescribes. It then runs each title--runstimes (default 2: a cold run with empty AnyPS5 shader cache and pipeline journal, then warm runs) and decides each run's outcome by itself:relink-failedcrashedexitedstalledaps5-summary.jsonlline in the last 20 s (no presents), or too few presents for a frame to be dumpedframe-unreadableblankrenderingIt writes
summary.jsonand asummary.mdtable with fixed columns (title, ID, version, cold, warm, FPS, first error) underbuild/title-runs/<commit>-<time>/, keeping the first, middle and last dumped frames of each run.--compare <summary.json>adds a Before column and lists regressions, improvements and titles missing from the new run; when IDs are given, only those are compared.tools/titles.json: extra relink flags,fixed_base(mapped to--windows-fixed-base/--linux-fixed-base),executablesforLoadExectargets, run length and environment. It holds the flags the catalog titles need today (RetroArch'spicker/picker.bin, the--trap-sdk-syscall-stubstitles). VLC, Ruffle Flash and XPSemu no longer needfixed_basesince #9332 made 0x400000 the Windows default (as #8973 did on Linux): with a plain relink all three render (95, 35 and 23 fps on a Radeon 860M,main9656d366be), so their entries keep only--registry. Entries hold title IDs only, never names: a run is labelled with the package's ownparam.jsontitle name, anddiscover()refuses aparam.jsonwhosetitleIddoesn't match the same pattern as the keys..gitignoregets!tools/titles.json, next to the existing!demo/web/i18n/*.json.sceSystemServiceLoadExechand-overs included), and the run's exit code is that of the newest process whose image is inside the title's folder. On Linux it is a process group. A title is always ended at the deadline (close, 15 s grace, then terminate), and nothing is left running.SDL_AUDIODRIVER=dummy). On Windows there is no console window, the title's windows never get focus and go behind every other window as soon as they are created (a WinEvent hook, so they do not flash in front first). They keep their position and can be brought forward from the taskbar. They are not minimized, because presents stop while a window is minimized.VkCachecannot be redirected and is left alone;summary.jsonrecords it as not isolated.Unit tests:
tools/tests/test_title_run.py, registered astitle_run. They cover outcome classification from synthetic logs, summaries and BMPs (including truncated ones), relink arguments, the report and comparison, package discovery, and the process session with real child processes. Docs: a section indocs/dev/TRACING.md.Tested
Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Ryzen AI 7 350, WinLibs GCC 15.2.0, Release.
tools/tests/test_title_run.pyon Linux and macOS (GitHububuntu-latestandmacos-latest, Python 3.12, on a throwaway fork branch, because this pull request's CI skips the build jobs): 10 runs of 10 on each. The first try failed on macOS, wherekillpgon a group whose processes are all exiting fails withEPERM;alive(),close()andkill()now treat that as still exiting.python tools/tests/test_title_run.py: 24 OK.ctest -R '^(title_run|test_registration|conventions_doc_links)$': 3/3.tools/check_conventions.py --base origin/mainpasses.The local homebrew catalog, 66 titles,
main5859889b2with this branch, one 60 s run each, then the 22 titles that did not reachrenderingagain with--runs 2 --compare <first summary.json>. Nothing was left running after either batch. Windows Firewall asked about titles that open a port (answering Cancel does not affect the run); titles are now prepared at a fixed path so it asks once per title.The 22 titles again on
main1c523bdb4,--runs 2 --compareagainst the table below: RommPS now renders cold, Mortalfin's cold run hit the 10 s GPU watchdog (has not reached submission 10) like ProsperoAI and RetroArch do, everything else matched. ProsperoPuzzles renders with #6308 on top (29.2 FPS, cold and warm). ScreenTester5 had shownrenderingfrom two presents just before the deadline, which led to the frame rule forstalled.rendering: 48. 40 on the first pass. SuperTuxKart (PPSA69421) and ProsperoEden (PPSA99008) needed--trap-sdk-syscall-stubs, now intitles.json. Mortalfin (PPSA99141) and Nuvio (PPSA99997) render on both runs of the second pass. ProsperoAI (PPSA99004), RetroArch (PPSA99169), RommPS (PPSA76677) and PS5 OpenGL Showcase (PPSA99005) render only warm: cold, they stop on the PS5 RADV port's 10 s submission wait while their first pipelines build, which the Cold and Warm columns now show directly.exitedfor the crashing titles was a bug found by that pass: a crash brings Windows Error Reporting into the job, and its exit code 0 was taken for the title's. The exit code now comes only from processes inside the title's folder, so these show ascrashed(for example ProsperoPuzzles with 0xC0000409, the abort of #6301).valvefolder, a GZLE01 disc image,.pk3files); PICO-8 needs elfldr; FSR4 Showcase gives up on the build time of its FSR4 pipelines in a first run (#6118). OpenNOW reached its sign-in screen at 25.8 FPS ond8888df9b(catalog) and stops after a few presents here: its sign-in screen redraws only when its view changes and still answers input, sostalledis expected there (#7501).eboot.binis neither an ELF nor a SELF givesrelink-failedwithRefused: file is smaller than the SELF header area; the batch carries on and writessummary.json.Not tested: real titles on Linux and macOS, NVIDIA, Intel. Known limits: a
LoadExecchild that starts and exits within one poll (0.1-0.5 s) is not seen, and the parent's exit code is used;app0is hard-linked to the user's package when the file system allows it. A second invocation with the same--outrefuses to start while the first holds a title'swork/<ID>.lock.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T10:20:17Z.
Two questions before this gets reviewed, so I can adjust it first:
tools/titles.jsonfine in the repository? It holds only title IDs, relink flags (--trap-sdk-syscall-stubs,--windows-fixed-base,--executableforLoadExectargets), run length and environment for the catalog homebrew, and no game files. Without it, everyone running the catalog has to rediscover those flags. If you'd rather keep per-title data out of the tree,--titlesalready takes any path, so it can become a local file and the tool stays.summary.jsonis meant to be importable by the blocker map. Per title it hasname,version,secondsandruns[]. Each run hasrun,cache(cold/warm),outcome,exit_code,seconds,presents,fps,first_error,warningsand the keptframes. The top level addsbuild(commit, dirty, note),machine(os, gpu, driver, cpu),runs,secondsanddriver_cache. Is anything missing that the map would need, or named in a way that does not fit it?AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:55:06Z.
Thanks for asking, and sorry for the wait. Yes, a tools/titles.json with title IDs and their relink flags is fine in the repo, as long as it keeps to title IDs (no game names). We'll review it under the normal process.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T19:25:30Z.
Thanks for waiting on the titles.json question. Review of
d0a04fe67e:"name". The tool already falls back to the package's ownparam.jsontitleName(title_run.py:538), so please drop the field fromtitles.jsonand fromTITLE_FIELDS, so it isn't accepted again later.titleIdfromparam.jsonbefore using it as a path.discover()takestitleIdas is, while only thetitles.jsonkeys are checked against[A-Z]{4}[0-9]{5}.main()then buildswork = <out>/work/<titleId>, andprepare()starts withshutil.rmtree(work, ignore_errors=True). With pathlib, an absolutetitleIdreplaces the base, and../..climbs out of--out. So a malformedparam.jsonanywhere under--gamescan make the tool delete a directory outside--out. Please apply the same pattern indiscover()(and, if you like, check thatworkresolves under<out>/work), with a test.test_bad_id_is_refuseduses an app name as the invalid ID, and theTRACING.mdparagraph names a specific app's sign-in page as its example. Neutral wording would keep names out of the tree entirely, e.g."NOT-AN-ID"and "a screen that presents only when its view changes".The rest looks good: driver shader caches are isolated through environment variables instead of being deleted, processes are contained (job object on Windows, a process group elsewhere), and
test_title_run.pypasses here on currentmain(28 tests, 3 Windows-only skips).Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-20T20:04:38Z.
Thanks for the review. All three points are addressed in c2dce8dd3, rebased onto current
main:nameis gone fromtitles.jsonand fromTITLE_FIELDS. An entry that sets it fails with "unknown field name" (new test). The summary takes the name from the package'sparam.json.discover()now checks theparam.jsontitleIdagainst the same pattern as the catalog keys (TITLE_ID) before the ID names anything. The new test feeds it../../outside, an absolute path and a too-short ID. All three are refused, and the test fails when the check is removed. With the ID validated,<out>/work/<ID>can't leave--out, so I didn't add a second resolve check.test_bad_id_is_refusedusesNOT-AN-ID. TheTRACING.mdsentence no longer names an app, and the summary tests use a neutral name.test_title_run.py: 30 tests pass on Windows.check_conventions.pypasses.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:29:20Z.
Review: APPROVED
Reviewed exact head
c2dce8dd35091e7442c7ac4ecae38b32c4fd5cf0. The addedparam.jsontitle-ID validation prevents malformed IDs from becoming paths under<out>/work; I verified the regression cases for absolute and traversal IDs are covered. I ranpython tools/tests/test_title_run.pyon Linux: 30 tests passed, 3 platform-specific skips. Hosted conventions and relinker jobs pass; platform-specific runner integration is covered by the PR author’s reported runs, not this Linux run.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:29:18Z.
Independent Linux validation against the current PR head:
python3 -m unittest tools.tests.test_title_runpassed 30 tests (3 Windows-specific skips), andgit diff --check upstream/main...HEADpasses. I used a temporary harness with the PR files plus the existingtools/package_release.py; no repository files were changed. I did not validate the Windows process/window-management paths.Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T08:16:35Z.
Windows run of c2dce8dd35, merged onto
mainf894ba69d3(92a59f7199, tools only), for the Windows process and window paths the Linux validation above did not cover. Windows 11 Home 10.0.26200, Python 3.14.6,libsandrelinkerbuilt from that merge with MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release. RTX 4070 SUPER, NVIDIA 616.92 (ANYPS5_GPU=4070), Ryzen 9 7900.python -m unittest tools.tests.test_title_run: 30 tests, all pass, none skipped, so the three that skip on Linux ran here.tools/title_run.py PPSA59322 PPSA98766 PPSA85300 --games ... --runs 2on the catalog releases (each zip matching the catalog's SHA-256). Every run relinked, ran the full 60 s, was closed by the runner, and left three frames, none uniform:VLC took its
titles.jsonentry (--registry, fixed base 0x400000). ccleste loggeddestroyed with GPU results pendingthree times in each run; the other two logged neither warning. Not exercised:--compare, and a title that crashes, exits or stalls, so those outcomes were not reached by a real title here.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T00:06:56Z.
Review: APPROVED
Reviewed
c2dce8dd35091e7442c7ac4ecae38b32c4fd5cf0against29e4c46b4d7427cdbe55d1a57baed101eb07226c. No actionable findings in this focused review.Source review: Inspected the complete new runner, catalog, CMake registration and documentation. Checked title-ID confinement before preparing work directories, relink failure reporting, repeated-run staging, process ownership and shutdown, frame collection, outcome precedence and comparison/report generation. Documented driver-cache and stalled-but-interactive limitations are retained.
Validation: Windows Python 3.11:
tools/tests/test_title_run.py -v, 30 passed, 0 skipped. These include real Python parent/child process exit, lifetime and cleanup tests, plus Windows window-placement coverage. Conventions, whitespace and script registration passed. Baseline has no runner; the grafted suite cannot import it, an absence check rather than regression sensitivity. Effective hosted relinker matrix, ASan and conventions succeeded; full-product jobs were skipped.Scope: Runner logic, synthetic metadata/frame fixtures and short-lived test processes. No real title, relinker conversion, GPU rendering or cold/warm performance run was performed locally; this approval does not establish title playability.