diff options
author | Alan Somers <asomers@gmail.com> | 2020-12-09 19:53:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 19:53:48 -0700 |
commit | 5729d0f391775c98699f0f92f8df6b7f5f49fc7d (patch) | |
tree | fd34097841bf04132e390e7f2a4279f8897947ab | |
parent | a848ab555c99a8275342a920ae4e2d7ad809d518 (diff) | |
parent | da204cf4a7efb05ea0fcdb435fbb115af96a6072 (diff) | |
download | nix-5729d0f391775c98699f0f92f8df6b7f5f49fc7d.zip |
Merge pull request #1353 from asomers/test_reliability2
Fix intermittency in some tests
-rw-r--r-- | test/sys/test_aio.rs | 7 | ||||
-rw-r--r-- | test/test_unistd.rs | 22 |
2 files changed, 21 insertions, 8 deletions
diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index 6b9bd911..37ad3257 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -164,7 +164,12 @@ fn test_aio_suspend() { loop { { let cbbuf = [&wcb, &rcb]; - assert!(aio_suspend(&cbbuf[..], Some(timeout)).is_ok()); + let r = aio_suspend(&cbbuf[..], Some(timeout)); + match r { + Err(Error::Sys(Errno::EINTR)) => continue, + Err(e) => panic!("aio_suspend returned {:?}", e), + Ok(_) => () + }; } if rcb.error() != Err(Error::from(Errno::EINPROGRESS)) && wcb.error() != Err(Error::from(Errno::EINPROGRESS)) { diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 113bef62..a5c6a332 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -19,7 +19,6 @@ use std::ffi::CString; use std::fs::DirBuilder; use std::fs::{self, File}; use std::io::Write; -use std::mem; use std::os::unix::prelude::*; #[cfg(not(target_os = "redox"))] use std::path::Path; @@ -336,11 +335,17 @@ macro_rules! execve_test_factory( } } + // These tests frequently fail on musl, probably due to + // https://github.com/nix-rust/nix/issues/555 + #[cfg_attr(target_env = "musl", ignore)] #[test] fn test_cstr_ref() { common_test(syscall_cstr_ref); } + // These tests frequently fail on musl, probably due to + // https://github.com/nix-rust/nix/issues/555 + #[cfg_attr(target_env = "musl", ignore)] #[test] fn test_cstring() { common_test(syscall_cstring); @@ -356,6 +361,8 @@ cfg_if!{ execve_test_factory!(test_fexecve, fexecve, File::open("/system/bin/sh").unwrap().into_raw_fd()); } else if #[cfg(any(target_os = "freebsd", target_os = "linux"))] { + // These tests frequently fail on musl, probably due to + // https://github.com/nix-rust/nix/issues/555 execve_test_factory!(test_execve, execve, CString::new("/bin/sh").unwrap().as_c_str()); execve_test_factory!(test_fexecve, fexecve, File::open("/bin/sh").unwrap().into_raw_fd()); } else if #[cfg(any(target_os = "dragonfly", @@ -378,11 +385,14 @@ execve_test_factory!(test_execvpe, execvpe, &CString::new("sh").unwrap()); cfg_if!{ if #[cfg(target_os = "android")] { use nix::fcntl::AtFlags; - execve_test_factory!(test_execveat_empty, execveat, File::open("/system/bin/sh").unwrap().into_raw_fd(), + execve_test_factory!(test_execveat_empty, execveat, + File::open("/system/bin/sh").unwrap().into_raw_fd(), "", AtFlags::AT_EMPTY_PATH); - execve_test_factory!(test_execveat_relative, execveat, File::open("/system/bin/").unwrap().into_raw_fd(), + execve_test_factory!(test_execveat_relative, execveat, + File::open("/system/bin/").unwrap().into_raw_fd(), "./sh", AtFlags::empty()); - execve_test_factory!(test_execveat_absolute, execveat, File::open("/").unwrap().into_raw_fd(), + execve_test_factory!(test_execveat_absolute, execveat, + File::open("/").unwrap().into_raw_fd(), "/system/bin/sh", AtFlags::empty()); } else if #[cfg(all(target_os = "linux", any(target_arch ="x86_64", target_arch ="x86")))] { use nix::fcntl::AtFlags; @@ -466,9 +476,7 @@ fn test_fchown() { fchown(fd, uid, gid).unwrap(); fchown(fd, uid, None).unwrap(); fchown(fd, None, gid).unwrap(); - - mem::drop(path); - fchown(fd, uid, gid).unwrap_err(); + fchown(999999999, uid, gid).unwrap_err(); } #[test] |