X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FTest%2FTestSALOMEDS.cxx;h=f3773deaf2ccd955157e4d6c68fcecb63c036108;hb=d1151f956567da46ee95cfd65502b55416145b66;hp=3b4601d410f7c3890f4b2cde6dcfcc2f09185a8d;hpb=63414a08d9492c25c206579c1953ec6f390679fd;p=modules%2Fkernel.git diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 3b4601d41..f3773deaf 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -54,8 +54,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); #include "SALOMEDS_StudyManager_i.hxx" #ifdef WIN32 +#include #define setenv Kernel_Utils::setenv -#endif +#endif // ============================================================================ /*! @@ -66,38 +67,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); int main(int argc, char* argv[]) { - // --- Run Salome without GUI - - setenv("SALOME_trace", "file:./traceUnitTest.log", 1); // 1: overwrite - - system("runSalome -t &"); - - // --- Wait till SALOMEDS server is launched - - char hostname[511]; - int size; - gethostname(hostname, size); - char* chr_port = getenv("SALOMEDS_UNITTESTS_PORT"); - std::string port; - if(chr_port) port = chr_port; - if(port.empty()) port = "2810"; - std::string cfg_file = std::string(getenv("HOME"))+"/.omniORB_"+std::string(hostname)+"_"+port+".cfg"; - setenv("OMNIORB_CONFIG", cfg_file.c_str(), 1); - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()); CORBA::ORB_var orb = init(argc , argv ) ; - - #ifndef WIN32 - sleep(15); - #else - Sleep(15000); - #endif - - std::string host; // = Kernel_Utils::GetHostname(); char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR"); - if(wait_Superv) host = Kernel_Utils::GetHostname(); + if(wait_Superv) host = Kernel_Utils::GetHostname(); SALOME_NamingService NS(orb); if(host.empty()) @@ -113,7 +87,7 @@ int main(int argc, char* argv[]) return 1; } - //Set up the environement for Embedded case + //Set up the environment for Embedded case std::string kernel_root = getenv("KERNEL_ROOT_DIR"); CPPUNIT_ASSERT(!kernel_root.empty()); kernel_root+="/share/salome/resources/kernel"; @@ -126,20 +100,20 @@ int main(int argc, char* argv[]) // Activate the objects. This tells the POA that the objects are ready to accept requests. PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i); aStudyManager_i->register_name("/myStudyManager_embedded"); - + // Obtain a POAManager, and tell the POA to start accepting // requests on its objects. PortableServer::POAManager_var pman = poa->the_POAManager(); pman->activate(); } - + // --- Create the event manager and test controller CPPUNIT_NS::TestResult controller; // --- Add a listener that colllects test result CPPUNIT_NS::TestResultCollector result; - controller.addListener( &result ); + controller.addListener( &result ); // --- Add a listener that print dots as test run. #ifdef WIN32 @@ -147,7 +121,7 @@ int main(int argc, char* argv[]) #else CPPUNIT_NS::BriefTestProgressListener progress; #endif - controller.addListener( &progress ); + controller.addListener( &progress ); // --- Get the top level suite from the registry @@ -166,17 +140,13 @@ int main(int argc, char* argv[]) testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc); //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); CPPUNIT_NS::CompilerOutputter outputter( &result, testFile ); - outputter.write(); + outputter.write(); // --- Run the tests. bool wasSucessful = result.wasSuccessful(); testFile.close(); - // --- Kill all created Salome process - - system("killSalome.py"); - // --- Return error code 1 if the one of test failed. return wasSucessful ? 0 : 1;