File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -493,3 +493,49 @@ fn test_kill_signal_only_no_pid() {
493493 . fails ( )
494494 . stderr_contains ( "no process ID specified" ) ;
495495}
496+
497+ #[ test]
498+ fn test_kill_signal_zero_process ( ) {
499+ let target = Target :: new ( ) ;
500+ // kill -0 should succeed for a running process (signal 0 = existence check)
501+ new_ucmd ! ( )
502+ . arg ( "-0" )
503+ . arg ( format ! ( "{}" , target. pid( ) ) )
504+ . succeeds ( ) ;
505+ }
506+
507+ #[ test]
508+ fn test_kill_signal_zero_new_form ( ) {
509+ let target = Target :: new ( ) ;
510+ // kill -s 0 should also work
511+ new_ucmd ! ( )
512+ . arg ( "-s" )
513+ . arg ( "0" )
514+ . arg ( format ! ( "{}" , target. pid( ) ) )
515+ . succeeds ( ) ;
516+ }
517+
518+ #[ test]
519+ fn test_kill_signal_zero_nonexistent ( ) {
520+ // kill -0 with a nonexistent PID should fail
521+ new_ucmd ! ( ) . arg ( "-0" ) . arg ( "999999999" ) . fails ( ) ;
522+ }
523+
524+ #[ test]
525+ fn test_kill_signal_zero_current_process_group ( ) {
526+ // kill -0 0 should succeed (checks current process group)
527+ new_ucmd ! ( ) . arg ( "-0" ) . arg ( "0" ) . succeeds ( ) ;
528+ }
529+
530+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
531+ #[ test]
532+ fn test_kill_realtime_signal ( ) {
533+ let mut target = Target :: new ( ) ;
534+ // kill -s RTMIN should send SIGRTMIN and terminate the process
535+ new_ucmd ! ( )
536+ . arg ( "-s" )
537+ . arg ( "RTMIN" )
538+ . arg ( format ! ( "{}" , target. pid( ) ) )
539+ . succeeds ( ) ;
540+ assert_eq ! ( target. wait_for_signal( ) , Some ( libc:: SIGRTMIN ( ) ) ) ;
541+ }
You can’t perform that action at this time.
0 commit comments