Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-04-12 13:37:31


>I would like to use the BOOST_AUTO_TEST_CASE() facility in a static
> library. Obviously this library does not have a main() so it needs to
> be linked with a test executable which may run test cases found in one
> or more of those static libraries.
>
> Unfortunately, the tests do not make it past the linker. The
> executable links fine but runs none of the tests defined in the
> libraries. Could it be that BOOST_AUTO_TEST_CASE() works via some
> global which gets stripped when the static lib is created?
>
> Do you have a suggestion for a workaround? The idea is to keep some
> of the lowest-level unit test code in the same translation unit as the
> class implementation.

Unfortunately I don't think it could work this way. Both your library and
final executable link with Boost.Test statically. You end up with 2 version
of Boost.Test runtime and which one is in use is the matter of linker
implementation. What you could do though is build dynamic library and link
with dynamic version of Boost.Test (cvs already support that). This
configuration is tested and work as expected.

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net