Skip to content

Commit

Permalink
Haiku
Browse files Browse the repository at this point in the history
Rationale :
POSIX is clear that signal ordering is not guaranteed.
On Haiku, SIGKILL is sent at higher priority than SIGUSR1 so it is signaled before.
Here the goal is just to test the masking, so i change for SIGUSR2 at same level.
Though i am aware there should be a cleaner way to test signal masking, this change gets the signals to be delivered in same order.
This solved the FAILED test on Haiku.

Signed-off-by: Sylvain78 <[email protected]>
  • Loading branch information
Sylvain78 committed Apr 5, 2024
1 parent 784f53c commit 40a1fb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ let%test_unit "sigprocmask" =
let prog = Program_lookup.find_prog "sleep" in
let pid = Spawn.spawn ?sigprocmask ~prog ~argv:[ "sleep"; "60" ] () in
Unix.kill pid Sys.sigusr1;
Unix.kill pid Sys.sigkill;
Unix.kill pid Sys.sigusr2;
match Unix.waitpid [] pid with
| _, WSIGNALED signal -> assert (signal = expected_signal)
| _ -> failwith "unexpected"
in
run Sys.sigusr1;
run ~sigprocmask:(SIG_BLOCK, [ Sys.sigusr1 ]) Sys.sigkill)
run ~sigprocmask:(SIG_BLOCK, [ Sys.sigusr1 ]) Sys.sigusr2)
;;

(* This should be at the end to clean up the test environment *)
Expand Down

0 comments on commit 40a1fb2

Please sign in to comment.