summaryrefslogtreecommitdiff
path: root/test/sys
diff options
context:
space:
mode:
authorRobert O'Callahan <robert@ocallahan.org>2017-08-21 15:07:37 +1200
committerRobert O'Callahan <robert@ocallahan.org>2017-12-05 10:14:23 +1300
commit996bc6b76a4830dfb0a1f28ee62f5d8b17febbac (patch)
tree2c758055e2b4a6aae70b5c9de9db5cc206bebeb6 /test/sys
parent3871586a9bcff84eea6dd05f229fbe6ddb3f2bdd (diff)
downloadnix-996bc6b76a4830dfb0a1f28ee62f5d8b17febbac.zip
Expose `from_raw` on `WaitStatus` and make it return a `Result`
Diffstat (limited to 'test/sys')
-rw-r--r--test/sys/test_wait.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs
index 44a111a3..02f32734 100644
--- a/test/sys/test_wait.rs
+++ b/test/sys/test_wait.rs
@@ -1,3 +1,4 @@
+use nix::Error;
use nix::unistd::*;
use nix::unistd::ForkResult::*;
use nix::sys::signal::*;
@@ -38,6 +39,14 @@ fn test_wait_exit() {
}
#[test]
+fn test_waitstatus_from_raw() {
+ let pid = Pid::from_raw(1);
+ assert_eq!(WaitStatus::from_raw(pid, 0x0002), Ok(WaitStatus::Signaled(pid, Signal::SIGINT, false)));
+ assert_eq!(WaitStatus::from_raw(pid, 0x0200), Ok(WaitStatus::Exited(pid, 2)));
+ assert_eq!(WaitStatus::from_raw(pid, 0x7f7f), Err(Error::invalid_argument()));
+}
+
+#[test]
fn test_waitstatus_pid() {
let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");