change the signal used to test signal_reported_right
The test "signal_reported_right" send a signal `1` to `/bin/sh`, and check the status code to check if the signal is reported right. Under OpenBSD, the signal `1` (`SIGHUP`) is catched by `/bin/sh`, resulting the test failed. Use the uncatchable signal `9` (`SIGKILL`) for test.
This commit is contained in:
@@ -800,12 +800,12 @@ mod tests {
|
|||||||
#[cfg(all(unix, not(target_os="android")))]
|
#[cfg(all(unix, not(target_os="android")))]
|
||||||
#[test]
|
#[test]
|
||||||
fn signal_reported_right() {
|
fn signal_reported_right() {
|
||||||
let p = Command::new("/bin/sh").arg("-c").arg("kill -1 $$").spawn();
|
let p = Command::new("/bin/sh").arg("-c").arg("kill -9 $$").spawn();
|
||||||
assert!(p.is_ok());
|
assert!(p.is_ok());
|
||||||
let mut p = p.unwrap();
|
let mut p = p.unwrap();
|
||||||
match p.wait().unwrap() {
|
match p.wait().unwrap() {
|
||||||
process::ExitSignal(1) => {},
|
process::ExitSignal(9) => {},
|
||||||
result => panic!("not terminated by signal 1 (instead, {})", result),
|
result => panic!("not terminated by signal 9 (instead, {})", result),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -537,12 +537,12 @@ mod tests {
|
|||||||
fn signal_reported_right() {
|
fn signal_reported_right() {
|
||||||
use os::unix::ExitStatusExt;
|
use os::unix::ExitStatusExt;
|
||||||
|
|
||||||
let p = Command::new("/bin/sh").arg("-c").arg("kill -1 $$").spawn();
|
let p = Command::new("/bin/sh").arg("-c").arg("kill -9 $$").spawn();
|
||||||
assert!(p.is_ok());
|
assert!(p.is_ok());
|
||||||
let mut p = p.unwrap();
|
let mut p = p.unwrap();
|
||||||
match p.wait().unwrap().signal() {
|
match p.wait().unwrap().signal() {
|
||||||
Some(1) => {},
|
Some(9) => {},
|
||||||
result => panic!("not terminated by signal 1 (instead, {:?})", result),
|
result => panic!("not terminated by signal 9 (instead, {:?})", result),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user