diff options
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/mod.rs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/test/common/mod.rs b/test/common/mod.rs index caa39ab4..bb056aab 100644 --- a/test/common/mod.rs +++ b/test/common/mod.rs @@ -1,6 +1,7 @@ use cfg_if::cfg_if; -#[macro_export] macro_rules! skip { +#[macro_export] +macro_rules! skip { ($($reason: expr),+) => { use ::std::io::{self, Write}; @@ -33,7 +34,8 @@ 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 { +#[macro_export] +macro_rules! require_mount { ($name:expr) => { use ::sysctl::{CtlValue, Sysctl}; use nix::unistd::Uid; @@ -41,35 +43,40 @@ cfg_if! { let ctl = ::sysctl::Ctl::new("vfs.usermount").unwrap(); if !Uid::current().is_root() && CtlValue::Int(0) == ctl.value().unwrap() { - skip!("{} requires the ability to mount file systems. Skipping test.", $name); + 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 { +#[cfg(any(target_os = "linux", target_os = "android"))] +#[macro_export] +macro_rules! skip_if_cirrus { ($reason:expr) => { if std::env::var_os("CIRRUS_CI").is_some() { skip!("{}", $reason); } - } + }; } #[cfg(target_os = "freebsd")] -#[macro_export] macro_rules! skip_if_jailed { +#[macro_export] +macro_rules! skip_if_jailed { ($name:expr) => { use ::sysctl::{CtlValue, Sysctl}; let ctl = ::sysctl::Ctl::new("security.jail.jailed").unwrap(); - if let CtlValue::Int(1) = ctl.value().unwrap() - { + if let CtlValue::Int(1) = ctl.value().unwrap() { skip!("{} cannot run in a jail. Skipping test.", $name); } - } + }; } #[cfg(not(any(target_os = "redox", target_os = "fuchsia")))] -#[macro_export] macro_rules! skip_if_not_root { +#[macro_export] +macro_rules! skip_if_not_root { ($name:expr) => { use nix::unistd::Uid; |