summaryrefslogtreecommitdiff
path: root/test/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.rs')
-rw-r--r--test/test.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test.rs b/test/test.rs
index a72dc44a..14f63e26 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -9,6 +9,21 @@ extern crate libc;
extern crate rand;
extern crate tempfile;
+macro_rules! skip_if_not_root {
+ ($name:expr) => {
+ use nix::unistd::Uid;
+ use std;
+ use std::io::Write;
+
+ if !Uid::current().is_root() {
+ let stderr = std::io::stderr();
+ let mut handle = stderr.lock();
+ writeln!(handle, "{} requires root privileges. Skipping test.", $name).unwrap();
+ return;
+ }
+ };
+}
+
mod sys;
mod test_dir;
mod test_fcntl;