Skip to content

Commit

Permalink
WIP: update test to be independent of page size
Browse files Browse the repository at this point in the history
Probably needs further changes, but hard to check locally...
  • Loading branch information
sk1p committed Feb 2, 2024
1 parent 9125e88 commit 6e07195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions libertem_asi_tpx3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions libertem_asi_tpx3/src/chunk_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6e07195

Please sign in to comment.