summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Neumann <mneumann@ntecs.de>2017-11-17 12:23:41 +0100
committerMichael Neumann <mneumann@ntecs.de>2017-12-19 10:45:23 +0100
commit709cbdf12cacb6ecf42cca9000d1d46380b6ba62 (patch)
treeca4959e8ee070e910e3cb398dc6848c1135feb94 /test
parentf778523d4d557ad2af720b33998b7b81c375c8e5 (diff)
downloadnix-709cbdf12cacb6ecf42cca9000d1d46380b6ba62.zip
Fix support for DragonFly
* DragonFly does not have a O_DSYNC flag * Fix type_of_cmsg_data on DragonFly * No fexecve() on DragonFly * Do not run aio test cases on DragonFly * Keep target lists in alphabetical order * Unscrable #[cfg] directives and use cfg_if! macro instead * Fix errno on DragonFly Below follows an explanation why we have to use a C extension to get errno working on DragonFly: DragonFly uses a thread-local errno variable, but #[thread_local] is feature-gated and not available in stable Rust as of this writing (Rust 1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access it. Tracking issue for `thread_local` stabilization: https://github.com/rust-lang/rust/issues/29594 Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c, remove the build-dependency from Cargo.toml, and use: extern { #[thread_local] static errno: c_int; } Now all targets will use the build.rs script, but only on DragonFly this will do something. Also, there are no additional dependencies for targets other than DragonFly (no gcc dep).
Diffstat (limited to 'test')
-rw-r--r--test/sys/mod.rs16
-rw-r--r--test/test_unistd.rs13
2 files changed, 20 insertions, 9 deletions
diff --git a/test/sys/mod.rs b/test/sys/mod.rs
index 3aab9fc5..31cf73b1 100644
--- a/test/sys/mod.rs
+++ b/test/sys/mod.rs
@@ -1,6 +1,15 @@
mod test_signal;
-#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios",
- target_os = "netbsd", target_os = "macos", target_os = "linux"))]
+
+// NOTE: DragonFly lacks a kernel-level implementation of Posix AIO as of
+// this writing. There is an user-level implementation, but whether aio
+// works or not heavily depends on which pthread implementation is chosen
+// by the user at link time. For this reason we do not want to run aio test
+// cases on DragonFly.
+#[cfg(any(target_os = "freebsd",
+ target_os = "ios",
+ target_os = "linux",
+ target_os = "macos",
+ target_os = "netbsd"))]
mod test_aio;
#[cfg(target_os = "linux")]
mod test_signalfd;
@@ -14,5 +23,6 @@ mod test_uio;
#[cfg(target_os = "linux")]
mod test_epoll;
mod test_pthread;
-#[cfg(any(target_os = "linux", target_os = "android"))]
+#[cfg(any(target_os = "android",
+ target_os = "linux"))]
mod test_ptrace;
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index b29ece3e..11e57ff7 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -241,16 +241,17 @@ cfg_if!{
if #[cfg(target_os = "android")] {
execve_test_factory!(test_execve, execve, &CString::new("/system/bin/sh").unwrap());
execve_test_factory!(test_fexecve, fexecve, File::open("/system/bin/sh").unwrap().into_raw_fd());
- } else if #[cfg(any(target_os = "dragonfly",
- target_os = "freebsd",
+ } else if #[cfg(any(target_os = "freebsd",
+ target_os = "linux",
target_os = "netbsd",
- target_os = "openbsd",
- target_os = "linux", ))] {
+ target_os = "openbsd"))] {
execve_test_factory!(test_execve, execve, &CString::new("/bin/sh").unwrap());
execve_test_factory!(test_fexecve, fexecve, File::open("/bin/sh").unwrap().into_raw_fd());
- } else if #[cfg(any(target_os = "ios", target_os = "macos", ))] {
+ } else if #[cfg(any(target_os = "dragonfly",
+ target_os = "ios",
+ target_os = "macos"))] {
execve_test_factory!(test_execve, execve, &CString::new("/bin/sh").unwrap());
- // No fexecve() on macos/ios.
+ // No fexecve() on macos/ios and DragonFly.
}
}