F1 menu tests: the variables they change come back, also on a failed assertion #2500
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2500"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by breachato on 2026-11-29T13:42:05Z.
[pr-tests]
What it changes
Updated after
mainmoved:mainnow hastest_env_lock()and takes it in the shadow-lift test, which fixes the race this PR first addressed (5 of 5 parallel runs failed on829188e; on today'smainthey pass). What is left is the point raised in review:a_change_is_saved_at_once_however_the_game_was_startedremovesVICTORY_MENU_FILEand pointsVICTORY_HOMEat 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_offsetsVICTORY_VEHICLE_AUTO_CENTERwithout the lock and restores it by hand after its assertions, so a failed assertion leaves it set.This moves the shadow-lift test's
Restoreguard to the test module (Restore::saving(&[...])) and takes it right aftertest_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 testpassed 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
menu.rstoo (help text only, no shared lines).Assisted by Claude.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ANDREANIADS on 2026-11-29T13:58:00Z.
At
43658eathe 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_startedremovesVICTORY_MENU_FILEand replacesVICTORY_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
Restoreguard for both keys? Declare it after acquiring_envso the original values (including absence) are restored before unlocking, even if an assertion unwinds.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by breachato on 2026-11-29T17:32:39Z.
Good catch, thanks. Done in
fbe67fd:Restorenow lives in the test module, and all three tests take it right afterenv_lock()(VICTORY_MENU_FILE+VICTORY_HOMEina_change_…,VICTORY_VEHICLE_AUTO_CENTERin 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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by breachato on 2026-12-01T13:59:26Z.
Closing: the menu tests this fixed were removed from
menu.rsin3bde4923(#4634), so there is nothing left to restore.Pull request closed