Opened 3 years ago

Closed 15 months ago

#11962 closed Bugs (fixed)

BOOST_TEST_MESSAGE in fixture constructor - invalid XML

Reported by: nigels.com@… Owned by: Raffi Enficiaud
Milestone: Boost 1.65.0 Component: test
Version: Boost 1.61.0 Severity: Problem
Keywords: BOOST_TEST_MESSAGE XML Cc: federico.prades@…

Description

I came across an issue with our global fixture using BOOST_TEST_MESSAGE. The resulting XML file in --output_format=XML --log_level=all mode has the message, but not wrapped in the

<TestLog> ... </TestLog>

scope. In turn xsltproc would break on this, trying to convert to JUnit. I think it would be better for the BOOST_TEST_MESSAGE to either be silently dropped, or perhaps buffered, or TestLog? XML tag should be forced.

Using boost 1.59.0 here.

Change History (11)

comment:1 Changed 3 years ago by Raffi Enficiaud

Resolution: fixed
Status: newclosed

Merged to master rev 6a3a616

comment:2 Changed 3 years ago by Raffi Enficiaud

Resolution: fixed
Status: closedreopened

Sorry wrong ticket :)

comment:3 Changed 3 years ago by nigels.com@…

Dang! :-)

comment:4 Changed 2 years ago by Raffi Enficiaud

Milestone: Boost 1.61.0To Be Determined

comment:5 Changed 2 years ago by Raffi Enficiaud

The problem here is that global fixture are convenient for changing the logger at runtime, so they must be executed before the logger starts.

I am thinking of a fix. Do you have a snippet?

comment:6 Changed 22 months ago by Raffi Enficiaud

Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: reopenednew

Digging deeper: this is related to #5563

comment:7 Changed 22 months ago by Raffi Enficiaud

Status: newassigned

comment:8 Changed 21 months ago by Federico Prades <federico.prades@…>

Cc: federico.prades@… added

comment:9 Changed 15 months ago by Raffi Enficiaud

Milestone: To Be DeterminedBoost 1.65.0

comment:10 Changed 15 months ago by Raffi Enficiaud

Hi,

I just pushed a fix on the develop branch (rev ea9d9b9a8ea3f9aceb71cce41d48c820f05b2fdc) that addresses the issue by adding a dedicated macro for global fixtures BOOST_TEST_GLOBAL_FIXTURE and decouples it from the global initialization (that now goes to BOOST_TEST_GLOBAL_INITIALIZATION).

The global init cannot receive any logs, while the global fixture can. It should solve your issue, and it would be nice if you give a try.

comment:11 Changed 15 months ago by Raffi Enficiaud

Resolution: fixed
Status: assignedclosed

In master, rev 3d13638c412ac357f178e99a99bf44dfd756c057

Note: See TracTickets for help on using tickets.