diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 13:56:48 +0000 |
commit | c4078c377d74290ebe4e66da0b4975da91732376 (patch) | |
tree | 1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/tests/Object_Manager_Test.cpp | |
parent | 700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff) | |
download | ATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz |
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/tests/Object_Manager_Test.cpp')
-rw-r--r-- | ACE/tests/Object_Manager_Test.cpp | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/ACE/tests/Object_Manager_Test.cpp b/ACE/tests/Object_Manager_Test.cpp deleted file mode 100644 index 79cd94c8ccd..00000000000 --- a/ACE/tests/Object_Manager_Test.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// Object_Manager_Test.cpp -// -// = DESCRIPTION -// Tests the basic functions of the ACE_Object_Manager. -// -// = AUTHOR -// David L. Levine <levine@cs.wustl.edu> -// -// ============================================================================ - -#include "test_config.h" -#include "ace/Object_Manager.h" -#include "ace/OS_Memory.h" -#include "ace/ACE.h" - -ACE_RCSID(tests, Object_Manager_Test, "$Id$") - -static u_int *ip; - -extern "C" -void -hook1 (void) -{ - delete ip; - ip = 0; -} - -extern "C" -void -hook2 (void * /* object */, void *param) -{ - u_int *paramp = reinterpret_cast<u_int *> (param); - - // We can use ACE_Log_Msg in an ACE_Object_Manager cleanup hook. - // But NOT in an ACE_OS::atexit () hook! However, the ACE_END_TEST - // invocation in main () will prevent this from being output to the - // log stream. - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("hook2: %d\n"), - *paramp)); - delete paramp; -} - -int -run_main (int, ACE_TCHAR *[]) -{ - ACE::init (); - - ACE_START_TEST (ACE_TEXT ("Object_Manager_Test")); - - u_int errors = 0; - - // If hook1 never gets called, this will show up as a memory leak. - ACE_NEW_RETURN (ip, - u_int, - -1); - - const int starting_up = - ACE_Object_Manager::instance ()->starting_up (); - const int shutting_down = - ACE_Object_Manager::instance ()->shutting_down (); - - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("starting_up: %d, shutting_down: %d\n"), - starting_up, - shutting_down)); - - if (starting_up || shutting_down) - { - ++errors; - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("starting_up and shutting_down are supposed to ") - ACE_TEXT (" be 0!!!!"))); - } - - if (ACE_OS::atexit (hook1) != 0) - { - ++errors; - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_OS::atexit () returned non-zero!!!!"))); - } - - for (u_int i = 0; i < 10; ++i) - { - u_int *paramp; - ACE_NEW_RETURN (paramp, - u_int, - -1); - *paramp = i; - - // The first paramp argument is only used to distinguish the - // at_exit entries. The ACE_Object_Manager only allows one - // at_exit per object. It's not used in the hook. - if (ACE_Object_Manager::instance ()->at_exit (paramp, - hook2, - paramp)) - { - ++errors; - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Object_Manager::at_exit () ") - ACE_TEXT ("returned non-zero!!!!"))); - } - } - - ACE_END_TEST; - ACE::fini (); - return errors == 0 ? 0 : 1; -} |