diff options
author | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-05-05 18:12:09 +0000 |
---|---|---|
committer | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-05-05 18:12:09 +0000 |
commit | 843d611ad286c5dfb94540d1d2a4e2e7301ca266 (patch) | |
tree | e30d0a21cd99e35b7f65703fcffac2dab09c67ed | |
parent | 59b551a5ae2863e6a4e2ce6d549cf0e92c78691b (diff) | |
download | ATCD-843d611ad286c5dfb94540d1d2a4e2e7301ca266.tar.gz |
ChangeLogTag: Fri May 5 18:05:04 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 21 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp | 27 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Bunch/Test.cpp | 114 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Limits/Test.cpp | 21 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Separation/Test.cpp | 45 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp | 117 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Shared/Test.cpp | 52 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Simple/Test.cpp | 14 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp | 30 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h | 14 |
10 files changed, 285 insertions, 170 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 413e2b9a10f..2ccd2553fcd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,24 @@ +Fri May 5 18:05:04 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com> + + * tests/ORB_Local_Config/Bug_1459/Test.cpp: + * tests/ORB_Local_Config/Bunch/Test.cpp: + * tests/ORB_Local_Config/Limits/Test.cpp: + * tests/ORB_Local_Config/Separation/Test.cpp: + * tests/ORB_Local_Config/Service_Dependency/Test.cpp: + * tests/ORB_Local_Config/Shared/Test.cpp: + * tests/ORB_Local_Config/Simple/Test.cpp: + * tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp: + + Eliminating the use of ACE_ASSERT and replacing with if's and + ACE_ERROR. The ACE_ASSERT may cause an abort(), which will cause + resources to not be cleaned correctly on embedded targets like + VxWorks. Thanks to Johnny Willemsen <jwillemsen@remedy.nl> for + clarifying this. + + * tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h: + + A little cleanup. + Fri May 5 16:12:17 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com> * tao/ORB_Core.cpp: diff --git a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp index 060921e2c7a..f8e728a78fe 100644 --- a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp @@ -11,11 +11,6 @@ // ssliop isnt loaded at all etc -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/corba.h" #include "ace/ARGV.h" #include "ace/Dynamic_Service.h" @@ -88,32 +83,33 @@ testBug1459 (int , ACE_TCHAR *[]) ACE_ARGV arg0(argM); n = arg0.argc(); CORBA::ORB_var ORBA = CORBA::ORB_init(n, arg0.argv()); - ACE_ASSERT (ORBA.in () != 0); + if (ORBA.in () == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB\n")), -1); ACE_ARGV arg1(argA); n = arg1.argc(); CORBA::ORB_var ORBB = CORBA::ORB_init(n, arg1.argv()); - ACE_ASSERT (ORBB.in () != 0); - - ACE_ASSERT (ORBA.in () != ORBB.in ()); + if (ORBB.in () == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get a second ORB\n")), -1); + if (ORBA.in () == ORBB.in ()) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find the two ORBs the same\n")), -1); // Look ma!! No ... services?! ACE_Service_Object *so = 0; so = ACE_Dynamic_Service<ACE_Service_Object>::instance ("SSLIOP_Factory"); - ACE_ASSERT (so == 0); + if (so != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find SSLIOP_Factory, globally\n")), -1); so = ACE_Dynamic_Service<ACE_Service_Object>::instance ("UIPMC_Factory"); - ACE_ASSERT (so == 0); + if (so != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find UIPMC_Factory, globally\n")), -1); // Since each svc conf file causes the ORB to load the services in // its own service space no services are reachable through the // global service repo -#else - ACE_UNUSED_ARG (argM); - ACE_UNUSED_ARG (argA); #endif /* MORB_MA */ } @@ -124,8 +120,9 @@ testBug1459 (int , ACE_TCHAR *[]) } catch(...) { - ACE_ERROR ((LM_ERROR, "Uhandled exception\n")); + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected exception\n")), -1); } + return 0; } diff --git a/TAO/tests/ORB_Local_Config/Bunch/Test.cpp b/TAO/tests/ORB_Local_Config/Bunch/Test.cpp index ae61bdaca04..788124f34fc 100644 --- a/TAO/tests/ORB_Local_Config/Bunch/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Bunch/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - // The following is required to be able to access // ace_svc_desc_TAO_*_Parser, below #include "tao/CORBALOC_Parser.h" @@ -30,37 +25,50 @@ testCompatibility (int , ACE_TCHAR *[]) ACE_Service_Gestalt_Test glob; // Use the "old" interface - ACE_ASSERT (0 == ACE_Service_Config::process_directive - (ace_svc_desc_TAO_CORBANAME_Parser)); - ACE_ASSERT (0 == ACE_Service_Config::process_directive - (ace_svc_desc_TAO_CORBALOC_Parser)); + if (0 != ACE_Service_Config::process_directive + (ace_svc_desc_TAO_CORBANAME_Parser)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Failed to process %s\n"), ace_svc_desc_TAO_CORBANAME_Parser), -1); + + if(0 != ACE_Service_Config::process_directive + (ace_svc_desc_TAO_CORBALOC_Parser)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Failed to process %s\n"), ace_svc_desc_TAO_CORBALOC_Parser), -1); + + const ACE_TCHAR * svcname = 0; { // This uses the same default ACE_Service_Repository ACE_Service_Gestalt_Test one; + svcname = "CORBANAME_Parser"; + ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBANAME_Parser"); - ACE_ASSERT ((p20 != 0)); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + if ((p20 == 0)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); - ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBALOC_Parser"); - ACE_ASSERT ((p21 != 0)); + svcname = "CORBALOC_Parser"; - ACE_DEBUG ((LM_DEBUG, "\tglobal.services_count () -> %d\n", - one.services_count ())); - ACE_ASSERT (one.services_count () > 2); + ACE_Service_Object* p21 = + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + if ((p21 == 0)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); - // Exiting this scope should fini all services ... + // Exiting this scope should fini all services in the glob ... } + svcname = "CORBANAME_Parser"; + ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, "CORBANAME_Parser"); - ACE_ASSERT ((p20 == 0)); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, svcname); + if ((p20 != 0)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s globally, too\n"), svcname), -1); + + svcname = "CORBALOC_Parser"; ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, "CORBALOC_Parser"); - ACE_ASSERT ((p21 == 0)); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, svcname); + if ((p21 != 0)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s globally, too\n"), svcname), -1); return 0; } @@ -74,28 +82,38 @@ testCommandLineDirectives (int , ACE_TCHAR *[]) ACE_TRACE ("testCommandLineDirectives"); ACE_ARGV new_argv; - ACE_ASSERT (new_argv.add (ACE_TEXT ("-f")) != -1 - && new_argv.add (ACE_TEXT ("-S")) != -1 - && new_argv.add (ACE_TEXT ("d1")) != -1 - && new_argv.add (ACE_TEXT ("-S")) != -1 - && new_argv.add (ACE_TEXT ("d2")) != -1); + if (new_argv.add (ACE_TEXT ("-f")) == -1 + || new_argv.add (ACE_TEXT ("-S")) == -1 + || new_argv.add (ACE_TEXT ("d1")) == -1 + || new_argv.add (ACE_TEXT ("-S")) == -1 + || new_argv.add (ACE_TEXT ("d2")) == -1) + { + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unable to create an argv\n")), -1); + } ACE_Service_Gestalt_Test g(5); - ACE_ASSERT (g.parse_args (new_argv.argc (), - new_argv.argv ()) != -1 - || errno == ENOENT); + if (g.parse_args (new_argv.argc (), + new_argv.argv ()) == -1 + && errno != ENOENT) + { + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Failed to parse the argv\n")), -1); + } ACE_DEBUG ((LM_DEBUG, "\tg.command_line_directives_count () -> %d\n", g.command_line_directives_count ())); - ACE_ASSERT (2 == g.command_line_directives_count ()); + if (2 != g.command_line_directives_count ()) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected %d, but found %d command line directives\n"), + 2, + g.command_line_directives_count ()), + -1); + return 0; } - - // @brief Test the helper components used to implement the temporary // substitution of the repository currently used as "global" for the // sake of registering static services, which are dependent on a dynamic @@ -110,20 +128,30 @@ testTSSGestalt (int , ACE_TCHAR *[]) ACE_Service_Gestalt *global_instance = ACE_Service_Config::instance (); - ACE_ASSERT (global_instance == ACE_Service_Config::instance ()); - ACE_ASSERT (global_instance != &one); + // Sanity check + if (global_instance == &one); + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Invalid global gestalt\n")), -1); { + // Make one be the ACE_Service_Config::instance () ... ACE_Service_Config_Guard temporary (&one); ACE_Service_Gestalt *global_instance2 = ACE_Service_Config::instance (); - ACE_ASSERT (global_instance != global_instance2); - ACE_ASSERT (global_instance2 == &one); + if (global_instance == global_instance2) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to see a different global from before\n")), -1); + + if (global_instance2 != &one) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected one to be the global gestalt instance\n")), -1); + + // The guard is dead! Long live the global gestalt that was previously global! } - ACE_ASSERT (global_instance == ACE_Service_Config::instance ()); - ACE_ASSERT (global_instance != &one); + if (global_instance != ACE_Service_Config::instance ()); + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected the original global gestalt\n")), -1); + + if (global_instance == &one); + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Found the wrong instance is still being global\n")), -1); return 0; } @@ -135,10 +163,10 @@ testTSSGestalt (int , ACE_TCHAR *[]) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - testCompatibility (argc, argv); - testCommandLineDirectives (argc, argv); - testTSSGestalt(argc, argv); - return 0; + return + testCompatibility (argc, argv) + && testCommandLineDirectives (argc, argv) + && testTSSGestalt(argc, argv); } diff --git a/TAO/tests/ORB_Local_Config/Limits/Test.cpp b/TAO/tests/ORB_Local_Config/Limits/Test.cpp index bf3d85c42b8..63adf9d35f5 100644 --- a/TAO/tests/ORB_Local_Config/Limits/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Limits/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/CORBANAME_Parser.h" #include "tao/CORBALOC_Parser.h" @@ -16,9 +11,19 @@ int testLimits (int , ACE_TCHAR *[]) { ACE_Service_Gestalt one(1); // Room for just one ... - ACE_ASSERT (0 == one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser)); - ACE_ASSERT (-1 == one.process_directive (ace_svc_desc_TAO_CORBALOC_Parser)); - ACE_ASSERT (ENOSPC == errno); + if (0 != one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unable to register the first service\n")), -1); + + if (-1 != one.process_directive (ace_svc_desc_TAO_CORBALOC_Parser)) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexped to be able to add more\n")), -1); + + if (ENOSPC != errno) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected error code %d (ENOSPC), but got %d\n"), + ENOSPC, + errno), + -1); + ACE_DEBUG ((LM_DEBUG, "%p\n", "\tAttempt to overfill returned: ")); return 0; } diff --git a/TAO/tests/ORB_Local_Config/Separation/Test.cpp b/TAO/tests/ORB_Local_Config/Separation/Test.cpp index 3da7b54ba05..043b68087ea 100644 --- a/TAO/tests/ORB_Local_Config/Separation/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Separation/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/CORBANAME_Parser.h" #include "tao/CORBALOC_Parser.h" #include "tao/IIOP_Factory.h" @@ -23,38 +18,46 @@ testSeparation(int , ACE_TCHAR *[]) ACE_TRACE ("testSeparation"); ACE_Service_Gestalt_Test one (10); - one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser); ACE_Service_Gestalt_Test two (10); - two.process_directive (ace_svc_desc_TAO_CORBALOC_Parser); + const ACE_TCHAR * svcname = "IIOP_Factory"; + TAO_Protocol_Factory* p10 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, "IIOP_Factory"); - ACE_ASSERT ((p10 == 0)); + ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, svcname); + if (p10 != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1); TAO_Protocol_Factory* p11 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&two, "IIOP_Factory"); - ACE_ASSERT ((p11 == 0)); + if (p11 != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1); + svcname = "CORBANAME_Parser"; ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBANAME_Parser"); - ACE_ASSERT ((p20 != 0)); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + if (p20 == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); - ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBALOC_Parser"); - ACE_ASSERT ((p21 == 0)); + ACE_Service_Object* p31 = + ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); + if (p31 != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1); + svcname = "CORBALOC_Parser"; - ACE_Service_Object* p30 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, "CORBALOC_Parser"); - ACE_ASSERT ((p30 != 0)); + ACE_Service_Object* p21 = + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + if (p21 != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1); - ACE_Service_Object* p31 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, "CORBANAME_Parser"); - ACE_ASSERT ((p31 == 0)); + ACE_Service_Object* p30 = + ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); + if (p30 == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1); return 0; } diff --git a/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp b/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp index 1f1a893e011..5c36cf4b4b6 100644 --- a/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/Codeset_Descriptor_Base.h" #include "tao/Codeset_Manager_Factory_Base.h" #include "tao/Codeset_Manager.h" @@ -67,22 +62,34 @@ testOpenDynamicServices (int , ACE_TCHAR *[]) ACE_ARGV new_argv; // Process the Service Configurator directives in this test's - ACE_ASSERT (new_argv.add (ACE_TEXT ("bogus")) != -1 - && new_argv.add (ACE_TEXT ("-f")) != -1 - && new_argv.add (file_Service_Config_Test ()) != -1); + if (false == (new_argv.add (ACE_TEXT ("bogus")) != -1 + && new_argv.add (ACE_TEXT ("-f")) != -1 + && new_argv.add (file_Service_Config_Test ()) != -1)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed to build an argv\n"))); + return -1; + } // We need this scope to make sure that the destructor for the // <ACE_Service_Config> gets called. ACE_Service_Gestalt_Test daemon(10); - ACE_ASSERT (daemon.open (new_argv.argc (), - new_argv.argv ()) != -1 || errno == ENOENT); + if (daemon.open (new_argv.argc (), + new_argv.argv ()) == -1 && errno == ENOENT) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to open service config\n"))); + return -1; + } ACE_DEBUG ((LM_DEBUG, "\tdaemon.services_count () -> %d\n", daemon.services_count ())); - ACE_ASSERT (5 == daemon.services_count ()); + if (5 != daemon.services_count ()) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected %d service, but found %d instead\n"), 5, daemon.services_count ())); + return -1; + } // Since the loaded services start their own threads, wait until all // of them are done to avoid pulling the rug under their feet. @@ -109,7 +116,11 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // It is expected to be empty at this point since it is not using // the global repo - ACE_ASSERT (loca_size == 0); + if (loca_size != 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected empty repository\n"))); + return -1; + } // Lookup it up. TAO::ORBInitializer_Registry_Adapter* oir = @@ -117,9 +128,17 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) (&one, "ORBInitializer_Registry"); #if defined (TAO_AS_STATIC_LIBS) - ACE_ASSERT ((oir != 0)); + if ((oir == 0)) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find staticaly linked ORBInitializer_Registry\n"))); + return -1; + } #else - ACE_ASSERT ((oir == 0)); + if (oir != 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find ORBInitializer_Registry\n"))); + return -1; + } #endif @@ -138,21 +157,22 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance (&one, "ORBInitializer_Registry"); } - ACE_ASSERT ((oir != 0)); + if (oir == 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find ORBInitializer_Registry\n"))); + return -1; + } #endif - ACE_DEBUG ((LM_DEBUG, - "Expected %d global static service registrations, found %d\n", + if (glob_size != glob.services_count ()) + { + ACE_ERROR ((LM_ERROR, + "Expected %d local static service registrations, found %d\n", glob_size, glob.services_count ())); - - ACE_ASSERT (glob_size == glob.services_count ()); - - ACE_DEBUG ((LM_DEBUG, - "Expected %d local static service registrations, found %d\n", - 5, - one.services_count ())); + return -1; + } // The local repository must have asquired also the static services // registered within the dynamic service we just loaded. As of this @@ -161,7 +181,11 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // ClientRequestInterceptor_Adapter_Factory and PICurrent_Loader are // registred explicitely, while CodecFactory_Loader - indirectly. - ACE_ASSERT (loca_size != one.services_count ()); + if (loca_size == one.services_count ()) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find additional services present\n"))); + return -1; + } ACE_DEBUG ((LM_DEBUG, "(%P|%t) try global dynamic service" @@ -172,7 +196,12 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance ("ORBInitializer_Registry"); - ACE_ASSERT ((oir1 == 0)); // Right! It should not have been global. + +// Right! It should not have been global. + if (oir1 != 0) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Unexpected to find ORBInitializer_Registry\n")), + -1); ACE_DEBUG ((LM_DEBUG, "(%P|%t) try local dynamic service" @@ -183,7 +212,11 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance (&one, "ORBInitializer_Registry"); - ACE_ASSERT ((oir2 != 0)); // Right! That's local. + // Right! That's local. + if (oir2 == 0) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Expected to find ORBInitializer_Registry locally\n")), + -1); ACE_DEBUG ((LM_DEBUG, "(%P|%t) Explicitely initialize ORBInitializer_Registry" @@ -203,8 +236,11 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) "dependent static service (CodecFactory_Loader) ...\n")); // ... and also one of the dependent static services - ACE_ASSERT (0 != ACE_Dynamic_Service <ACE_Service_Object>::instance - (&one, "CodecFactory_Loader")); + if (0 == ACE_Dynamic_Service <ACE_Service_Object>::instance + (&one, "CodecFactory_Loader")) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Expected to find CodecFactory_Loader locally\n")), + -1); ACE_DEBUG ((LM_DEBUG, @@ -217,8 +253,13 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) "_make_TAO_PolicyFactory_Loader", "")); - ACE_ASSERT (0 != ACE_Dynamic_Service <ACE_Service_Object>::instance - (&one, "PolicyFactory_Loader")); + + if (0 == ACE_Dynamic_Service <ACE_Service_Object>::instance + (&one, "PolicyFactory_Loader")) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Expected to find PolicyFactory_Loader locally\n")), + -1); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) We're done testing.\n")); @@ -251,16 +292,22 @@ testServiceDependency (int , ACE_TCHAR *[]) "TAO_Codeset", "_make_TAO_Codeset_Manager_Factory", "")); - ACE_ASSERT (result == 0); - ACE_UNUSED_ARG (result); + if (result != 0) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Expected to register TAO_Codeset successfuly\n")), + -1); TAO_Codeset_Manager_Factory_Base *factory = ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance (&one, "TAO_Codeset"); - ACE_ASSERT (factory != 0); + + if (factory == 0) + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("Expected to obtain an instance successfuly\n")), + -1); codeset_manager = factory->create (); - ACE_ASSERT (codeset_manager != 0); + if (codeset_manager == 0) ACE_DEBUG ((LM_DEBUG, "Creating dependency ...\n")); diff --git a/TAO/tests/ORB_Local_Config/Shared/Test.cpp b/TAO/tests/ORB_Local_Config/Shared/Test.cpp index 25d99ceea4b..409e993c274 100644 --- a/TAO/tests/ORB_Local_Config/Shared/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Shared/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/CORBANAME_Parser.h" #include "tao/CORBALOC_Parser.h" #include "tao/Protocol_Factory.h" @@ -26,30 +21,59 @@ testReusingGlobals (int , ACE_TCHAR *[]) one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser); one.process_directive (ace_svc_desc_TAO_CORBALOC_Parser); + const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory"); TAO_Protocol_Factory* p1 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, "IIOP_Factory"); + ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, svcname); - ACE_ASSERT ((p1 == 0)); + if (p1 != 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s locally\n"), svcname)); + return -1; + } + svcname = ACE_TEXT ("CORBANAME_Parser"); ACE_Service_Object* p2 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBANAME_Parser"); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); - ACE_ASSERT ((p2 != 0)); + if (p2 == 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s localy\n"), svcname)); + return -1; + } + svcname = ACE_TEXT ("CORBALOC_Parser"); ACE_Service_Object* p3 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBALOC_Parser"); - - ACE_ASSERT ((p3 != 0)); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + if (p3 == 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s locally\n"), svcname)); + return -1; + } } ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance () + const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory"); + TAO_Protocol_Factory* p1 = + ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&two, svcname); + + if (p1 != 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname)); + return -1; + } + + svcname = ACE_TEXT ("CORBANAME_Parser"); ACE_Service_Object* p2 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, "CORBANAME_Parser"); + ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); - ACE_ASSERT ((p2 != 0)); // You should be able to find the same stuff here, too + if (p2 == 0) // You should be able to find the same stuff here, too + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname)); + return -1; + } return 0; } diff --git a/TAO/tests/ORB_Local_Config/Simple/Test.cpp b/TAO/tests/ORB_Local_Config/Simple/Test.cpp index b8a57f334df..a93e129d932 100644 --- a/TAO/tests/ORB_Local_Config/Simple/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Simple/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "tao/CORBANAME_Parser.h" #include "tao/CORBALOC_Parser.h" #include "tao/Protocol_Factory.h" @@ -26,17 +21,20 @@ ACE_TMAIN (int, ACE_TCHAR *[]) TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, "IIOP_Factory"); - ACE_ASSERT ((p1 == 0)); + if (p1 != 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find IIOP_Factory\n")), -1); ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBANAME_Parser"); - ACE_ASSERT ((p2 != 0)); + if (p2 == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBANAME_Parser\n")), -1); ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBALOC_Parser"); - ACE_ASSERT ((p3 != 0)); + if (p3 == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBALOC_Parser\n")), -1); return 0; } diff --git a/TAO/tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp b/TAO/tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp index 04f3d77b0be..7ed6fca81e0 100644 --- a/TAO/tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Two_DLL_ORB/Test.cpp @@ -1,10 +1,5 @@ // $Id$ -/// It's a test - we need ACE_ASSERT -#ifdef ACE_NDEBUG -# undef ACE_NDEBUG -#endif - #include "ace/ARGV.h" #include "ace/Thread_Manager.h" @@ -32,13 +27,24 @@ testLoadingTwoOrbs (int , ACE_TCHAR *argv[]) ACE_DEBUG ((LM_DEBUG, "Looking for conf file %s\n", file_Service_Config_ORB_Test ())); // Process the Service Configurator directives in this test's - ACE_ASSERT (new_argv.add (argv) != -1 - && new_argv.add (ACE_TEXT ("-f")) != -1 - && new_argv.add (file_Service_Config_ORB_Test ()) != -1); - - ACE_ASSERT (ACE_Service_Config::instance() ->open (new_argv.argc (), - new_argv.argv ()) != -1 || errno == ENOENT); - + if (new_argv.add (argv) == -1 + || new_argv.add (ACE_TEXT ("-f")) == -1 + || new_argv.add (file_Service_Config_ORB_Test ()) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT("ARGV initialization failed\n"))); + return -1; + } + + if (ACE_Service_Config::instance() ->open (new_argv.argc (), + new_argv.argv ()) == -1) + { + if (errno == ENOENT) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("No service config file found\n"))); + else + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Service Config open failed: %m\n"))); + + return -1; + } // Since the loaded services start their own threads, wait until all of them // are done to avoid pulling the rug under their feet. diff --git a/TAO/tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h b/TAO/tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h index 6091dd5ca6f..eb8b8f6ebda 100644 --- a/TAO/tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h +++ b/TAO/tests/ORB_Local_Config/lib/Service_Configuration_Per_ORB.h @@ -7,8 +7,6 @@ #include "ace/Trace.h" #include "ace/Service_Config.h" -//#include "CfgPer_ORB_Export.h" - /// We need this wrapper to "break" the encapsulation and test /// the internals of the class. The class also does a complete /// teardown on the service repository used. So, do not expect @@ -68,17 +66,5 @@ private: bool teardown_; }; -// Return the name of the service configuration file, based on the current ACE -// support for wide characters and unicode -/// Borrowing this from the $ACE_ROOT/test/Service_Config_Test -/// The various config files have the same effect of loading 5 -/// new service objects. - -/* const ACE_TCHAR* file_Service_Config_Test (); */ - -/* // Return the name of the service configuration file, for the ORB-based */ -/* // service object test */ - -/* const ACE_TCHAR* file_Service_Config_ORB_Test (); */ #endif /* SERVICE_CONFIGURATION_PER_ORB_H */ |