Skip to content

Commit 0fa7948

Browse files
committed
Fix test_acct in Cirrus.
It requires CAP_SYS_PACCT
1 parent d0e1935 commit 0fa7948

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/test_unistd.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,30 @@ fn test_lseek64() {
387387
close(tmpfd).unwrap();
388388
}
389389

390+
cfg_if!{
391+
if #[cfg(any(target_os = "android", target_os = "linux"))] {
392+
macro_rules! require_acct{
393+
() => {
394+
require_capability!(CAP_SYS_PACCT);
395+
}
396+
}
397+
} else {
398+
macro_rules! require_acct{
399+
() => {
400+
skip_if_not_root!("test_acct");
401+
}
402+
}
403+
}
404+
}
405+
390406
#[test]
391407
fn test_acct() {
392408
use tempfile::NamedTempFile;
393409
use std::process::Command;
394410
use std::{thread, time};
395411

396-
skip_if_not_root!("test_acct");
412+
require_acct!();
413+
397414
let file = NamedTempFile::new().unwrap();
398415
let path = file.path().to_str().unwrap();
399416

0 commit comments

Comments
 (0)