Subject: [Boost-bugs] [Boost C++ Libraries] #5563: using a test macro in a global fixture crashes Boost.Test
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-24 10:09:55
#5563: using a test macro in a global fixture crashes Boost.Test
--------------------------------+-------------------------------------------
Reporter: m.champlon@⦠| Owner: rogeeff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
Version: Boost 1.42.0 | Severity: Problem
Keywords: |
--------------------------------+-------------------------------------------
Using a failing macro (such as BOOST_FAIL) from the constructor (or
destructor) of a global fixture crashes the test application, for instance
(using vc80 and boost 1.42) :
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#define BOOST_LIB_NAME boost_unit_test_framework
#include <boost/config/auto_link.hpp>
struct fixture
{
fixture()
{
BOOST_FAIL( "oups" );
}
~fixture()
{
BOOST_FAIL( "oups" );
}
};
BOOST_GLOBAL_FIXTURE( fixture );
BOOST_AUTO_TEST_CASE( some_test )
{
}
The problem lies in compiler_log_formatter.ipp around line 40 :
const_string
test_phase_identifier()
{
return framework::is_initialized()
? const_string( framework::current_test_case().p_name.get() )
: BOOST_TEST_L( "Test setup" );
}
because calling framework::current_test_case() is wrong in this case.
Maybe the solution would be to add another state in framework along
m_is_initialized and m_test_in_progress ?
I would love to provide a patch but I wasn't able to make bjam build and
run the tests...
Thanks,
MAT.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5563> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC