Correction of Export/Import defines for Win32 platform.
Using WIN32 standard define instead WNT define of OpenCascade library.
Using Basics instead Utils library.
Removed "using namespace std" from header files.
#include "BatchTest.hxx"
+#include "Batch_Date.hxx"
+#include "MpiImpl.hxx"
+#include "utilities.h"
+
+#include <sys/stat.h>
+#include <iostream>
+#include <fstream>
+#ifdef WIN32
+# include <io.h>
+#endif
BatchTest::BatchTest(const Engines::MachineParameters& batch_descr)
{
_batch_descr = batch_descr;
}
i++ ;
}
-
+
// Creating test temporary file
_test_filename = "/tmp/";
_test_filename += _date + "_test_cluster_file_";
<< "--- Application : " << result_appli << std::endl
);
- if (result_connection == "OK" and
- result_filecopy == "OK" and
- result_getresult == "OK" and
- result_jobsubmit_simple == "OK" and
- result_jobsubmit_mpi == "OK" and
+ if (result_connection == "OK" &&
+ result_filecopy == "OK" &&
+ result_getresult == "OK" &&
+ result_jobsubmit_simple == "OK" &&
+ result_jobsubmit_mpi == "OK" &&
result_appli == "OK")
rtn = true;
result += "username is empty !";
return result;
}
- if( protocol != "rsh" and protocol != "ssh")
+ if( protocol != "rsh" && protocol != "ssh")
{
result += "protocol unknown ! (" + protocol + ")";
return result;
if(status == 153 || status == 256*153 )
stop = true;
+#ifdef WIN32
+ Sleep(1);
+#else
sleep(1);
+#endif
}
// Build command for getting results
<< "echo HELLO MPI\n";
file_script.flush();
file_script.close();
- chmod(_test_file_script.c_str(), 0x1ED);
+#ifdef WIN32
+ _chmod
+#else
+ chmod
+#endif
+ (_test_file_script.c_str(), 0x1ED);
std::string _test_file_mpi = _test_filename + "_mpi";
std::ofstream file_mpi;
if(status == 153 || status == 256*153 )
stop = true;
+#ifdef WIN32
+ Sleep(1);
+#else
sleep(1);
+#endif
}
// Build command for getting results
return result;
}
result = "OK";
- return result;
+ return result;
}
std::string
#ifndef __BatchTest_HXX__
#define __BatchTest_HXX__
-#include <sys/stat.h>
-#include <iostream>
-#include <fstream>
+#include "SALOME_Launcher_defs.hxx"
#include <SALOMEconfig.h>
-#include "utilities.h"
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
-#include "Batch_Date.hxx"
-#include "MpiImpl.hxx"
+#include <string>
-class BatchTest
+class SALOMELAUNCHER_EXPORT BatchTest
{
public:
BatchTest(const Engines::MachineParameters& batch_descr);
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#include "Launcher.hxx"
+
#include "Batch_Date.hxx"
#include "Batch_FactBatchManager_eLSF.hxx"
#include "Batch_FactBatchManager_ePBS.hxx"
-#include "Launcher.hxx"
+#include "Batch_BatchManager_eClient.hxx"
+
#include <iostream>
#include <sstream>
#include <sys/stat.h>
istringstream iss(jid.getReference());
iss >> jobId;
- _jobmap[ pair<string,long>(clustername,jobId) ] = job;
+ _jobmap[ pair<string,long>(clustername,jobId) ] = job;
}
catch(const Batch::EmulationException &ex){
throw LauncherException(ex.msg.c_str());
string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params)
{
+#ifndef WIN32 //TODO: need for porting on Windows
int idx = dirForTmpFiles.find("Batch/");
std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
delete mpiImpl;
return TmpFileName;
+#else
+ return "";
+#endif
}
rtn = false;
}
std::string end_mem_value = mem_value.substr(mem_value.length()-2);
- if (end_mem_value != "gb" and end_mem_value != "mb") {
+ if (end_mem_value != "gb" && end_mem_value != "mb") {
mem_info = "Error on definition, type is bad ! " + mem_value;
rtn = false;
}
#ifndef __LAUNCHER_HXX__
#define __LAUNCHER_HXX__
-#include "Batch_BatchManager_eClient.hxx"
+#ifdef WIN32
+# ifdef LAUNCHER_EXPORTS
+# define LAUNCHER_EXPORT __declspec(dllexport)
+# else
+# define LAUNCHER_EXPORT __declspec(dllimport)
+# endif
+#else
+# define LAUNCHER_EXPORT
+#endif
+
+#include <SALOME_ResourcesCatalog_Parser.hxx>
#include "ResourcesManager.hxx"
#include <string>
+#include <vector>
+
+class MpiImpl;
+
+namespace Batch{
+ class BatchManager_eClient;
+ class Job;
+}
struct batchParams{
std::string batch_directory;
unsigned long nb_proc;
};
-class LauncherException
+class LAUNCHER_EXPORT LauncherException
{
public:
const std::string msg;
LauncherException(const std::string m) : msg(m) {}
};
-class Launcher_cpp
+class LAUNCHER_EXPORT Launcher_cpp
{
public:
protected:
- std::string buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params);
+ std::string buildSalomeCouplingScript(const std::string fileToExecute, const std::string dirForTmpFiles, const ParserResourcesType& params);
MpiImpl *FactoryMpiImpl(MpiImplType mpiImpl) throw(LauncherException);
Batch::BatchManager_eClient *FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException);
std::string getTmpDirForBatchFiles();
salomeinclude_HEADERS = \
BatchTest.hxx \
SALOME_Launcher.hxx \
+ SALOME_Launcher_defs.hxx \
Launcher.hxx
# Scripts to be installed
SALOME_LauncherServer_LDADD =\
libSalomeLauncher.la \
+ ../Basics/libSALOMEBasics.la \
$(MPI_LIBS) \
$(CORBA_LIBS) \
$(LIBXML_LIBS) \
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_Launcher.hxx"
+#include "BatchTest.hxx"
#include "OpUtil.hxx"
-#include <sys/types.h>
-#ifndef WNT
-#include <unistd.h>
+#include "SALOME_ContainerManager.hxx"
+#include "Utils_CorbaException.hxx"
+
+#ifdef WIN32
+# include <process.h>
+#else
+# include <unistd.h>
#endif
+#include <sys/types.h>
#include <vector>
-#include "Utils_CorbaException.hxx"
using namespace std;
//=============================================================================
CORBA::Long SALOME_Launcher::getPID()
{
- return (CORBA::Long)getpid();
+ return
+#ifndef WIN32
+ (CORBA::Long)getpid();
+#else
+ (CORBA::Long)_getpid();
+#endif
+
}
//=============================================================================
const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
string clustername(p->alias);
INFOS("Choose cluster" << clustername);
+
BatchTest t(*p);
if (t.test())
{
p.mem_mb = params.mem_mb;
try{
- status = _l.querySalomeJob(jobId,p);
+ status = _l.querySalomeJob(jobId,p);
}
catch(const LauncherException &ex){
INFOS("Caught exception.");
#ifndef __SALOME_LAUNCHER_HXX__
#define __SALOME_LAUNCHER_HXX__
+#include "SALOME_Launcher_defs.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
-#include "SALOME_ContainerManager.hxx"
-#include "BatchTest.hxx"
#include "Launcher.hxx"
#include <string>
class SALOME_NamingService;
+class SALOME_ContainerManager;
+class SALOME_ResourcesManager;
-#if defined LAUNCHER_EXPORTS
-#if defined WIN32
-#define LAUNCHER_EXPORT __declspec( dllexport )
-#else
-#define LAUNCHER_EXPORT
-#endif
-#else
-#if defined WNT
-#define LAUNCHER_EXPORT __declspec( dllimport )
-#else
-#define LAUNCHER_EXPORT
-#endif
-#endif
-
-class LAUNCHER_EXPORT SALOME_Launcher:
+class SALOMELAUNCHER_EXPORT SALOME_Launcher:
public POA_Engines::SalomeLauncher,
public PortableServer::RefCountServantBase
{
const Engines::BatchParameters& batch_params,
const Engines::MachineParameters& params);
- char* querySalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params);
- void deleteSalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params);
- void getResultSalomeJob( const char * directory, const CORBA::Long jobId, const Engines::MachineParameters& params );
+ char* querySalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params);
+ void deleteSalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params);
+ void getResultSalomeJob( const char * directory, CORBA::Long jobId, const Engines::MachineParameters& params );
CORBA::Boolean testBatch(const Engines::MachineParameters& params);
void AttachDebugger()
{
+#ifndef WIN32
if(getenv ("DEBUGGER"))
{
std::stringstream exec;
system(exec.str().c_str());
while(1);
}
+#endif
}
void terminateHandler(void)
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __SALOME_LAUNCHER_DEFS_HXX__
+#define __SALOME_LAUNCHER_DEFS_HXX__
+
+#ifdef WIN32
+# ifdef SALOMELAUNCHER_EXPORTS
+# define SALOMELAUNCHER_EXPORT __declspec(dllexport)
+# else
+# define SALOMELAUNCHER_EXPORT __declspec(dllimport)
+# endif
+#else
+# define SALOMELAUNCHER_EXPORT
+#endif
+
+#endif //__SALOME_LAUNCHER_DEFS_HXX__
#include "SALOME_FileTransferCORBA.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
container = _theFileRef->getContainer();
ASSERT(! CORBA::is_nil(container));
- string myMachine = GetHostname();
+ string myMachine = Kernel_Utils::GetHostname();
string localCopy = _theFileRef->getRef(myMachine.c_str());
if (localCopy.empty()) // no existing copy available
#include <string>
-#ifdef WNT
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include <iomanip>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#endif
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "utilities.h"
#include <ServiceUnreachable.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
#include CORBA_CLIENT_HEADER(DSC_Engines)
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include CORBA_CLIENT_HEADER(SALOMEDS)
-#else
-#include "SALOME_ModuleCatalog.hh"
-#include "SALOME_Session.hh"
-#include "DSC_Engines.hh"
-#include "SALOME_Registry.hh"
-#include "SALOMEDS.hh"
-#endif
+
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
{
// containerName doesn't contain "/" => Local container
params->container_name=CORBA::string_dup(stContainer);
- params->hostname=CORBA::string_dup(GetHostname().c_str());
+ params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
}
else
{
}
}
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
// 1) SalomeLauncher
CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
#define _SALOME_LIFECYCLECORBA_HXX_
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <string>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include <iostream>
-using namespace std;
-#ifdef WNT
+
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include "SALOME_FileTransferCORBA.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
#include <fstream>
// --- get a local container (with a name based on local hostname),
// load an engine, check that the CORBA object is not null
- string containerName = GetHostname();
+ string containerName = Kernel_Utils::GetHostname();
containerName += "/theContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
- containerName = GetHostname();
+ containerName = Kernel_Utils::GetHostname();
containerName += "/aContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo2 =
Engines::MachineParameters params;
_LCC.preSet(params);
- string hostname=GetHostname();
+ string hostname=Kernel_Utils::GetHostname();
params.hostname=hostname.c_str();
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(params,"SalomeTestComponent");
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
}
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
string cname1 = c1->name();
CPPUNIT_ASSERT(cname1.find(containerName) != string::npos);
}
SALOME_LifeCycleCORBA _LCC(&_NS);
string origFileName = getenv("KERNEL_ROOT_DIR");
origFileName += "/lib/salome/libSalomeLifeCycleCORBA.so.0.0.0";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
CPPUNIT_ASSERT(!local.empty());
resourcesManager->GetFittingResources(params,clist);
CPPUNIT_ASSERT(hostList->length() > 1);
- string localHost = GetHostname();
+ string localHost = Kernel_Utils::GetHostname();
string remoteHost;
for (unsigned int i=0; i < hostList->length(); i++)
{
// $Header$
#include <iostream>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <SALOMEconfig.h>
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
-#else
-#include <SALOME_Component.hh>
-#include <SALOME_TestComponent.hh>
-#endif
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
#include "utilities.h"
-#include <OpUtil.hxx>
+#include <Basics_Utils.hxx>
using namespace std;
// --- yet another container, with hostname,
// load an engine, and invoque methods on that engine
- string containerName4 = GetHostname();
+ string containerName4 = Kernel_Utils::GetHostname();
containerName4 += "/titiPy";
Engines::Component_var mycompo4 =
_LCC.FindOrLoad_Component(containerName4.c_str(),"SALOME_TestComponentPy");
// --- try a local file transfer
string origFileName = "/home/prascle/petitfichier";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
SCRUTE(local);
# include <unistd.h>
#endif
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
#include <SALOMEconfig.h>
-#ifndef WNT
+#ifndef WIN32
#include <fstream.h>
#else
#include <fstream>
#include <omnithread.h>
#include "Logger.hh"
-#ifdef WNT
+#ifdef WIN32
# if defined LOGGER_EXPORTS
# define LOGGER_EXPORT __declspec( dllexport )
# else
//otherwise all messages will be put into terminal via cout
bool m_putIntoFile;
//ofstream class specialized for disk file output
-#ifndef WNT
+#ifndef WIN32
ofstream m_outputFile;
#else
std::ofstream m_outputFile;
for (i = 1; i <= NumberOfTries; i++)
{
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include <iostream>
using namespace std;
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
// searchin for naming service for 0.25*40=10 seconds
for (i = 1; i <= NumberOfTries; i++) {
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req,&ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
name[0].id=CORBA::string_dup("Logger");
for(i = 1; i <= NumberOfTries; i++){
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include "Logger.hh"
//these declarations for files don't using OCC includes (for example HDF)
-# ifdef WNT
+# ifdef WIN32
# ifndef Standard_EXPORT
# define Standard_EXPORT __declspec( dllexport )
# define Standard_IMPORTC extern "C" __declspec( dllimport )
# endif /* Standard_IMPORT */
-# else /* WNT */
+# else /* WIN32 */
# ifndef Standard_EXPORT
# define Standard_EXPORT
# define Standard_IMPORTC extern "C"
# endif /* Standard_IMPORT */
-# endif /* WNT */
+# endif /* WIN32 */
class SALOME_Trace : public std::ostrstream
{
CORBA::Object_var obj=_poa->id_to_reference(*_id);
Engines::Container_var pCont = Engines::Container::_narrow(obj);
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
_containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
SCRUTE(_containerName);
_NS->Register(pCont, _containerName.c_str());