F1 menu tests: the variables they change come back, also on a failed assertion #2500

Closed
github-bot wants to merge 14 commits from github-bot/gh-2500 into main AGit
Owner

@⁠breachato on GitHub · 2026-11-29 13:42 UTC · original
breachato:menu-tests-env-lock → main · +988 −871 · 32 files · 14 commits · closed without merging

[pr-tests]

What it changes

Updated after main moved: main now has test_env_lock() and takes it in the shadow-lift test, which fixes the race this PR first addressed (5 of 5 parallel runs failed on 829188e; on today's main they pass). What is left is the point raised in review:

  • a_change_is_saved_at_once_however_the_game_was_started removes VICTORY_MENU_FILE and points VICTORY_HOME at a folder it deletes at the end, and puts neither back. A later test in the same process then saves into that deleted folder.
  • vehicle_auto_center_zero_is_normalized_to_off sets VICTORY_VEHICLE_AUTO_CENTER without the lock and restores it by hand after its assertions, so a failed assertion leaves it set.

This moves the shadow-lift test's Restore guard to the test module (Restore::saving(&[...])) and takes it right after test_env_lock() in those three tests. The vehicle test now takes the lock too. Values, or their absence, come back before the lock is released, even when an assertion unwinds. Test-only; no runtime code changes.

How it was tested

  • cargo test -p victory-gpu --lib --locked host::menu::tests, Windows 11, toolchain 1.98.1: 28 passed, 3 of 3 parallel runs, and with --test-threads=1.
  • cargo test passed for the crates it touches: yes (the menu tests; nothing else changes)

How to try it

cargo test -p victory-gpu --lib --locked host::menu::tests, in parallel and with -- --test-threads=1: 28 pass both ways. The change is in the tests module only.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2495 touches menu.rs too (help text only, no shared lines).

Assisted by Claude.

**@⁠breachato** on GitHub · 2026-11-29 13:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2500) `breachato:menu-tests-env-lock` → `main` · +988 −871 · 32 files · 14 commits · closed without merging [pr-tests] ## What it changes Updated after `main` moved: `main` now has `test_env_lock()` and takes it in the shadow-lift test, which fixes the race this PR first addressed (5 of 5 parallel runs failed on 829188e; on today's `main` they pass). What is left is the point raised in review: - `a_change_is_saved_at_once_however_the_game_was_started` removes `VICTORY_MENU_FILE` and points `VICTORY_HOME` at a folder it deletes at the end, and puts neither back. A later test in the same process then saves into that deleted folder. - `vehicle_auto_center_zero_is_normalized_to_off` sets `VICTORY_VEHICLE_AUTO_CENTER` without the lock and restores it by hand after its assertions, so a failed assertion leaves it set. This moves the shadow-lift test's `Restore` guard to the test module (`Restore::saving(&[...])`) and takes it right after `test_env_lock()` in those three tests. The vehicle test now takes the lock too. Values, or their absence, come back before the lock is released, even when an assertion unwinds. Test-only; no runtime code changes. ## How it was tested - `cargo test -p victory-gpu --lib --locked host::menu::tests`, Windows 11, toolchain 1.98.1: 28 passed, 3 of 3 parallel runs, and with `--test-threads=1`. - `cargo test` passed for the crates it touches: yes (the menu tests; nothing else changes) ## How to try it `cargo test -p victory-gpu --lib --locked host::menu::tests`, in parallel and with `-- --test-threads=1`: 28 pass both ways. The change is in the tests module only. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2495 touches `menu.rs` too (help text only, no shared lines). Assisted by Claude.
gray_shadow_lift_is_live_and_saved_as_a_percentage sets VICTORY_MENU_FILE
while a_change_is_saved_at_once_however_the_game_was_started removes it
(and sets VICTORY_HOME). Under the harness's parallel run one of the two
saved where the other had pointed the menu: cargo test -p victory-gpu
--lib host::menu failed in 5 of 5 runs on 829188e, a different test each
time, and passed with --test-threads=1. A lock in the test module, taken
by the three tests that set variables the menu reads, makes it 5 of 5
passes in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:44:39 +00:00
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-29 13:58 UTC · original

At 43658ea the three tests take the same mutex. One isolation detail survives even with a single test thread: a_change_is_saved_at_once_however_the_game_was_started removes VICTORY_MENU_FILE and replaces VICTORY_HOME, then deletes the temporary directory without restoring either variable. In a synthetic process seeded with both values, repeating just those two environment operations under a lock and reacquiring it yielded (unset, temporary-home). This checks state lifetime only; I did not run the Windows suite.

Could the test reuse the gray-shadow test’s Restore guard for both keys? Declare it after acquiring _env so the original values (including absence) are restored before unlocking, even if an assertion unwinds.

**@⁠ANDREANIADS** on GitHub · 2026-11-29 13:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2500#issuecomment-7256936368) At `43658ea` the three tests take the same mutex. One isolation detail survives even with a single test thread: `a_change_is_saved_at_once_however_the_game_was_started` removes `VICTORY_MENU_FILE` and replaces `VICTORY_HOME`, then deletes the temporary directory without restoring either variable. In a synthetic process seeded with both values, repeating just those two environment operations under a lock and reacquiring it yielded `(unset, temporary-home)`. This checks state lifetime only; I did not run the Windows suite. Could the test reuse the gray-shadow test’s `Restore` guard for both keys? Declare it after acquiring `_env` so the original values (including absence) are restored before unlocking, even if an assertion unwinds.
a_change_is_saved_at_once_however_the_game_was_started removed
VICTORY_MENU_FILE and replaced VICTORY_HOME without restoring either, so
later tests in the same process saw its temporary home. The Restore guard
of the shadow-lift test moves to the test module and is taken right after
env_lock by all three tests, so the values (or their absence) come back
before the lock is released, even when an assertion unwinds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠breachato on GitHub · 2026-11-29 17:32 UTC · original

Good catch, thanks. Done in fbe67fd: Restore now lives in the test module, and all three tests take it right after env_lock() (VICTORY_MENU_FILE + VICTORY_HOME in a_change_…, VICTORY_VEHICLE_AUTO_CENTER in the vehicle test). The values, or their absence, come back before the lock is released, also on unwind. The menu tests pass in parallel (3/3) and with --test-threads=1.

**@⁠breachato** on GitHub · 2026-11-29 17:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2500#issuecomment-7259774387) Good catch, thanks. Done in fbe67fd: `Restore` now lives in the test module, and all three tests take it right after `env_lock()` (`VICTORY_MENU_FILE` + `VICTORY_HOME` in `a_change_…`, `VICTORY_VEHICLE_AUTO_CENTER` in the vehicle test). The values, or their absence, come back before the lock is released, also on unwind. The menu tests pass in parallel (3/3) and with `--test-threads=1`.
github-bot changed title from F1 menu tests: the ones that change the environment run one at a time to F1 menu tests: the variables they change come back, also on a failed assertion 2026-11-30 18:17:30 +00:00
github-bot force-pushed github-bot/gh-2500 from fbe67fdf5b to 84871ab688 2026-11-30 18:17:31 +00:00 Compare
github-bot force-pushed github-bot/gh-2500 from 84871ab688 to 2838098035 2026-11-30 18:47:06 +00:00 Compare
github-bot closed this pull request 2026-12-01 14:00:29 +00:00
Author
Owner

@⁠breachato on GitHub · 2026-12-01 13:59 UTC · original

Closing: the menu tests this fixed were removed from menu.rs in 3bde4923 (#4635), so there is nothing left to restore.

**@⁠breachato** on GitHub · 2026-12-01 13:59 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2500#issuecomment-7313515467) Closing: the menu tests this fixed were removed from `menu.rs` in 3bde4923 (#4635), so there is nothing left to restore.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2500
No description provided.