*/
// ============================================================================
-int main()
+int main(int argc, char *argv[])
{
// --- Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Class attributes initialisation, for class method SALOMETraceCollector::run
-CORBA::ORB_ptr SALOMETraceCollector::_orb = 0;
+CORBA::ORB_var SALOMETraceCollector::_orb;
// ============================================================================
/*!
if (_singleton == 0) // another thread may have got
{ // the lock after the first test
BaseTraceCollector* myInstance = new SALOMETraceCollector();
+ int argc=0;
+ char *_argv=0;
+ char ** argv = &_argv;
+ //_orb = CORBA::ORB_init (argc, argv);
_orb = KERNEL::GetRefToORB();
sem_init(&_sem,0,0); // to wait until run thread is initialized
SALOME_Logger::Logger_var m_pInterfaceLogger;
CORBA::Object_var obj;
-
+ CORBA::ORB_var _orb = KERNEL::GetRefToORB();
obj = TraceCollector_WaitForServerReadiness(_orb,"Logger");
if (!CORBA::is_nil(obj))
m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj);
SALOMETraceCollector();
private:
- static CORBA::ORB_ptr _orb;
+ static CORBA::ORB_var _orb;
};
#endif
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../ArgvKeeper
)
SET(COMMON_LIBS
SALOMELocalTraceTest
SALOMELocalTrace
SALOMEBasics
+ ArgvKeeper
${PTHREAD_LIBRARIES}
${PLATFORM_LIBS}
${CPPUNIT_LIBRARIES}
// --- Registers the fixture into the 'registry'
-CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+//CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
CPPUNIT_TEST_SUITE_REGISTRATION( SALOMETraceCollectorTest );
// --- generic Main program from Basic/Test
#include "TraceCollector_WaitForServerReadiness.hxx"
#include <iostream>
#include <ctime>
+#include <mutex>
#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1900
#include <omnithread/pthread_nt.h>
#endif
+std::mutex mutex;
+
// ============================================================================
/*!
* Wait until a server is registered in naming service.
ts_rem.tv_nsec=0;
ts_rem.tv_sec=0;
+ const std::lock_guard<std::mutex> lock(mutex);
CORBA::Object_var obj;
try
{
try
{
- if(!CORBA::is_nil(orb))
+ if(!CORBA::is_nil(orb))
+ {
theObj = orb->resolve_initial_references("NameService");
+ }
if (!CORBA::is_nil(theObj))
inc = CosNaming::NamingContext::_narrow(theObj);
}
}
std::vector<std::string> args = GetArgcArgv();
int argc = args.size();
- char** argv = new char*[argc];
+ char** argv = nullptr;
+ char *dummy = nullptr;
+ if(argc>0)
+ { argv = new char*[argc]; }
+ else
+ { argv = &dummy; }
for (int i = 0; i < argc; ++i)
argv[i] = strdup(args.at(i).c_str());
- _orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
+ if(argc>0)
+ { _orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; }
+ else
+ { _orb = CORBA::ORB_init( argc, argv); }
for (int i = 0; i < argc; ++i)
delete[] argv[i];
- delete[] argv;
+ if(argc>0)
+ delete[] argv;
}
catch( const CORBA::Exception & )
{