I have a test case that (due to an error of course) tries to run code like this:
[snip]
void MyFailingTestCase() { MyObject * a = NULL;
a->f(); }
When running these tests in release mode - the whole process is stopped by a windows dialog letting be know that there was a system error (Access Violation) and asks the user to click OK/Debug.
I have also tried to pass the --catch_system_errors=yes, but that
did
not help
I am running 1_33_1 version of the library. (libboost_unit_test_framework-vc80-mt-1_33_1.lib)
Does anybody know a way around this problem?
The only reasonable solution is to fix the test. According to standard C++ the expression "a->f()" using an a with a null pointer value causes undefined behaviour. Why don't you use a valid argument? Possible examples are:
I believe the above is just an example. Under Windows, the dereferencing of the null pointer leads to an access violation which can be handled via SEH (Structured Exception Handling). MSVC provides a way to translate strutured exceptions to C++ exceptions, which Boost.Test is supposed to use.
Regards, Johan
If I understand you (and the documentation) correctly - then the Boost.Test framework should have caught this (Structured Exception), and just reported the test as failed. Does this mean that the framework is broken (I'm using 1.33) Does anyone else have any experience with this - will an upgrade to 1.35 help? Olav