Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-06-04 12:35:16


Florian Winter <fw <at> motama.com> writes:

>
> We are trying to write units tests using the Boost.test framework which
> involve dynamic loading of libraries (i.e. lt_dlopen on Linux or
> LoadLibrary on Windows) and doing tests using the Boost test tools in
> code inside the dynamically loaded library.
>
> Does Boost.Test support this?

Yes. You can do this. you can also use console_test_runner and execute test
modules built as dlls.
 
> We have run into problems when trying to use the quick-and-dirty
> "include" option for defining the Boost.Test symbols. Dynamically loaded
> libraries may not contain undefined symbols, and including the
> implementation headers such as <boost/test/included/unit_test.hpp> in
> both the dynamically loaded library and the main application seems to
> lead to duplicate symbols. In particular, if we use BOOST_CHECK macros

Yes. you can't do this.

> We would like to know what is the "best" practice to use Boost.Test in
> unit tests that require dynamic loading of libraries and tests being
> made in both application code and dynamic library code.

Use dynamic library version of Unit test Framework. It will work perfectly fine
in this scenario.

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