summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/sys/mod.rs1
-rw-r--r--test/sys/test_signal.rs7
-rw-r--r--test/sys/test_uio.rs2
-rw-r--r--test/sys/test_wait.rs2
-rw-r--r--test/test_mount.rs2
-rw-r--r--test/test_unistd.rs12
6 files changed, 17 insertions, 9 deletions
diff --git a/test/sys/mod.rs b/test/sys/mod.rs
index a5f3351d..6176eb32 100644
--- a/test/sys/mod.rs
+++ b/test/sys/mod.rs
@@ -1,3 +1,4 @@
+mod test_signal;
mod test_socket;
mod test_sockopt;
mod test_termios;
diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs
new file mode 100644
index 00000000..4084a0da
--- /dev/null
+++ b/test/sys/test_signal.rs
@@ -0,0 +1,7 @@
+use nix::unistd::*;
+use nix::sys::signal::*;
+
+#[test]
+fn test_kill_none() {
+ kill(getpid(), None).ok().expect("Should be able to send signal to myself.");
+}
diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs
index dda97cde..90cda56f 100644
--- a/test/sys/test_uio.rs
+++ b/test/sys/test_uio.rs
@@ -2,7 +2,7 @@ use nix::sys::uio::*;
use nix::unistd::*;
use rand::{thread_rng, Rng};
use std::{cmp, iter};
-use std::fs::{OpenOptions, remove_file};
+use std::fs::{OpenOptions};
use std::os::unix::io::AsRawFd;
use tempdir::TempDir;
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs
index c2112bac..d8ac94e4 100644
--- a/test/sys/test_wait.rs
+++ b/test/sys/test_wait.rs
@@ -9,7 +9,7 @@ fn test_wait_signal() {
match fork() {
Ok(Child) => pause().unwrap_or(()),
Ok(Parent { child }) => {
- kill(child, SIGKILL).ok().expect("Error: Kill Failed");
+ kill(child, Some(SIGKILL)).ok().expect("Error: Kill Failed");
assert_eq!(waitpid(child, None), Ok(WaitStatus::Signaled(child, SIGKILL, false)));
},
// panic, fork should never fail unless there is a serious problem with the OS
diff --git a/test/test_mount.rs b/test/test_mount.rs
index 73d26891..42670216 100644
--- a/test/test_mount.rs
+++ b/test/test_mount.rs
@@ -128,8 +128,6 @@ exit 23";
}
pub fn test_mount_bind() {
- use std::env;
-
let tempdir = TempDir::new("nix-test_mount")
.unwrap_or_else(|e| panic!("tempdir failed: {}", e));
let file_name = "test";
diff --git a/test/test_unistd.rs b/test/test_unistd.rs
index 856693f6..d281f9b2 100644
--- a/test/test_unistd.rs
+++ b/test/test_unistd.rs
@@ -143,19 +143,21 @@ macro_rules! execve_test_factory(
#[test]
fn test_getcwd() {
- let mut tmp_dir = TempDir::new("test_getcwd").unwrap().into_path();
- assert!(chdir(tmp_dir.as_path()).is_ok());
+ let tmp_dir = TempDir::new("test_getcwd").unwrap();
+ assert!(chdir(tmp_dir.path()).is_ok());
assert_eq!(getcwd().unwrap(), current_dir().unwrap());
// make path 500 chars longer so that buffer doubling in getcwd kicks in.
// Note: One path cannot be longer than 255 bytes (NAME_MAX)
// whole path cannot be longer than PATH_MAX (usually 4096 on linux, 1024 on macos)
+ let mut inner_tmp_dir = tmp_dir.path().to_path_buf();
for _ in 0..5 {
let newdir = iter::repeat("a").take(100).collect::<String>();
- tmp_dir.push(newdir);
- assert!(mkdir(tmp_dir.as_path(), stat::S_IRWXU).is_ok());
+ //inner_tmp_dir = inner_tmp_dir.join(newdir).path();
+ inner_tmp_dir.push(newdir);
+ assert!(mkdir(inner_tmp_dir.as_path(), stat::S_IRWXU).is_ok());
}
- assert!(chdir(tmp_dir.as_path()).is_ok());
+ assert!(chdir(inner_tmp_dir.as_path()).is_ok());
assert_eq!(getcwd().unwrap(), current_dir().unwrap());
}