Opened 7 years ago

Closed 5 years 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 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: newclosed

Merged to master rev 6a3a616

comment:2 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: closedreopened

Sorry wrong ticket :)

comment:3 by nigels.com@…, 7 years ago

Dang! :-)

comment:4 by Raffi Enficiaud, 7 years ago

Milestone: Boost 1.61.0To Be Determined

comment:5 by Raffi Enficiaud, 6 years ago

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 by Raffi Enficiaud, 6 years ago

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

Digging deeper: this is related to #5563

comment:7 by Raffi Enficiaud, 6 years ago

Status: newassigned

comment:8 by Federico Prades <federico.prades@…>, 6 years ago

Cc: federico.prades@… added

comment:9 by Raffi Enficiaud, 5 years ago

Milestone: To Be DeterminedBoost 1.65.0

comment:10 by Raffi Enficiaud, 5 years ago

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 by Raffi Enficiaud, 5 years ago

Resolution: fixed
Status: assignedclosed

In master, rev 3d13638c412ac357f178e99a99bf44dfd756c057

Note: See TracTickets for help on using tickets.