Unverified Commit 67df0065 authored by Yan Ru Pei's avatar Yan Ru Pei Committed by GitHub
Browse files

chore: linux gate lib/memory (#5942)


Signed-off-by: default avatarPeaBrane <yanrpei@gmail.com>
parent 76e0e207
...@@ -17,6 +17,7 @@ pub mod pool; ...@@ -17,6 +17,7 @@ pub mod pool;
pub mod prelude; pub mod prelude;
mod device; mod device;
#[cfg(target_os = "linux")]
mod disk; mod disk;
mod pinned; mod pinned;
mod system; mod system;
...@@ -27,6 +28,7 @@ mod tests; ...@@ -27,6 +28,7 @@ mod tests;
pub use arena::{ArenaAllocator, ArenaBuffer, ArenaError}; pub use arena::{ArenaAllocator, ArenaBuffer, ArenaError};
pub use device::DeviceStorage; pub use device::DeviceStorage;
#[cfg(target_os = "linux")]
pub use disk::DiskStorage; pub use disk::DiskStorage;
pub use pinned::PinnedStorage; pub use pinned::PinnedStorage;
pub use system::SystemStorage; pub use system::SystemStorage;
......
...@@ -55,6 +55,7 @@ fn test_system_storage_zero_size() { ...@@ -55,6 +55,7 @@ fn test_system_storage_zero_size() {
)); ));
} }
#[cfg(target_os = "linux")]
#[test] #[test]
fn test_disk_storage_temp() { fn test_disk_storage_temp() {
let storage = DiskStorage::new(4096).unwrap(); let storage = DiskStorage::new(4096).unwrap();
...@@ -65,6 +66,7 @@ fn test_disk_storage_temp() { ...@@ -65,6 +66,7 @@ fn test_disk_storage_temp() {
assert!(storage.path().exists()); assert!(storage.path().exists());
} }
#[cfg(target_os = "linux")]
#[test] #[test]
fn test_disk_storage_at_path() { fn test_disk_storage_at_path() {
let temp_dir = tempfile::tempdir().unwrap(); let temp_dir = tempfile::tempdir().unwrap();
...@@ -98,6 +100,7 @@ fn test_system_storage_unregistered_no_nixl_descriptor() { ...@@ -98,6 +100,7 @@ fn test_system_storage_unregistered_no_nixl_descriptor() {
assert!(storage.nixl_descriptor().is_none()); assert!(storage.nixl_descriptor().is_none());
} }
#[cfg(target_os = "linux")]
#[test] #[test]
fn test_disk_storage_unregistered_no_nixl_descriptor() { fn test_disk_storage_unregistered_no_nixl_descriptor() {
let storage = DiskStorage::new(4096).unwrap(); let storage = DiskStorage::new(4096).unwrap();
...@@ -197,7 +200,8 @@ mod nixl_tests { ...@@ -197,7 +200,8 @@ mod nixl_tests {
// The current implementation uses mem::zeroed() which is invalid for types with NonNull // The current implementation uses mem::zeroed() which is invalid for types with NonNull
// TODO: Fix NixlRegistered::into_storage() implementation // TODO: Fix NixlRegistered::into_storage() implementation
// Disk Storage Tests // Disk Storage Tests (Linux only)
#[cfg(target_os = "linux")]
#[test] #[test]
fn test_disk_storage_registration() { fn test_disk_storage_registration() {
let storage = DiskStorage::new(4096).unwrap(); let storage = DiskStorage::new(4096).unwrap();
...@@ -210,6 +214,7 @@ mod nixl_tests { ...@@ -210,6 +214,7 @@ mod nixl_tests {
assert!(registered.is_registered()); assert!(registered.is_registered());
} }
#[cfg(target_os = "linux")]
#[test] #[test]
fn test_disk_storage_descriptor_consistency() { fn test_disk_storage_descriptor_consistency() {
let storage = DiskStorage::new(8192).unwrap(); let storage = DiskStorage::new(8192).unwrap();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment