Boost logo

Boost Users :

Subject: Re: [Boost-users] Aborting on Boost.Test check failure
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-03-05 18:15:05


On Mon, 5 Mar 2012, Gennadiy Rozental wrote:

> Jeremiah Willcock <jewillco <at> osl.iu.edu> writes:
>
>>
>> On Mon, 5 Mar 2012, Gennadiy Rozental wrote:
>>
>>> Jeremiah Willcock <jewillco <at> osl.iu.edu> writes:
>>>
>>>>
>>>> Is there a way to force an abort() or some other kind of
>>>> debugger-catchable event when a Boost.Test test case (such as a
>>>> BOOST_CHECK) fails? Is there a function I can set a breakpoint on? I do
>>>> not see anything like that in the documentation. I am running on Linux
>>>> with gdb.
>>>>
>>>
>>>
>>> You can switch to BOOST_REQUIRE and catch throw.
>>
>> Does that mean needing to change all of the tests to use that?
>
> Yes.

That seems to be difficult to add to an existing test suite.

>> Also, what
>> about doing that in a program that throws (and catches) other
>> exceptions not related to test failures?
>
> They will interfere ;)
>
> Frankly i am not sure I understand the original incentive. Run the test without
> the debugger. It'll report the line number for the failure. Then just set a
> breakpoint at this line. This way you can actually debug into a failing call
> instead of looking at post-effect of failed validation inside the Boost.Test.

The code that I was working with uses a common test function that is
called multiple times with different inputs, making it more difficult to
breakpoint that single line. Is there a reason not to provide abort() or
similar functionality?

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net