summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2020-05-02 10:17:00 -0600
committerAlan Somers <asomers@gmail.com>2020-07-03 10:47:30 -0600
commitf4698ea3faf35026f951271c45d4e854f5603a8a (patch)
treeaa947b5bc1476a6ce1a81b2ce907c7f027be0f8f
parentd57326e5922de28e2fcaa26e80a71f84a3518be3 (diff)
downloadnix-f4698ea3faf35026f951271c45d4e854f5603a8a.zip
Skip the OFD locks tests on OverlayFS and musl
OFD lock functions don't work as expected on overlayfs, which is a type of union file system. And OVERLAYFS_SUPER_MAGIC isn't defined on musl, at least not yet.
-rw-r--r--Cargo.toml2
-rw-r--r--src/sys/statfs.rs2
-rw-r--r--test/test_fcntl.rs20
3 files changed, 21 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b5c017f7..abb69530 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ exclude = [
]
[dependencies]
-libc = { git = "https://github.com/rust-lang/libc/", features = [ "extra_traits" ] }
+libc = { git = "https://github.com/rust-lang/libc/", rev = "fdc5cf4a1ba362aec989bd3dc7ec88bcd371a23a", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "0.1.10"
diff --git a/src/sys/statfs.rs b/src/sys/statfs.rs
index 3d46be9c..e2b9e6b9 100644
--- a/src/sys/statfs.rs
+++ b/src/sys/statfs.rs
@@ -72,6 +72,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);
diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs
index c9f382bc..29719072 100644
--- a/test/test_fcntl.rs
+++ b/test/test_fcntl.rs
@@ -228,11 +228,19 @@ mod linux_android {
target_arch = "mips64",
target_arch = "mips64el",
target_arch = "powerpc64",
- target_arch = "powerpc64le")))]
+ target_arch = "powerpc64le",
+ target_env = "musl")))]
fn test_ofd_write_lock() {
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 {
@@ -262,11 +270,19 @@ mod linux_android {
target_arch = "mips64",
target_arch = "mips64el",
target_arch = "powerpc64",
- target_arch = "powerpc64le")))]
+ target_arch = "powerpc64le",
+ target_env = "musl")))]
fn test_ofd_read_lock() {
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 {