diff options
author | Philipp Matthias Schaefer <philipp.matthias.schaefer@posteo.de> | 2016-10-24 21:03:30 +0200 |
---|---|---|
committer | Philipp Matthias Schaefer <philipp.matthias.schaefer@posteo.de> | 2016-11-14 21:22:05 +0100 |
commit | 45d8beea46ec06ce52c512c8de5976cff85b67a2 (patch) | |
tree | 697c567d2b1ba5ea2aedf471040adc09f93889ad /test/sys | |
parent | a9f630ed00ec9d98dfdd0d84127c8f44ca92bcb9 (diff) | |
download | nix-45d8beea46ec06ce52c512c8de5976cff85b67a2.zip |
Make signal argument to kill optional
Diffstat (limited to 'test/sys')
-rw-r--r-- | test/sys/mod.rs | 1 | ||||
-rw-r--r-- | test/sys/test_signal.rs | 7 | ||||
-rw-r--r-- | test/sys/test_wait.rs | 2 |
3 files changed, 9 insertions, 1 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_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 |