From e11edc9263dc011655f06f3db206c924b2dfe7eb Mon Sep 17 00:00:00 2001 From: gmanka Date: Wed, 25 Nov 2026 21:13:04 +0500 Subject: [PATCH] Make the Linux physical-page alias test deterministic The pool returns recycled IDs in stack order. A prior test can leave those IDs in descending order, making this fixture observe a one-page region where it intended to test a three-page mapping. Hold the recycled IDs while allocating the fixture. This exercises the same contiguous region and the same aliased page regardless of earlier tests, and returns the held IDs after the checks. Tested-on: Fedora Linux 45, x86_64 native loader Assisted-by: gpt-6.2 sol xhigh --- crates/victory-loader/src/linux/vm.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/victory-loader/src/linux/vm.rs b/crates/victory-loader/src/linux/vm.rs index dee9a1fd69..5ec7cde985 100644 --- a/crates/victory-loader/src/linux/vm.rs +++ b/crates/victory-loader/src/linux/vm.rs @@ -1854,6 +1854,10 @@ mod tests { #[test] fn physical_pages_map_alias_and_free() { let _pool = POOL_TESTS.lock().unwrap_or_else(|e| e.into_inner()); + // Hold previously recycled IDs so the fixture gets one ascending run. + let recycled = state().pool_free.len(); + let mut held = vec![0u64; recycled]; + phys_alloc(&mut held).unwrap(); let mut pages = [0u64; 3]; phys_alloc(&mut pages).unwrap(); assert!(phys_fd().is_some()); @@ -1883,6 +1887,7 @@ mod tests { assert!(pages.contains(&again[0])); phys_free(&again); free(va, 0, MEM_RELEASE).unwrap(); + phys_free(&held); } #[test]