Skip to content

Launcher tests: never search the PC's own store libraries; --noscan reaches every library search - #243

Merged
phantoslayer21 merged 4 commits into
mainfrom
fix/suite-library-isolation
Nov 15, 2026
Merged

phantoslayer21 merged 4 commits into
mainfrom
fix/suite-library-isolation

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What this changes and why

The old test suite let the launcher's library search and model step read store library folders of the PC it ran on: the CLI's --noscan did not reach those searches, and nothing confined a test build to its own folders. This PR closes that in the product and in the tests.

Product:

  • One store-access layer (util.h LibraryAccess / LibraryRegistryAccess). Every read of store metadata asks first:
    • Steam's library list and app manifests (also SteamAppId for Play, and GameDisplayName);
    • Epic's manifests (also EpicAppName for Play);
    • the GOG registry and Steam's art cache;
    • every walk of a library game's folder: each folder listed and each file opened (FindFilesNamed, DetectGames, the game-exe, Unreal and art searches).
  • Test builds read only their own folder. A WRONGGPU_TESTING build with WRONGGPU_TEST_LIBRARIES set takes its libraries from that folder only, and reads nothing outside the test run's folder and no store registry key.
    • The check is on the real path, not only its spelling. These are refused:
      • a path whose final form (GetFinalPathNameByHandleW) differs from its long name, because of a junction or link on the way;
      • a reparse point;
      • a file with a second name (a hard link);
      • a test folder that itself resolves elsewhere.
    • Before every read the build logs library access: <path> (or refused: <path> (<why>)) to WRONGGPU_TEST_ACCESS_LOG. A read whose line cannot be written is refused (fail closed).
    • A new log starts with run <WRONGGPU_TEST_RUN_ID>. Every start of the launcher or the restorer writes a process line.
    • Release builds read none of these variables.
  • No-scan per operation. --noscan (every verb), /NOSCAN and the window's no-scan hold for the whole process.
    • An operation's own noscan, such as a job's, holds for that operation only. RunOp sets the flag and puts it back, so it never reaches the next job of a batch.
    • apply --noscan sets the job's noscan too.
    • The AMD FSR 4 search, the other-model step and the install's first model search all follow the operation's flag.
  • /S /NOSCAN /FSR4 and /S /NOSCAN /LIST search no library, and the report says "libraries not searched (/NOSCAN)".

Tests:

  • New tests/launcher_isolation.py. Every runner (launcher, coexistence, Model L / K, convert-ignore, installer) sets the variables to its work folder and a new run id. The runners never create the access log; the launcher does.

  • After every launcher or installer call, including raw ones and elevated jobs, check_isolation stops the whole run on:

    • a read outside the work folder (also its \\?\ and UNC forms);
    • a store registry read;
    • a missing or unreadable access log, a log that does not start with this run's id, or a call that added no line;
    • no access where the call was meant to scan.

    A search line in the main log naming an outside path also stops it. Native installer runs need a WRONGGPU_TESTING build.

  • self_test runs first in every runner's main, before any program call, and aborts the run if the guard is broken. It has 15 cases, including a log from another run and a call that logged nothing.

  • [isolation-verbs] runs these with and without no-scan, against a non-empty test library:

    • install, repair, update and uninstall (repair and update are also checked to search when no-scan is off);
    • the window's refresh;
    • the other model of a Preset K build (checked on that call's log lines only);
    • an apply batch (a noscan job, then a normal one), and apply --noscan;
    • /FSR4 and /LIST.
  • The 0.5.1 baseline installer predates this. It runs only with --run-old-baseline, in a fully redirected sandbox.

  • launcher-core-tests covers:

    • each store inside and outside the test folder: Steam app id and display name, Epic app name, the registry, folder walks including UNC and \\?\;
    • a junction in a library, a file symlink, a hard link and a test folder that is itself a junction, all refused (the symlink case skips with a printed reason where the user cannot create one);
    • an unwritable and an unset access log, both refusing the read;
    • the run-id first line;
    • the per-operation no-scan, and a normal job finding its compare DLL in the test library after a noscan job.
  • The README's Tests section describes the rule.

Follow-up (0.6.6): #245. The check and the read using the same handle, a log line for each later open of a found file (hash and convert), and a note and test for what still runs in release builds.

What each new or substantially changed file is based on

Own design. tests/launcher_isolation.py is new.

How it was tested

Tested on this head (Windows, MSVC; APPDATA, LOCALAPPDATA, ProgramData and TMP redirected to scratch folders):

  • CI's two launcher configurations (the ci.yml flags: Preset K off, and the release's model flags) with CI's ctest filter: 9/9 tests pass in each.
  • launcher-core-tests, WRONGGPU_TESTING build: 406 checks pass, the junction, symlink, hard-link, test-folder junction, unwritable-log and run-id cases included.
  • run_launcher_tests.py, full suite, with this branch's testing launcher. The RR test game's rr-prepare was answered without the GPU.
    • Result: 394 pass, 28 fail. The 28 are the same checks that fail on main, none from this change; they are tracked separately.
    • The guard's self-test passes (15 cases), and the run was never stopped: the access log was this run's, and every call added lines to it.
    • [isolation-verbs]: 15/15 pass, including repair and update searching when no-scan is off and the other-model check.
    • The suite's main log and its access log name no store library path. The 5077 access lines are all inside the test folder; the 157 refusals are all the art cache's Steam registry lookup, with nothing read.

Not tested:

  • Under Wine.
  • The coexistence, Model L / K, convert-ignore and installer runners end to end. They share the same environment helper, self-test and guard.

Checklist

  • I make the clean-room statement of CONTRIBUTING.md for this and all my contributions (required once, in my first pull request).
  • Every commit has a Signed-off-by: line (git commit -s; Developer Certificate of Origin 1.1).
  • New source files carry the SPDX licence line for MIT, or are covered in REUSE.toml.
  • No files of the original upscaler (see CONTRIBUTING.md), no model data, game files, captures, screenshots or binaries; no paths, user or machine names of my PC.
  • Any new third-party component is under a permitted licence and listed in THIRD-PARTY-NOTICES and REUSE.toml. (None.)
  • Numbers in documents come with their measurement record. (None added.)
  • Kernel or runtime changes: none.

…eaches every library search

The old test suite let the launcher's library searches (the AMD FSR 4 compare-DLL search and the model step) read the
store library folders of the PC it ran on, because the CLI's --noscan did not reach them.

- --noscan (every verb), the window's no-scan and an operation's noscan set ctx.noLibraryScan, which the AMD FSR 4
  search and the other-model step read.
- A WRONGGPU_TESTING build with WRONGGPU_TEST_LIBRARIES set takes its libraries from that folder only and reads nothing
  of the PC's stores (detect.h TestLibraries); every launcher test runner sets it to an empty work folder.
- tests/launcher_isolation.py: any library-search log line naming a path outside the run's work folder stops the run;
  its self-test runs first in every launcher suite run.
- launcher-core-tests: noscan reaches the AMD FSR 4 search; the test library list.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21 phantoslayer21 added this to the 0.6.5 milestone Nov 15, 2026
…eration (review)

- util.h LibraryAccess / LibraryRegistryAccess: every read of store metadata asks first: Steam's library list and app
  manifests (also SteamAppId for Play and GameDisplayName), Epic's manifests (also EpicAppName for Play), the GOG
  registry, Steam's art cache, and every walk of a library game's folder (FindFilesNamed, DetectGames). A testing build
  with WRONGGPU_TEST_LIBRARIES set reads nothing outside the test run's folder and no store registry key, and logs
  "library access: <path>" (or "refused") to WRONGGPU_TEST_ACCESS_LOG before every read.
- No-scan per operation: noScanAlways (--noscan, /NOSCAN, the window's) and an operation's own noscan; RunOp sets the
  flag for the operation and puts it back, so a job's noscan never reaches the next job. apply --noscan sets the job's
  noscan too; InstallOp's first model search follows the operation's flag.
- /S /NOSCAN /FSR4 and /LIST search no library and say "libraries not searched (/NOSCAN)".
- tests/launcher_isolation.py: check_isolation parses the access log after every call (raw ones and elevated jobs too)
  and stops the run on a read outside the work folder (also \?\ and UNC), a store registry read, a missing access log,
  or no access where a scan was expected; self_test runs first in every runner (launcher, coexistence, Model L / K,
  convert-ignore, installer) and aborts the run on failure; [isolation-verbs]: install, repair, update, uninstall, the
  window's refresh, the other model, a batch and /FSR4 / /LIST with and without no-scan against a non-empty test
  library. The 0.5.1 baseline installer runs only with --run-old-baseline.
- launcher-core-tests: each store inside and outside the test folder, the per-operation no-scan, a normal job finding
  its compare DLL after a noscan job.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…t log is this run's

Testing builds with WRONGGPU_TEST_LIBRARIES set now also check the resolved path of every store
read: a path whose final form differs from its long form (a junction or link on the way), a
reparse point, a file with a second name (a hard link) and a test folder that itself resolves
elsewhere are refused. A read whose access-log line cannot be written is refused. A new log
starts with "run <WRONGGPU_TEST_RUN_ID>"; the launcher and the restorer write a "process" line
at every start. Every walked folder and every opened file of a library game gets its own line
(FindFilesNamed, the game-exe, Unreal and art searches).

The runners no longer create the access log. They set a new run id, and the guard stops the run
on a missing log, a log of another run, or a call that added no line. Repair and update without
no-scan are checked to search the test libraries; the other-model check reads only its own
call's lines. Native installer runs need a WRONGGPU_TESTING build. Unit tests for a junction, a
file symlink, a hard link, a junction test folder, an unwritable and an unset log, and the run-id
line; two new guard self-test cases.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…ed comment back on it

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 15, 2026 17:57
@phantoslayer21
phantoslayer21 merged commit eac2946 into main Nov 15, 2026
10 checks passed
@phantoslayer21
phantoslayer21 deleted the fix/suite-library-isolation branch November 15, 2026 18:00
phantoslayer21 added a commit that referenced this pull request Nov 15, 2026
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21 added a commit that referenced this pull request Nov 15, 2026
Conflicts:
- launcher.cpp ApplyProfile: one state-lock hold covers #224's settings
  (validated first, then settings.ini through the state keys), the model
  choice record, OptiScaler.ini's entry and #224's RR state, in that
  order. WriteLauncherModelChoice / GuiApplyRequest sit next to #224's
  FrontEndStateKeys / WithFrontEndState.
- record.cpp: #224's version (model-choice.ini is WrongGPU's by its
  stamp, not by its name).

Follow-ups for main's changes:
- The model choice record is written with wgstate::WriteStamped (#224's
  stamp for model-choice.ini and the install's id), so an uninstall knows
  it as WrongGPU's; a test covers the stamp, a parse of a stamped record
  and a write without an install id.
- A create no entry names, whose record names a model this build lacks,
  runs Model M, never the persisted sr_model (which an earlier session
  may have left on another model); test case (16).
- wronggpu.ini's reader for the upgrade migration is a named callable
  class, not a lambda capturing the path by copy.
- run_model_k_tests: since #224 the uninstall also removes the seeded,
  unchanged wronggpu-asi.ini, so the game folder is byte for byte as
  before.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
j0nsh1n added a commit to j0nsh1n/wronggpu that referenced this pull request Nov 17, 2026
…inux runs too

0.6.5's launcher suite runs a program only after checking it is a
WRONGGPU_TESTING build (phantoslayer21#243): an identity resource, a matching PE checksum and
the test hooks' strings, and negative controls (canaries) it must refuse. On
Linux that check read PE structure only, so every launcher call was refused.
The guard stays; Linux gets its own counterparts:

- identity: a section .wg_testing_id in the testing launcher
  (src/platform/posix/testing_identity_linux.cpp, the same identity text as the
  Windows resource) and, after the link, the file's SHA-256 written into it
  with those 32 bytes counted as zero (tools/elf_testing_identity.py, a
  POST_BUILD step; what the PE checksum is on Windows: a byte changed, data
  appended or a strip after the link no longer matches);
- launcher_build_facts.testing_identity reads an ELF file that way (wide
  strings are UTF-32 on Linux); the build list names WrongGPU and the canaries
  without .exe;
- negative controls: tests/canary.cpp built for Linux too (its wmain through
  the POSIX layer; lstrcatW added there), a Linux load marker
  (tests/canary_dll_linux.cpp, writes <file>.loaded from a constructor);
- self_checks on Linux: --native-linux as the entry point, host paths for
  programs and child suites, a symbolic link where Windows uses a junction,
  ctypes.CDLL for the load marker; the native launcher is checked before
  anything runs, as --launcher is.

Verified: ctest 22/22 (launcher-native 425 passed, 0 failed, 5 skipped; its
preflight and every negative control pass on Linux). The check accepts the
testing launcher and refuses 42c933e's testing launcher, both canaries, and
the launcher with a byte changed, data appended, stripped, the identity text
changed (sum rewritten) or the sum never written; three ways of breaking the
checker each let one of those through (red), restored green. The suite given
a non-testing program refuses before it makes its work folder. The MinGW
build of the Windows canaries is unchanged in behaviour (Wine tests as before).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant