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

Closed
tphira612 wants to merge 1 commit from upstream-pr/3618 into main
tphira612 commented 2026-11-30 01:54:03 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tphira612 on 2026-11-30T01:54:03Z.


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.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5557578411 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618). Originally posted by [tphira612](https://github.com/tphira612) on 2026-11-30T01:54:03Z. --- ## 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.
Trillazill commented 2026-11-30 02:54:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-11-30T02:54:09Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6106367889 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618#pullrequestreview-6106367889). Originally posted by [Trillazill](https://github.com/Trillazill) on 2026-11-30T02:54:09Z. **Review:** COMMENTED --- 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.
babuakhil commented 2026-11-30 16:48:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-30T16:48:01Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7285247171 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3618#issuecomment-7285247171). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-30T16:48:01Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

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