Skip to content

Commit 198ae14

Browse files
committed
tests: add test for kill with real-time signal offsets
1 parent 878514c commit 198ae14

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

tests/by-util/test_kill.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use regex::Regex;
77
use std::os::unix::process::ExitStatusExt;
88
use std::process::{Child, Command};
9+
#[cfg(any(target_os = "linux", target_os = "android"))]
10+
use uucore::signals::realtime_signal_bounds;
911
use uutests::new_ucmd;
1012

1113
// A child process the tests will try to kill.
@@ -539,3 +541,33 @@ fn test_kill_realtime_signal() {
539541
.succeeds();
540542
assert_eq!(target.wait_for_signal(), Some(libc::SIGRTMIN()));
541543
}
544+
545+
#[cfg(any(target_os = "linux", target_os = "android"))]
546+
#[test]
547+
fn test_kill_with_rtmax_offset() {
548+
let (_, rtmax) = realtime_signal_bounds().unwrap();
549+
let sig: i32 = (rtmax as i32) - 7;
550+
551+
let mut target = Target::new();
552+
new_ucmd!()
553+
.arg("-s")
554+
.arg("SIGRTMAX-7")
555+
.arg(format!("{}", target.pid()))
556+
.succeeds();
557+
assert_eq!(target.wait_for_signal(), Some(sig));
558+
}
559+
560+
#[cfg(any(target_os = "linux", target_os = "android"))]
561+
#[test]
562+
fn test_kill_with_rtmin_offset() {
563+
let (rtmin, _) = realtime_signal_bounds().unwrap();
564+
let sig: i32 = (rtmin as i32) + 7;
565+
566+
let mut target = Target::new();
567+
new_ucmd!()
568+
.arg("-s")
569+
.arg("SIGRTMIN+7")
570+
.arg(format!("{}", target.pid()))
571+
.succeeds();
572+
assert_eq!(target.wait_for_signal(), Some(sig));
573+
}

0 commit comments

Comments
 (0)