[test] How to ignore a signal?
I've a test case which receives the SIGCHLD signal on Solaris. Boost.Test catches it and prints an error message although in that test case SIGCHLD s perfectly fine. How do I make Boost.Test ignore this signal? I found BOOST_NO_SIGNAL_HANDLING back in Boost.Test 1.33.1 but it doesn't seem to exist anymore in 1.36.0? Boris
Boris
I've a test case which receives the SIGCHLD signal on Solaris. Boost.Test catches it and prints an error message although in that test case SIGCHLD s perfectly fine. How do I make Boost.Test ignore this signal? I found
What error code does it produce? You can always use --catch_system_errors=no In trunk I checked in compile time switch that affects handling child processes with non-zero return codes Gennadiy
On Thu, 18 Sep 2008 22:47:22 +0200, Gennaidy Rozental
Boris
writes: I've a test case which receives the SIGCHLD signal on Solaris. Boost.Test catches it and prints an error message although in that test case SIGCHLD s perfectly fine. How do I make Boost.Test ignore this signal? I found
What error code does it produce?
child has exited; pid: 0; uid: 28570; exit value: 0
You can always use --catch_system_errors=no
I assume all signals are then ignored? As I'm also afraid of telling other developers again and again to use certain command line options I'd prefer to use a preprocessor directive.
In trunk I checked in compile time switch that affects handling child processes with non-zero return codes
I temporarily hardcoded in boost/test/impl/execution_monitor.ipp: m_CHLD_action( SIGCHLD, false, attach_dbg, alt_stack ) That works. If the macro BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE does the same it should be all right. :) Boris
Boris
I temporarily hardcoded in boost/test/impl/execution_monitor.ipp:
m_CHLD_action( SIGCHLD, false, attach_dbg, alt_stack )
That works. If the macro BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE does the same it should be all right. :)
No. We still want to detect if child is crashed, for example. Gennadiy
On Fri, 19 Sep 2008 01:00:09 +0200, Gennadiy Rozental
Boris
writes: I temporarily hardcoded in boost/test/impl/execution_monitor.ipp:
m_CHLD_action( SIGCHLD, false, attach_dbg, alt_stack )
That works. If the macro BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE does the same it should be all right. :)
No. We still want to detect if child is crashed, for example.
I see. Can you change the code then to something like this: static bool ignore_sigchild( siginfo_t* info ) { return info->si_signo == SIGCHLD #ifdef BOOST_TEST_IGNORE_SIGCHLD ; #else && info->si_code == CLD_EXITED # ifdef BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE ; # else && (int)info->si_status == 0; # endif #endif } I have another test case where the parent kills the child. Simply ignoring SIGCHLD is probably the best (as otherwise there have to be too many preprocessor directives added)? Boris
participants (3)
-
Boris
-
Gennadiy Rozental
-
Gennaidy Rozental