From 6e0719571ce7cab75b6d7c4f1727747901213811 Mon Sep 17 00:00:00 2001 From: Alexander Clausen Date: Fri, 2 Feb 2024 14:17:27 +0100 Subject: [PATCH] WIP: update test to be independent of page size Probably needs further changes, but hard to check locally... --- libertem_asi_tpx3/Cargo.toml | 1 + libertem_asi_tpx3/src/chunk_stack.rs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libertem_asi_tpx3/Cargo.toml b/libertem_asi_tpx3/Cargo.toml index 6bfa2225..72752241 100644 --- a/libertem_asi_tpx3/Cargo.toml +++ b/libertem_asi_tpx3/Cargo.toml @@ -25,6 +25,7 @@ uuid = { version = "1.1.2", features = ["v4", "fast-rng"] } ipc-test = { path = "../ipc_test" } stats = { path = "../stats" } zerocopy = "0.6.1" +page_size = "0.5.0" [dev-dependencies] tempfile = "3.3.0" diff --git a/libertem_asi_tpx3/src/chunk_stack.rs b/libertem_asi_tpx3/src/chunk_stack.rs index cfc4b05d..09296328 100644 --- a/libertem_asi_tpx3/src/chunk_stack.rs +++ b/libertem_asi_tpx3/src/chunk_stack.rs @@ -680,20 +680,20 @@ mod tests { #[test] fn test_can_fit() { let (_socket_dir, socket_as_path) = get_socket_path(); - // slot size is rounded up to 4k blocks - let mut shm = SharedSlabAllocator::new(3, 4096, false, &socket_as_path).unwrap(); + let slot_size = page_size::get(); + let mut shm = SharedSlabAllocator::new(3, slot_size, false, &socket_as_path).unwrap(); let slot = shm.get_mut().expect("get a free shm slot"); let mut fs = ChunkStackForWriting::new(slot, 1); - assert!(fs.can_fit(4096)); + assert!(fs.can_fit(slot_size)); assert!(fs.can_fit(1024)); assert!(fs.can_fit(512)); assert!(fs.can_fit(0)); assert!(fs.can_fit(1)); println!("{}", fs.total_size()); - assert!(!fs.can_fit(4097)); + assert!(!fs.can_fit(slot_size + 1)); const NNZ: u32 = 12; const NROWS: u32 = 7;