diff options
Diffstat (limited to 'tests/Framework_Component_Test.cpp')
-rw-r--r-- | tests/Framework_Component_Test.cpp | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/tests/Framework_Component_Test.cpp b/tests/Framework_Component_Test.cpp index 7215edeb14d..f92935d8e18 100644 --- a/tests/Framework_Component_Test.cpp +++ b/tests/Framework_Component_Test.cpp @@ -18,17 +18,23 @@ // // ============================================================================ -//#include "Framework_Component_DLL.h" #include "ace/Service_Config.h" #include "ace/ARGV.h" #include "tests/test_config.h" +#include "ace/DLL_Manager.h" ACE_RCSID(tests, Framework_Component_Test, "$Id$") int -ACE_TMAIN (int, ACE_TCHAR *[]) +run_test (u_long unload_mask = 0) { - ACE_START_TEST (ACE_TEXT("Framework_Component_Test")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Running test with mask = %s|%s\n"), + ACE_BIT_ENABLED(unload_mask, ACE_DLL_Manager_Ex::PER_DLL) == 0 + ? ACE_TEXT ("PER_PROCESS") : ACE_TEXT ("PER_DLL"), + ACE_BIT_ENABLED(unload_mask, ACE_DLL_Manager_Ex::LAZY) == 0 + ? ACE_TEXT ("EAGER") : ACE_TEXT ("LAZY"))); + + ACE_DLL_Manager::instance ()->unload_strategy (unload_mask); // Now, let the ACE Service Configurator framework load our service from a // dll, which contains a singleton. @@ -43,13 +49,16 @@ ACE_TMAIN (int, ACE_TCHAR *[]) // Load it, should load a dll. ACE_Service_Config::open (args.argc (), args.argv ()); + // And unload the first one, should *not* unload the dll. + ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_1")); + // Now load another service from the same library. ACE_Service_Config::process_directive (ACE_TEXT ("dynamic Server_2 Service_Object * " "Framework_Component_DLL:_make_Server_2() 'xxx' ")); // And unload the first one, should *not* unload the dll. - ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_1")); + //ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_1")); // And unload the second service. Since the ACE_DLL_Handle will no longer // have any references, the ACE_DLL_Manager will apply it's current unloading @@ -58,6 +67,31 @@ ACE_TMAIN (int, ACE_TCHAR *[]) // dll loaded until program termination. ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_2")); - ACE_END_TEST; + // Force unloading so we'll be ready for the next test. + ACE_DLL_Manager::instance ()->unload_strategy (ACE_DLL_Manager_Ex::DEFAULT); + return 0; } + +int +ACE_TMAIN (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT("Framework_Component_Test")); + + int retval = 0; + + // Use defaults, i.e., per process, eager unloading. + retval += run_test (); + + // Per process, lazy unloading + retval += run_test (ACE_DLL_Manager_Ex::LAZY); + + // Per dll, eager unloading + retval += run_test (ACE_DLL_Manager_Ex::PER_DLL); + + // Per dll, lazy unloading. + retval += run_test (ACE_DLL_Manager_Ex::PER_DLL | ACE_DLL_Manager_Ex::LAZY); + + ACE_END_TEST; + return retval == 0 ? 0 : -1; +} |