Search code examples
c++boost-test

How to cancel "fatal error" detection in BOOST TEST


I get an error: unknown location(0): fatal error in "suite_1_test_1": child has exited; pid: 5817; uid: 0; exit value: 255

Inside suite_1_test_1 I run a program A with execvp() (after fork()), which may be exit with an error code that is not 0. this error code indicates what happened to program A.

The problem is that, if I get this fatal error, I can't handle the exit() value, and the BOOST TEST gets out immediately.

Can I somehow turn it off for a moment?

Thanks


Solution

  • Well, it is possible to do so:

    boost::unit_test case fails because a child process exits with nonzero

    just do #define BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE before the #define BOOST_TEST_MODULE aot_test_module in the main()

    When using shared libraries, run with command line option --catch_system_errors=no or export BOOST_TEST_CATCH_SYSTEM_ERRORS=“no”.