summaryrefslogtreecommitdiff
path: root/test/test_unistd.rs
diff options
context:
space:
mode:
authorAmanda Tait <atait@google.com>2020-08-05 13:25:03 -0400
committerTamir Duberstein <tamird@google.com>2020-12-19 14:17:42 -0500
commit5846ae2afd76ba1ffaddb9d08f91dfbed30243c4 (patch)
tree132bd0d0d639b1f58471be1e37481381e199973f /test/test_unistd.rs
parent16d62f6622f90208341045864a9a6c5470dc9cc2 (diff)
downloadnix-5846ae2afd76ba1ffaddb9d08f91dfbed30243c4.zip
Add fuchsia support
Allow nix to compile on Fuchsia by conditionally avoiding libc functionality that does not exist for Fuchsia.
Diffstat (limited to 'test/test_unistd.rs')
-rw-r--r--test/test_unistd.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index d169d6e0..0f6cf7d3 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -7,7 +7,7 @@ use nix::unistd::ForkResult::*;
use nix::sys::signal::{SaFlags, SigAction, SigHandler, SigSet, Signal, sigaction};
use nix::sys::wait::*;
use nix::sys::stat::{self, Mode, SFlag};
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
use nix::pty::{posix_openpt, grantpt, unlockpt, ptsname};
use nix::errno::Errno;
#[cfg(not(target_os = "redox"))]
@@ -201,7 +201,7 @@ mod linux_android {
#[test]
// `getgroups()` and `setgroups()` do not behave as expected on Apple platforms
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox", target_os = "fuchsia")))]
fn test_setgroups() {
// Skip this test when not run as root as `setgroups()` requires root.
skip_if_not_root!("test_setgroups");
@@ -224,7 +224,7 @@ fn test_setgroups() {
#[test]
// `getgroups()` and `setgroups()` do not behave as expected on Apple platforms
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox", target_os = "fuchsia")))]
fn test_initgroups() {
// Skip this test when not run as root as `initgroups()` and `setgroups()`
// require root.
@@ -406,6 +406,7 @@ cfg_if!{
}
#[test]
+#[cfg(not(target_os = "fuchsia"))]
fn test_fchdir() {
// fchdir changes the process's cwd
let _dr = crate::DirRestore::new();
@@ -552,7 +553,7 @@ cfg_if!{
skip_if_jailed!("test_acct");
}
}
- } else if #[cfg(not(target_os = "redox"))] {
+ } else if #[cfg(not(any(target_os = "redox", target_os = "fuchsia")))] {
macro_rules! require_acct{
() => {
skip_if_not_root!("test_acct");
@@ -562,7 +563,7 @@ cfg_if!{
}
#[test]
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
fn test_acct() {
use tempfile::NamedTempFile;
use std::process::Command;
@@ -649,7 +650,7 @@ fn test_pipe2() {
}
#[test]
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
fn test_truncate() {
let tempdir = tempdir().unwrap();
let path = tempdir.path().join("file");
@@ -1033,7 +1034,7 @@ fn test_setfsuid() {
}
#[test]
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
fn test_ttyname() {
let fd = posix_openpt(OFlag::O_RDWR).expect("posix_openpt failed");
assert!(fd.as_raw_fd() > 0);
@@ -1056,7 +1057,7 @@ fn test_ttyname() {
}
#[test]
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
fn test_ttyname_not_pty() {
let fd = File::open("/dev/zero").unwrap();
assert!(fd.as_raw_fd() > 0);
@@ -1064,7 +1065,7 @@ fn test_ttyname_not_pty() {
}
#[test]
-#[cfg(all(not(target_os = "redox")))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
fn test_ttyname_invalid_fd() {
assert_eq!(ttyname(-1), Err(Error::Sys(Errno::EBADF)));
}