41TEST_CASE(
"Test signal handler forwarding",
"[signal_handler_forward]") {
44 std::signal(SIGSEGV, SIG_DFL);
45 std::signal(SIGBUS, SIG_DFL);
46 std::signal(SIGFPE, SIG_DFL);
50 std::signal(SIGSEGV, &handle_signal);
51 std::signal(SIGBUS, &handle_signal);
52 std::signal(SIGFPE, &handle_signal);
56 CHECK(sig_handled == 42 + SIGSEGV);
59 CHECK(sig_handled == 42 + SIGBUS);
62 CHECK(sig_handled == 42 + SIGFPE);
66 sa.sa_sigaction = &handle_signal_sigaction;
67 sigemptyset(&sa.sa_mask);
68 sa.sa_flags = SA_NODEFER | SA_SIGINFO;
69 sigaction(SIGSEGV, &sa,
nullptr);
70 sigaction(SIGBUS, &sa,
nullptr);
71 sigaction(SIGFPE, &sa,
nullptr);
75 CHECK(sig_handled == 142 + SIGSEGV);
78 CHECK(sig_handled == 142 + SIGBUS);
81 CHECK(sig_handled == 142 + SIGFPE);