summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/sys/test_pthread.rs2
-rw-r--r--test/test_net.rs4
-rw-r--r--test/test_unistd.rs9
3 files changed, 10 insertions, 5 deletions
diff --git a/test/sys/test_pthread.rs b/test/sys/test_pthread.rs
index 092a95aa..a4f02772 100644
--- a/test/sys/test_pthread.rs
+++ b/test/sys/test_pthread.rs
@@ -3,5 +3,5 @@ use nix::sys::pthread::*;
#[test]
fn test_pthread_self() {
let tid = pthread_self();
- assert!(tid > 0);
+ assert!(tid != 0);
}
diff --git a/test/test_net.rs b/test/test_net.rs
index acdaf47a..24bd411a 100644
--- a/test/test_net.rs
+++ b/test/test_net.rs
@@ -1,9 +1,9 @@
use nix::net::if_::*;
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
const LOOPBACK: &'static [u8] = b"lo";
-#[cfg(not(target_os = "linux"))]
+#[cfg(not(any(target_os = "android", target_os = "linux")))]
const LOOPBACK: &'static [u8] = b"lo0";
#[test]
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index fd4e327b..7ae01feb 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -64,7 +64,12 @@ fn test_wait() {
#[test]
fn test_mkstemp() {
- let result = mkstemp("/tmp/nix_tempfile.XXXXXX");
+ #[cfg(target_os = "android")]
+ let tmp = "/data/local/tmp/";
+ #[cfg(not(target_os = "android"))]
+ let tmp = "/tmp/";
+
+ let result = mkstemp((tmp.to_owned() + "nix_tempfile.XXXXXX").as_str());
match result {
Ok((fd, path)) => {
close(fd).unwrap();
@@ -73,7 +78,7 @@ fn test_mkstemp() {
Err(e) => panic!("mkstemp failed: {}", e)
}
- let result = mkstemp("/tmp/");
+ let result = mkstemp(tmp);
match result {
Ok(_) => {
panic!("mkstemp succeeded even though it should fail (provided a directory)");