Opened 8 years ago

Closed 8 years ago

Last modified 3 years ago

#3978 closed Bugs (fixed)

Failed to completely redirect TestLog to file, bugfix appended

Reported by: phu@… Owned by: Gennadiy Rozental
Milestone: Boost 1.59.0 Component: test
Version: Boost 1.42.0 Severity: Problem
Keywords: Cc:



when using the following suggested global fixture with XML format, the final tag </TestLog?> gets lost and ends up in cout instead of the file.

I tracked the bug and suggest the following patch, which fixed the problem. (The problem is, that the global fixture is applied before the logger but is removed before the logger is finished.)

used fixture:

struct TestSuiteConfig {
    : test_log( "testresults.log" )
    	boost::unit_test::unit_test_log.set_format( boost::unit_test::XML );
    	boost::unit_test::unit_test_log.set_stream( test_log );

    	boost::unit_test::unit_test_log.set_stream( std::cout );

    std::ofstream test_log;


applied changes (on version 1.40, but 1.42 is still the same):

Index: boost/test/impl/framework.ipp
--- framework.ipp	(revision 801)
+++ framework.ipp	(revision 802)
@@ -445,8 +445,9 @@
     if( call_start_finish ) {
-        BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers )
-            to->test_finish();
+    	for( framework_impl::observer_store::reverse_iterator to = s_frk_impl().m_observers.rbegin(); to != s_frk_impl().m_observers.rend(); ++to)
+            (*to)->test_finish();
     s_frk_impl().m_test_in_progress = was_in_progress;

Change History (3)

comment:1 Changed 8 years ago by Steven Watanabe

Resolution: fixed
Status: newclosed

(In [62805]) Call test_finish/test_unit_finish in the reverse order from test_start/test_unit_start. Fixes #3978

comment:2 Changed 8 years ago by Philipp Huber <phu@…>

somehow, that fix has not made it into boost 1.43, hope it will be in in 1.44.

comment:3 Changed 3 years ago by Raffi Enficiaud

Milestone: Boost 1.43.0Boost 1.59.0
Note: See TracTickets for help on using tickets.