F1 menu tests: the two that set where the menu saves no longer race #3618

Closed
github-bot wants to merge 1 commit from github-bot/gh-3618 into main AGit
Owner

@⁠tphira612 on GitHub · 2026-11-30 01:54 UTC · original
tests/menu-env-race → main · +18 −1 · 1 files · 1 commits · closed without merging

What it changes

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 expects it unset and VICTORY_HOME set. The harness runs them at the same time, so the second test saved into the first one's file and found nothing in its own (menu.rs assertion on VICTORY_MENU_DLSS=quality).

Both tests now hold one lock (SAVES) while they change those variables and save. Test-only; nothing in the game changes.

How it was tested

  • cargo test -p victory-gpu --lib host::menu: 40 of 40 runs failed on main, 3 of 3 pass with this change (14 passed).
  • cargo clippy -p victory-gpu --all-targets: no warnings in menu.rs. cargo xtask policy --staged passes.
  • This is one of the failures in the full cargo test -p victory-gpu --lib run on main; the other, every_switch_of_the_translator_is_in_the_key, is fixed by #3385 / #3530.
**@⁠tphira612** on GitHub · 2026-11-30 01:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618) `tests/menu-env-race` → `main` · +18 −1 · 1 files · 1 commits · closed without merging ## What it changes `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` expects it unset and `VICTORY_HOME` set. The harness runs them at the same time, so the second test saved into the first one's file and found nothing in its own (`menu.rs` assertion on `VICTORY_MENU_DLSS=quality`). Both tests now hold one lock (`SAVES`) while they change those variables and save. Test-only; nothing in the game changes. ## How it was tested - `cargo test -p victory-gpu --lib host::menu`: **40 of 40 runs failed on `main`, 3 of 3 pass with this change** (14 passed). - `cargo clippy -p victory-gpu --all-targets`: no warnings in `menu.rs`. `cargo xtask policy --staged` passes. - This is one of the failures in the full `cargo test -p victory-gpu --lib` run on `main`; the other, `every_switch_of_the_translator_is_in_the_key`, is fixed by #3385 / #3530.
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 expects it
unset and VICTORY_HOME set. The harness runs them at once, so the second
saved into the first one's file and found nothing in its own: it failed
on every run of `cargo test -p victory-gpu --lib host::menu` (40 of 40 on
main), and in some full runs.

Both now hold one lock while they change those variables and save.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 01:59:22 +00:00
Author
Owner

@⁠Trillazill on GitHub · 2026-11-30 02:54 UTC · original · reviewed

Reviewed and reproduced, and it looks right to me.

Reproduced (Ryzen 9 7900, 24 threads, Windows 11), cargo test --locked -p victory-gpu --lib host::menu:

  • main (41adb551): failed in 9 of 10 runs, at a_change_is_saved_at_once_however_the_game_was_started (menu.rs:1984).
  • this PR (b21922b7): passed in 10 of 10 runs (14 passed).

Checked:

  • These two are the only tests in victory-gpu that reach save() (both through change_and_save), so the lock covers every saver. reset() and the Enter handler's save lines aren't driven by any test, and key_bindings_are_shown_and_written only edits strings, with no file.
  • The order in the first test is right: _saves is declared before _restore, so the variables are put back before the lock is released.
  • The full cargo test -p victory-gpu --lib with this PR shows no menu failures. What's left fails on main too: every_switch_of_the_translator_is_in_the_key (as you say), and pipeline::host::tests::shared_root_signatures_load_from_library_and_execute_across_pso_switches, which failed in 2 of 2 full runs on main here. A GPU test or two (upq, uav_pool) also fails now and then under the full parallel run, outside menu.rs.

One suggestion (not new in this PR): a_change_is_saved_at_once_however_the_game_was_started removes VICTORY_MENU_FILE and sets VICTORY_HOME but never puts them back, so once it lets go of SAVES the rest of the process keeps VICTORY_HOME pointing at the temp folder it deleted. Restore is local to the first test today. Moving it up beside SAVES and using it in the second test too, declared after _saves, would leave both tests clean:

let _saves = saves();
let _restore = Restore(["VICTORY_MENU_FILE", "VICTORY_HOME"].map(|key| (key, std::env::var_os(key))).into());

Nothing reads VICTORY_HOME in victory-gpu's tests today, so this is tidiness rather than a fix.

**@⁠Trillazill** on GitHub · 2026-11-30 02:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618#pullrequestreview-6106367889) · **reviewed** Reviewed and reproduced, and it looks right to me. **Reproduced** (Ryzen 9 7900, 24 threads, Windows 11), `cargo test --locked -p victory-gpu --lib host::menu`: - main (41adb551): failed in 9 of 10 runs, at `a_change_is_saved_at_once_however_the_game_was_started` (`menu.rs:1984`). - this PR (b21922b7): passed in 10 of 10 runs (14 passed). **Checked:** - These two are the only tests in `victory-gpu` that reach `save()` (both through `change_and_save`), so the lock covers every saver. `reset()` and the Enter handler's save lines aren't driven by any test, and `key_bindings_are_shown_and_written` only edits strings, with no file. - The order in the first test is right: `_saves` is declared before `_restore`, so the variables are put back before the lock is released. - The full `cargo test -p victory-gpu --lib` with this PR shows no `menu` failures. What's left fails on main too: `every_switch_of_the_translator_is_in_the_key` (as you say), and `pipeline::host::tests::shared_root_signatures_load_from_library_and_execute_across_pso_switches`, which failed in 2 of 2 full runs on main here. A GPU test or two (`upq`, `uav_pool`) also fails now and then under the full parallel run, outside `menu.rs`. **One suggestion (not new in this PR):** `a_change_is_saved_at_once_however_the_game_was_started` removes `VICTORY_MENU_FILE` and sets `VICTORY_HOME` but never puts them back, so once it lets go of `SAVES` the rest of the process keeps `VICTORY_HOME` pointing at the temp folder it deleted. `Restore` is local to the first test today. Moving it up beside `SAVES` and using it in the second test too, declared after `_saves`, would leave both tests clean: ```rust let _saves = saves(); let _restore = Restore(["VICTORY_MENU_FILE", "VICTORY_HOME"].map(|key| (key, std::env::var_os(key))).into()); ``` Nothing reads `VICTORY_HOME` in `victory-gpu`'s tests today, so this is tidiness rather than a fix.
Author
Owner

@⁠babuakhil on GitHub · 2026-11-30 16:48 UTC · original

Checked on Windows 11 (Rust 1.98.1, pinned). The fix was right for the main it was written against, but main has since fixed the same race the same way, so I think this one can be closed rather than rebased.

cargo test -p victory-gpu --lib --locked host::menu, 30 runs each:

result
41adb551 (this PR's base) a_change_is_saved_at_once_however_the_game_was_started fails in all 30
this PR on 41adb551 30 of 30 pass
current main (84bd61e2, with #4025 so the library's tests build) 30 of 30 pass; the full victory-gpu lib suite also passes 4 of 4 (1133 passed, 0 failed)

On main, both tests now take one lock, SETTINGS_FILE_ENV: a_change_is_saved_… through test_env_lock() (c2820be4) and gray_shadow_lift_is_live_and_saved_as_a_percentage directly (bb946c0f). The newer with_temp_settings_file helper takes it too. Nothing outside menu.rs sets VICTORY_MENU_FILE or VICTORY_HOME. Rebasing this PR would add a second mutex, SAVES, next to the one already there.

**@⁠babuakhil** on GitHub · 2026-11-30 16:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618#issuecomment-7285247171) Checked on Windows 11 (Rust 1.98.1, pinned). The fix was right for the `main` it was written against, but `main` has since fixed the same race the same way, so I think this one can be closed rather than rebased. `cargo test -p victory-gpu --lib --locked host::menu`, 30 runs each: | | result | |---|---| | `41adb551` (this PR's base) | `a_change_is_saved_at_once_however_the_game_was_started` fails in all 30 | | this PR on `41adb551` | 30 of 30 pass | | current `main` (`84bd61e2`, with #4025 so the library's tests build) | 30 of 30 pass; the full `victory-gpu` lib suite also passes 4 of 4 (1133 passed, 0 failed) | On `main`, both tests now take one lock, `SETTINGS_FILE_ENV`: `a_change_is_saved_…` through `test_env_lock()` (c2820be4) and `gray_shadow_lift_is_live_and_saved_as_a_percentage` directly (bb946c0f). The newer `with_temp_settings_file` helper takes it too. Nothing outside `menu.rs` sets `VICTORY_MENU_FILE` or `VICTORY_HOME`. Rebasing this PR would add a second mutex, `SAVES`, next to the one already there.
github-bot closed this pull request 2026-11-30 18:10:37 +00:00

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!3618
No description provided.