Boost logo

Boost :

Subject: Re: [boost] [test] Using the Boost Unit Test Framework with shared libs
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-05-17 05:02:59


Peter wrote:
> Hi
> I am using Boost.Test from the current boost 1.38 , on cygwin ( gcc )
> and I want to use it with multiple test files and with shared libs ( in
> order to speed up the compilation time which is too long for me when
> using the header include variant ).

How much time speedup do you see?

> I did the following:

...

> *I then link to boost_unit_test_framework-gcc34-mt-1_38.so
> The link passes , but I get a warning from gcc++ 3.4.4 that auto-linking
> has been enabled ( I will provide the exact details if useful ).
> I can execute the resulting mainTest.exe without problems, but the
> compiler warnings tells that something is not quite right.
>
> Is the above example the right way to use multiple test files ?

Umm. Not really. There should be multiple translation units.
BOOST_TEST_MAIN/BOOST_TEST_MODULE should be defined in only one of them.
      This way you should be able to speedup compilation even more.

> Are the flags for shared libs correctly set ?

Compile time? Looks file. Can't tell you about link flags. What r u
using as make system?

> Thanks for your help.
>
> PS: I think that Boost.Test is not easy to grasp ( at least for me ). I
> think this is partially due to a lack of complete examples ( involving
> for examples a test suite with more than one test file ).

There is one - example #10

> Also the static/shared library topic and the related macros (
> BOOST_TEST_DYN_LINK etc ) could do with a concrete example. Maybe the

I believe there are couple in docs.

Gennadiy


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