From 3405a7c37472b64c53bb5c80b96d470ac7f074b4 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 12 Jun 2021 16:58:02 -0600 Subject: Fix some unused import warnings in the tests --- test/test_unistd.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 94d2d1b9..1609c853 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -1,6 +1,6 @@ #[cfg(not(target_os = "redox"))] use nix::fcntl::{self, open, readlink}; -use nix::fcntl::{fcntl, FcntlArg, FdFlag, OFlag}; +use nix::fcntl::OFlag; use nix::unistd::*; use nix::unistd::ForkResult::*; #[cfg(not(target_os = "redox"))] @@ -13,14 +13,14 @@ use nix::errno::Errno; #[cfg(not(target_os = "redox"))] use nix::Error; use std::{env, iter}; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox")))] use std::ffi::CString; #[cfg(not(target_os = "redox"))] use std::fs::DirBuilder; use std::fs::{self, File}; use std::io::Write; use std::os::unix::prelude::*; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox")))] use std::path::Path; use tempfile::{tempdir, tempfile}; use libc::{_exit, mode_t, off_t}; @@ -135,6 +135,8 @@ fn test_mkfifoat_none() { target_os = "macos", target_os = "ios", target_os = "android", target_os = "redox")))] fn test_mkfifoat() { + use nix::fcntl; + let tempdir = tempdir().unwrap(); let dirfd = open(tempdir.path(), OFlag::empty(), Mode::empty()).unwrap(); let mkfifoat_name = "mkfifoat_name"; @@ -258,7 +260,7 @@ fn test_initgroups() { setgroups(&old_groups).unwrap(); } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox")))] macro_rules! execve_test_factory( ($test_name:ident, $syscall:ident, $exe: expr $(, $pathname:expr, $flags:expr)*) => ( @@ -669,6 +671,8 @@ fn test_pipe() { target_os = "solaris"))] #[test] fn test_pipe2() { + use nix::fcntl::{fcntl, FcntlArg, FdFlag}; + let (fd0, fd1) = pipe2(OFlag::O_CLOEXEC).unwrap(); let f0 = FdFlag::from_bits_truncate(fcntl(fd0, FcntlArg::F_GETFD).unwrap()); assert!(f0.contains(FdFlag::FD_CLOEXEC)); -- cgit v1.2.3 From 221eac1e8f009041b5aeeb8736e29837d2f7776a Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 12 Jun 2021 16:58:53 -0600 Subject: Reenable tests that only failed on Travis, since we no longer use it. --- test/sys/test_aio.rs | 4 +--- test/sys/test_aio_drop.rs | 1 - test/test_fcntl.rs | 12 ++++++++---- test/test_ptymaster_drop.rs | 4 ---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index 753f1182..254d771b 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -142,9 +142,7 @@ fn test_fsync_error() { } #[test] -#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)] -// On Travis, aio_suspend hits an assertion within glibc. This is either a bug -// in Travis's version of glibc or Linux. Either way, we must skip the test. +// On Cirrus on Linux, this test fails due to a glibc bug. // https://github.com/nix-rust/nix/issues/1099 #[cfg_attr(target_os = "linux", ignore)] // On Cirrus, aio_suspend is failing with EINVAL diff --git a/test/sys/test_aio_drop.rs b/test/sys/test_aio_drop.rs index 784ee3ef..71a2183b 100644 --- a/test/sys/test_aio_drop.rs +++ b/test/sys/test_aio_drop.rs @@ -9,7 +9,6 @@ target_os = "macos", target_os = "freebsd", target_os = "netbsd")))] -#[cfg_attr(target_env = "gnu", ignore = "Occasionally fails in Travis; glibc bug suspected")] fn test_drop() { use nix::sys::aio::*; use nix::sys::signal::*; diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index 48d46626..d1c70856 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -102,11 +102,15 @@ mod linux_android { /// resulting file is read and should contain the contents `bar`. /// The from_offset should be updated by the call to reflect /// the 3 bytes read (6). - /// - /// FIXME: This test is disabled for linux based builds, because Travis - /// Linux version is too old for `copy_file_range`. #[test] - #[ignore] + // QEMU does not support copy_file_range. Skip platforms that use QEMU in CI + #[cfg_attr(all(target_os = "linux", any( + target_arch = "aarch64", + target_arch = "arm", + target_arch = "mips", + target_arch = "mips64", + target_arch = "powerpc64" + )), ignore)] fn test_copy_file_range() { const CONTENTS: &[u8] = b"foobarbaz"; diff --git a/test/test_ptymaster_drop.rs b/test/test_ptymaster_drop.rs index ff939b9c..a68f81ee 100644 --- a/test/test_ptymaster_drop.rs +++ b/test/test_ptymaster_drop.rs @@ -12,10 +12,6 @@ mod t { /// race condition. #[test] #[should_panic(expected = "Closing an invalid file descriptor!")] - // In Travis on i686-unknown-linux-musl, this test gets SIGABRT. I don't - // know why. It doesn't happen on any other target, and it doesn't happen - // on my PC. - #[cfg_attr(all(target_env = "musl", target_arch = "x86"), ignore)] fn test_double_close() { let m = posix_openpt(OFlag::O_RDWR).unwrap(); close(m.as_raw_fd()).unwrap(); -- cgit v1.2.3