Skip to content

Commit

Permalink
Skip the OFD locks tests on OverlayFS
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed May 2, 2020
1 parent 78d6746 commit 06d818c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -16,7 +16,7 @@ exclude = [
]

[dependencies]
libc = { git = "https://github.com/rust-lang/libc/", features = [ "extra_traits" ] }
libc = { git = "https://github.com/asomers/libc/", rev = "6f3ffc9bf8d2f4a8569db765c4b0623e90c8babf", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "0.1.10"
void = "1.0.2"
Expand Down
2 changes: 2 additions & 0 deletions src/sys/statfs.rs
Expand Up @@ -75,6 +75,8 @@ pub const NFS_SUPER_MAGIC: FsType = FsType(libc::NFS_SUPER_MAGIC);
#[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))]
pub const OPENPROM_SUPER_MAGIC: FsType = FsType(libc::OPENPROM_SUPER_MAGIC);
#[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))]
pub const OVERLAYFS_SUPER_MAGIC: FsType = FsType(libc::OVERLAYFS_SUPER_MAGIC);
#[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))]
pub const PROC_SUPER_MAGIC: FsType = FsType(libc::PROC_SUPER_MAGIC);
#[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))]
pub const QNX4_SUPER_MAGIC: FsType = FsType(libc::QNX4_SUPER_MAGIC);
Expand Down
13 changes: 13 additions & 0 deletions test/test_fcntl.rs
Expand Up @@ -219,6 +219,13 @@ mod linux_android {
let tmp = NamedTempFile::new().unwrap();

let fd = tmp.as_raw_fd();
let statfs = nix::sys::statfs::fstatfs(&tmp).unwrap();
if statfs.filesystem_type() == nix::sys::statfs::OVERLAYFS_SUPER_MAGIC {
// OverlayFS is a union file system. It returns one inode value in
// stat(2), but a different one shows up in /proc/locks. So we must
// skip the test.
skip!("/proc/locks does not work on overlayfs");
}
let inode = fstat(fd).expect("fstat failed").st_ino as usize;

let mut flock = libc::flock {
Expand Down Expand Up @@ -256,6 +263,12 @@ mod linux_android {

println!("TMPDIR is {:?}", std::env::var("TMPDIR"));
let statfs = nix::sys::statfs::fstatfs(&tmp).unwrap();
if statfs.filesystem_type() == nix::sys::statfs::OVERLAYFS_SUPER_MAGIC {
// OverlayFS is a union file system. It returns one inode value in
// stat(2), but a different one shows up in /proc/locks. So we must
// skip the test.
skip!("/proc/locks does not work on overlayfs");
}
println!("fd fstatfs is {:?}", statfs);
println!("fd fstatfs.filesystem_type() is {:?}", statfs.filesystem_type());

Expand Down

0 comments on commit 06d818c

Please sign in to comment.