[boost.test] Provoking a core-dump
I'm using the boost minimal testing facility - mostly because I do not want to build full boost. [I spent one day about an hour trying to figure out how to build a 64-bit version on Solaris with SunCC and failed. So I gave up. Besides, minimal testing facility is enough for me.] Is it possible to configure BOOST_CHECK or BOOST_REQUIRE to behave as assert? BOOST_REQUIRE throws an exception which eventually gets caught and the test just prints "failed". That's not what I want. I want that the message is printed and abort() immediately called so that I can inspect the core-dump and debug the problem. A quick&dirty fix is to add something like the following on top of each test: #ifdef BTEST_OVERRIDE #define BOOST_REQUIRE assert #define BOOST_CHECK assert #endif Is there another possibility? Ideally, there would be a command-line switch to toggle this behaviour at runtime. So the first run of tests in "normal" mode just gives a quick overview of everything, and another "diagnostic" mode (running with a hypothetical "-abort" switch) calls abort() as soon as any CHECK or REQUIRE fails.
"Zeljko Vrba"
I'm using the boost minimal testing facility - mostly because I do not want to build full boost. [I spent one day about an hour trying to figure out how to build a 64-bit version on Solaris with SunCC and failed. So I gave up. Besides, minimal testing facility is enough for me.]
Don't do this. Use included variant of UTF instead boost/test/included/unit_test.hpp
Is it possible to configure BOOST_CHECK or BOOST_REQUIRE to behave as assert? BOOST_REQUIRE throws an exception which eventually gets caught and the test just prints "failed". That's not what I want. I want that the message is printed and abort() immediately called so that I can inspect the core-dump and debug the problem.
A quick&dirty fix is to add something like the following on top of each test:
#ifdef BTEST_OVERRIDE #define BOOST_REQUIRE assert #define BOOST_CHECK assert #endif
Is there another possibility? Ideally, there would be a command-line switch to toggle this behaviour at runtime. So the first run of tests in "normal" mode just gives a quick overview of everything, and another "diagnostic" mode (running with a hypothetical "-abort" switch) calls abort() as soon as any CHECK or REQUIRE fails.
Once you switched to UTF you can say --catch_system_errors=no and get what you want. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Zeljko Vrba