diff options
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/common/mod.rs b/test/common/mod.rs index 8a79d6a8..cdc32582 100644 --- a/test/common/mod.rs +++ b/test/common/mod.rs @@ -31,6 +31,20 @@ cfg_if! { } } +/// Skip the test if we don't have the ability to mount file systems. +#[cfg(target_os = "freebsd")] +#[macro_export] macro_rules! require_mount { + ($name:expr) => { + use ::sysctl::CtlValue; + use nix::unistd::Uid; + + if !Uid::current().is_root() && CtlValue::Int(0) == ::sysctl::value("vfs.usermount").unwrap() + { + skip!("{} requires the ability to mount file systems. Skipping test.", $name); + } + } +} + #[cfg(any(target_os = "linux", target_os= "android"))] #[macro_export] macro_rules! skip_if_cirrus { ($reason:expr) => { |