From 668f9c16688d896a0d79f3c7e3114f4750d686bb Mon Sep 17 00:00:00 2001 From: Alogani Date: Sun, 8 Feb 2026 20:10:46 +0100 Subject: [PATCH] better integration test suite macos --- tests/integration_test.rs | 30 ++++++++++++++---------------- tests/mount_mirror_fs.rs | 7 +++++-- tests/offset_test.rs | 30 ++++++++++++++---------------- tests/test_recursion.rs | 31 ++++++++++++++----------------- 4 files changed, 47 insertions(+), 51 deletions(-) diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 3a22fc0..66b4d38 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -1,5 +1,3 @@ -#![cfg(not(target_os = "macos"))] - use easy_fuser::prelude::*; use easy_fuser::templates::{DefaultFuseHandler, mirror_fs::*}; @@ -99,20 +97,20 @@ fn test_mirror_fs_operations() { } eprintln!("Unmounting filesystem..."); - #[cfg(not(target_os = "freebsd"))] - { - let _ = std::process::Command::new("fusermount") - .arg("-u") - .arg(&mntpoint) - .status(); - handle.join().unwrap(); - } + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + let _ = std::process::Command::new("fusermount") + .arg("-u") + .arg(&mntpoint) + .status(); + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + let _ = std::process::Command::new("umount") + .arg(&mntpoint) + .status(); + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + handle.join().unwrap(); #[cfg(target_os = "freebsd")] // TODO: explore why error: no such file or directory happens there - { - let _ = std::process::Command::new("umount") - .arg(&mntpoint) - .status(); - let _ = handle.join(); - } + let _ = handle.join(); + #[cfg(target_os = "macos")] // TODO: why handle.join is blocking ? + drop(handle); drop(mntpoint); } diff --git a/tests/mount_mirror_fs.rs b/tests/mount_mirror_fs.rs index af71b61..816cfa4 100644 --- a/tests/mount_mirror_fs.rs +++ b/tests/mount_mirror_fs.rs @@ -1,5 +1,3 @@ -#![cfg(not(target_os = "macos"))] - use easy_fuser::prelude::*; use easy_fuser::templates::{DefaultFuseHandler, mirror_fs::*}; use std::path::PathBuf; @@ -20,10 +18,15 @@ fn mount_fs() { let source_dir = PathBuf::from("/tmp/easy_fuser_mirror_fs_source"); // Create directories if they don't exist + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] let _ = std::process::Command::new("fusermount") .arg("-u") .arg(&mount_dir) .status(); + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + let _ = std::process::Command::new("umount") + .arg(&mount_dir) + .status(); let _ = std::fs::create_dir(&mount_dir); if !source_dir.exists() { let _ = std::fs::create_dir(&source_dir); diff --git a/tests/offset_test.rs b/tests/offset_test.rs index 875403a..025dd19 100644 --- a/tests/offset_test.rs +++ b/tests/offset_test.rs @@ -1,5 +1,3 @@ -#![cfg(not(target_os = "macos"))] - use easy_fuser::prelude::*; use easy_fuser::templates::{DefaultFuseHandler, mirror_fs::*}; @@ -97,20 +95,20 @@ fn test_mirror_fs_file_offsets() { } eprintln!("Unmounting filesystem..."); - #[cfg(not(target_os = "freebsd"))] - { - let _ = std::process::Command::new("fusermount") - .arg("-u") - .arg(&mntpoint) - .status(); - handle.join().unwrap(); - } + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + let _ = std::process::Command::new("fusermount") + .arg("-u") + .arg(&mntpoint) + .status(); + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + let _ = std::process::Command::new("umount") + .arg(&mntpoint) + .status(); + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + handle.join().unwrap(); #[cfg(target_os = "freebsd")] // TODO: explore why error: no such file or directory happens there - { - let _ = std::process::Command::new("umount") - .arg(&mntpoint) - .status(); - let _ = handle.join(); - } + let _ = handle.join(); + #[cfg(target_os = "macos")] // TODO: why handle.join is blocking ? + drop(handle); drop(mntpoint); } diff --git a/tests/test_recursion.rs b/tests/test_recursion.rs index 0204a9c..c4620fb 100644 --- a/tests/test_recursion.rs +++ b/tests/test_recursion.rs @@ -1,5 +1,3 @@ -#![cfg(not(target_os = "macos"))] - use easy_fuser::prelude::*; use easy_fuser::templates::{DefaultFuseHandler, mirror_fs::*}; @@ -77,21 +75,20 @@ fn test_mirror_fs_recursion() { println!("Test passed: No infinite recursion detected."); eprintln!("Unmounting filesystem..."); - #[cfg(not(target_os = "freebsd"))] - { - let _ = std::process::Command::new("fusermount") - .arg("-u") - .arg(&mntpoint) - .status(); - handle.join().unwrap(); - } + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + let _ = std::process::Command::new("fusermount") + .arg("-u") + .arg(&mntpoint) + .status(); + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + let _ = std::process::Command::new("umount") + .arg(&mntpoint) + .status(); + #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] + handle.join().unwrap(); #[cfg(target_os = "freebsd")] // TODO: explore why error: no such file or directory happens there - { - let _ = std::process::Command::new("umount") - .arg(&mntpoint) - .status(); - let _ = handle.join(); - } + let _ = handle.join(); + #[cfg(target_os = "macos")] // TODO: why handle.join is blocking ? + drop(handle); drop(mntpoint); - }