Boost logo

Boost :

From: Convector Editor (creyes123_at_[hidden])
Date: 2003-03-26 09:58:54

I took a look at the auto_unit_test.hpp source code. I believe that we are both
correct. The GCC "#pragma interface" feature lets it all work for me. I have a
pretty good idea how, but that is outside the scope of this thread. Rest
assured, I use BOOST_AUTO_UNIT_TEST across a dozen source files in a single
application, and they are all being identified and run correctly. Yes, I got
lucky and didn't even know it.

In your original e-mail, you asked for a solution to the multiple function
definition error. Wouldn't using a mechanism similar to cpp_main work? Ie, put
the init_unit_test_suite() definition in a CPP file that only gets included
once, such as:

#include <boost/test/included/auto_unit_test.hpp>

Which in turn includes

#include <libs/test/src/auto_unit_test.cpp>

I still stand by my original patch submission. Although, as you pointed out,
for the vast majority of users, it is of no value. However, it worked for me,
and it is likely to help others in the future.

> Hmmm. It works for me. I'm using BOOST_AUTO_UNIT_TEST across several of my
> source files without name collisions (after my patch). I'm also using the
> "#pragma interface" feature, which might make a difference. Pardon my
> ignorance, since I'm not very familiar with the auto unit test

I couldn't imagine how it may work. Each module will have following:

static boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE(
"Auto Unit Test" );

init_unit_test_suite( int /* argc */, char* /* argv */ [] ) {
    return test;

So. You should get symbols conflicts. Even if compiler/linker is able to
somehow choose and bind one of multiple init_unit_test_suite with library
call, it still should only run tests registered in selected module.

I would not play on such shaky grounds.


Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

Boost list run by bdawes at, gregod at, cpdaniel at, john at