Boost logo

Boost Users :

Subject: Re: [Boost-users] [Test] Calling BOOST_MESSAGE too early results in malformed xml output from Boost.Test
From: Martin Ba (0xcdcdcdcd_at_[hidden])
Date: 2014-12-19 07:29:38


Gennadiy Rozental <rogeeff <at> gmail.com> writes:
>
> Martin Ba <0xcdcdcdcd <at> gmx.at> writes:
>
>>
>> Hi!
>>
>> First, I'm on 1.44 and won't get around to test it on a newer
>> version any time soon, so I'll just throw it in anyway:
>>
>> I've hit the case that when the executable running boost.test is
>> calling BOOST_MESSAGE from a BOOST_GLOBAL_FIXTURE, the message is
>> generated
>
> As a general rule you are not expected to use testing tools from
> global fixtures. There used to be issues with test module crashing in
> this case. I do not believe this is the case in later versions, but I
> am not quitesure what you want the framework to do for you here.
>
> Gennadiy
>

Well, "of course" what I want the framework to do is to make sure it
only writes well-formed XML by making sure in the formatter class that
the root tag of the XML is always written first. (That was my fix.)

Aside:

Incidentally, with my 1.44 I today discovered that you cannot even
invoke `BOOST_CHECK(true)` because that will crash the framework.
(That's right, the check passes, but when looking up the current test
case in the tool code it will access some uninitialized stuff.)

Invoking BOOST_REQUIRE (*_CHECK not so much) from a gobal fixture seems
quite reasonable to me.

And "of course" what I want the framework to do is to abort the test run
if any fixture -- global or not -- fails.

As said in the OP, this may work (or not) in the recent version but I
sincerely hope that it is not considered "by design" that you cannot
invoke test tools from a global fixture (when you *can*, AFAIK, from
"normal" fixtures.)

cheers,
Martin


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