WIP: test(game): four game-side checks that fail only on Windows pass there: whole paths, and a file system that folds case #2845

Draft
llun wants to merge 1 commit from llun/Longshot:fix/mod-api-win-game-test-fixtures into mod-api
Member

Summary

For #2822 (into mod-api). Four checks on the game side fail only on Windows. In each case the code is right and the test's fixture assumes Unix:

  • longshot-game mod_tests::tests::a_folder_of_mods_tests_each_of_its_folders: the plan joins a suite's folder with Path::join (/t/suite\hud on Windows), and the test wrote the expected folders out (/t/suite/hud). The expected value is now joined the same way.
  • longshot-game runtime::tests::a_separate_mod_moves_the_saves_into_its_profile_and_records_it and a_mods_profile_sits_inside_the_launchers_save_folder: they rooted the user and launcher folders at /u and /profiles/two. Windows takes those as rooted but not whole, so the profile's folder, made whole by saves_in with std::path::absolute, took the current drive (C:\u\…) and the comparisons failed. They start from a whole path on each system now (whole(): as it is on Unix, under C:\ on Windows).
  • modtool emulators::tests::eden_and_ryujinx_mods_are_found_with_their_switches: it writes Eden's title-id folder in lower case and in capitals. That is two folders on Linux, but one on Windows and macOS, whose file systems fold case, and there that folder's mods come by name. The test now reads which one the file system gave, expects that order, and finds Speed and Grass by name, not by place.

No code the game runs changes. Every assertion stays, among them a_mods_profile_sits_inside_the_launchers_save_folder's check that a mod's profile sits inside the launcher's save/ subtree, the one the sandbox grants.

To see it on mod-api: on Windows, cargo test -p longshot-game --lib and cargo test -p modtool --lib emulators (--target x86_64-pc-windows-gnullvm with llvm-mingw).

Testing

Tested: the four checks, on Windows 11 (--target x86_64-pc-windows-gnullvm with llvm-mingw) and on Linux (WSL Ubuntu 24.04). The change is test code only, so there is nothing new for the game to run. Every game run in this PR's series used builds that included this code unchanged.

Checks:

  • On mod-api @ c5e5b676, Windows: longshot-game --lib 165 pass, these three fail. modtool fails eden_and_ryujinx_mods_are_found_with_their_switches (left: [Grass, Speed, Hud], right: [Speed, Grass, Hud]).
  • Here, Windows: longshot-game --lib 168 pass, 0 fail. modtool's eden_and_ryujinx_mods_are_found_with_their_switches passes.
  • Here, Linux (WSL Ubuntu 24.04, cargo test): mod_tests::…a_folder_of_mods_tests_each_of_its_folders and the runtime tests (5) pass, and so does modtool's eden_and_ryujinx_mods_are_found_with_their_switches (two folders there: the capitals-first order).
  • The sandbox's check still bites: with saves_in changed to put the mod's profile outside save/ (b.join(folder), undone after), a_mods_profile_sits_inside_the_launchers_save_folder fails on Windows (left: C:\profiles\two\a~rando, right: …\save\.profiles\a~rando).
  • cargo fmt --check, cargo clippy -p longshot-game -p modtool --all-targets --no-deps -- -D warnings (Windows target) and mise run lint pass.

Still to test:

  • macOS: cargo test -p modtool --lib emulators (its file system folds case, as Windows' does)

Measurements

Verdict: fixed. The four checks pass on Windows and still pass on Linux.

Baseline: mod-api (#2822's head), the branch this PR goes into. Nothing to time: test code only.

Before: mod-api @ c5e5b676 After: this PR @ 18c277e8
cargo test -p longshot-game --lib, Windows 165 pass, 3 fail 168 pass
modtool eden_and_ryujinx_mods_are_found_with_their_switches, Windows FAIL (the order) pass
The same, Linux pass pass

Risks

The sandbox: not touched; no code the game runs changes. The test that checks a mod's profile sits inside the launcher's granted save/ subtree keeps that assertion, and still fails when the profile is put outside it (above).

On a file system that folds case, the emulators test no longer checks that a title id in capitals sorts first: there it is the same folder. Linux, where it is two folders, still checks it. A revert is enough.

Checklist

Ready for review

  • One topic, on current mod-api (#2822's head); the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (Test code only: nothing for the game to run.)
  • mise run test passes (any failure that also fails on main is named). (The checks this change reaches pass, as above. mod-api's whole suite has failures on Windows that this PR doesn't change: #2825 and #2826 fix eight of them.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (Not a fix of the game: the four tests themselves fail on mod-api on Windows and pass here.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary For [#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822) (into `mod-api`). Four checks on the game side fail only on Windows. In each case the code is right and the test's fixture assumes Unix: - `longshot-game` `mod_tests::tests::a_folder_of_mods_tests_each_of_its_folders`: the plan joins a suite's folder with `Path::join` (`/t/suite\hud` on Windows), and the test wrote the expected folders out (`/t/suite/hud`). The expected value is now joined the same way. - `longshot-game` `runtime::tests::a_separate_mod_moves_the_saves_into_its_profile_and_records_it` and `a_mods_profile_sits_inside_the_launchers_save_folder`: they rooted the user and launcher folders at `/u` and `/profiles/two`. Windows takes those as rooted but not whole, so the profile's folder, made whole by `saves_in` with `std::path::absolute`, took the current drive (`C:\u\…`) and the comparisons failed. They start from a whole path on each system now (`whole()`: as it is on Unix, under `C:\` on Windows). - `modtool` `emulators::tests::eden_and_ryujinx_mods_are_found_with_their_switches`: it writes Eden's title-id folder in lower case and in capitals. That is two folders on Linux, but one on Windows and macOS, whose file systems fold case, and there that folder's mods come by name. The test now reads which one the file system gave, expects that order, and finds Speed and Grass by name, not by place. No code the game runs changes. Every assertion stays, among them `a_mods_profile_sits_inside_the_launchers_save_folder`'s check that a mod's profile sits inside the launcher's `save/` subtree, the one the sandbox grants. **To see it on `mod-api`:** on Windows, `cargo test -p longshot-game --lib` and `cargo test -p modtool --lib emulators` (`--target x86_64-pc-windows-gnullvm` with llvm-mingw). ## Testing **Tested:** the four checks, on Windows 11 (`--target x86_64-pc-windows-gnullvm` with llvm-mingw) and on Linux (WSL Ubuntu 24.04). The change is test code only, so there is nothing new for the game to run. Every game run in this PR's series used builds that included this code unchanged. Checks: - On `mod-api` @ c5e5b676, Windows: `longshot-game --lib` 165 pass, these three fail. `modtool` fails `eden_and_ryujinx_mods_are_found_with_their_switches` (`left: [Grass, Speed, Hud]`, `right: [Speed, Grass, Hud]`). - Here, Windows: `longshot-game --lib` 168 pass, 0 fail. `modtool`'s `eden_and_ryujinx_mods_are_found_with_their_switches` passes. - Here, Linux (WSL Ubuntu 24.04, `cargo test`): `mod_tests::…a_folder_of_mods_tests_each_of_its_folders` and the `runtime` tests (5) pass, and so does `modtool`'s `eden_and_ryujinx_mods_are_found_with_their_switches` (two folders there: the capitals-first order). - The sandbox's check still bites: with `saves_in` changed to put the mod's profile outside `save/` (`b.join(folder)`, undone after), `a_mods_profile_sits_inside_the_launchers_save_folder` fails on Windows (`left: C:\profiles\two\a~rando`, `right: …\save\.profiles\a~rando`). - `cargo fmt --check`, `cargo clippy -p longshot-game -p modtool --all-targets --no-deps -- -D warnings` (Windows target) and `mise run lint` pass. **Still to test:** - macOS: `cargo test -p modtool --lib emulators` (its file system folds case, as Windows' does) ## Measurements **Verdict:** fixed. The four checks pass on Windows and still pass on Linux. Baseline: `mod-api` (#2822's head), the branch this PR goes into. Nothing to time: test code only. | | Before: mod-api @ c5e5b676 | After: this PR @ 18c277e8 | |---|---|---| | `cargo test -p longshot-game --lib`, Windows | 165 pass, 3 fail | 168 pass | | `modtool` `eden_and_ryujinx_mods_are_found_with_their_switches`, Windows | FAIL (the order) | pass | | The same, Linux | pass | pass | ## Risks **The sandbox:** not touched; no code the game runs changes. The test that checks a mod's profile sits inside the launcher's granted `save/` subtree keeps that assertion, and still fails when the profile is put outside it (above). On a file system that folds case, the emulators test no longer checks that a title id in capitals sorts first: there it is the same folder. Linux, where it is two folders, still checks it. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `mod-api` (#2822's head); the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. (Test code only: nothing for the game to run.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (The checks this change reaches pass, as above. `mod-api`'s whole suite has failures on Windows that this PR doesn't change: [#2825](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2825) and [#2826](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2826) fix eight of them.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [ ] A fix: a game-free test that fails on `main` and passes here. (Not a fix of the game: the four tests themselves fail on `mod-api` on Windows and pass here.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(game): four game-side checks that fail only on Windows pass there: whole paths, and a file system that folds case
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
18c277e8ba
longshot-game's mod-tests plan joins a suite's folder with Path::join, so its expected LONGSHOT_DEV_MODS is the suite's
folder joined too, not a written "/t/suite/hud". The saves tests rooted the user and launcher folders at "/u" and
"/profiles/two", which Windows takes as rooted but not whole: the profile's folder, made whole with
std::path::absolute, took the current drive, and the comparisons failed on "C:". They start from a whole path on each
system now (whole()); every assertion stays, the one that the mod's profile sits inside the launcher's granted save/
subtree too. modtool's emulators test wrote Eden's title-id folder in lower and in capitals, two folders on Linux, one
on Windows and macOS, whose file systems fold case: there the one folder's mods come by name, and the test reads the
order the file system gives and finds Speed and Grass by name.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/mod-api-win-game-test-fixtures:llun-fix/mod-api-win-game-test-fixtures'
git switch 'llun-fix/mod-api-win-game-test-fixtures'

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 'mod-api'
git merge --no-ff 'llun-fix/mod-api-win-game-test-fixtures'
git switch 'llun-fix/mod-api-win-game-test-fixtures'
git rebase 'mod-api'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-win-game-test-fixtures'
git switch 'llun-fix/mod-api-win-game-test-fixtures'
git rebase 'mod-api'
git switch 'mod-api'
git merge --no-ff 'llun-fix/mod-api-win-game-test-fixtures'
git switch 'mod-api'
git merge --squash 'llun-fix/mod-api-win-game-test-fixtures'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-win-game-test-fixtures'
git switch 'mod-api'
git merge 'llun-fix/mod-api-win-game-test-fixtures'
git push origin 'mod-api'
Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2845
No description provided.