Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-11-08 14:34:29


"Michael van der Westhuizen" <r1mikey_at_[hidden]> wrote in message
news:d21d65950610270423n5bf2f72ak9cfdacd30408f13b_at_mail.gmail.com...
> Hi All,
>
> I've recently found a reproducible regression in Boost.Test while
> moving from 1.32.0 to 1.33.1. This regression is apparently present in
> the HEAD and 1.34 candidate as well.
>
> I can confirm this problem (and the fix) on HP aC++ 06.12 (ia64), HP
> aCC 03.67 (PA-RISC) and Sun Studio 11 (SPARC, with and without
> -library=stlport4). According to one of our compiler vendors this is
> reproducible on Tru64/Alpha cxx as well.

I do see a crash. The error is caused by obvios misuse of Boost::Test
facilties. I plead guilty to lack of proper check though.

> The fix is to change the test_unit::m_dependencies member (in
> boost/test/unit_test_suite.hpp, unit_test_suite_impl.hpp in trunk)
> from std::list<test_unit_id> to std::vector<test_unit_id> (yes, I know
> that doesn't make a whole lot of sense).

This fix only hides actual issue.

> The test case is:
>
> ---
> #include <boost/test/included/unit_test_framework.hpp>
> #include <boost/shared_ptr.hpp>
>
>
> class DummyTest
> : public boost::unit_test_framework::test_suite

You are *NOT* supposed to be doing this.

> {
> public:
> DummyTest() :
> boost::unit_test_framework::test_suite( "DummyTest" ) {}
> void testDummy() { BOOST_CHECK( true ); }
> };

Correct definition would look like:

class DummyTest {
public:
   void testDummy() { BOOST_CHECK( true ); }
};

>
> boost::unit_test_framework::test_suite *
> init_unit_test_suite( int argc, char * argv[] )
> {
> boost::unit_test_framework::test_suite * test =
> BOOST_TEST_SUITE( "Test Test Suite" );
> boost::shared_ptr<DummyTest> suite_a( new DummyTest() );
> test->add(
> BOOST_CLASS_TEST_CASE( &DummyTest::testDummy, suite_a ) );
> return test;
> }

I will make sure this code wont compile.

Gennadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk