Opened 13 years ago

Closed 10 years ago

#3527 closed Feature Requests (fixed)

Make Boost.Test more dll/so-friendly

Reported by: Andrey Semashev Owned by: Gennadiy Rozental
Milestone: Boost 1.41.0 Component: test
Version: Boost 1.40.0 Severity: Problem
Keywords: test dll so Cc:

Description

We've been using Boost.Test 1.40 to run unit tests for our project. The project is quite scaled and it consists from a number of shared objects (dll on Windows, so on Linux) that have to be dynamically loadable/unloadable. Some shared objects also contain self-testing code based on Boost.Test (with auto-test cases, exception translators, fixtures, checking macros, etc.) that is run by our own means (eventually, it comes down to call to boost::unit_test::unit_test_main). All such dlls are linked to Boost.Test dynamically.

The problem is that after the tests are run and our dlls are unloaded Boost.Test fails to deinitialize as it still refers to resources in the unloaded modules. For example, it doesn't automatically unregister test cases and exception translators which refer to code in the unloaded modules. The problem with test cases and suites can be solved on our side by manually calling framework::clear before unloading any modules, but I see no such workaround for exception translators as they are registered in the unit_test_monitor_t singleton which doesn't allow to release the pointer to the translators.

Automatic resource releasing on module unloading would be most useful in my case. Test cases and suites can be automatically unregistered by auto_test_unit_registrar destructor. Exception translators may require a bit more efforts but this is doable, too.

Change History (1)

comment:1 by Gennadiy Rozental, 10 years ago

Resolution: fixed
Status: newclosed

Since 62016 Execution_monitor has an ability to erase registered translators. This should be enough for you to get want you want.

Note: See TracTickets for help on using tickets.