]> SALOME platform Git repositories - modules/kernel.git/blobdiff - src/Launcher/TestLauncher.cxx
Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / Launcher / TestLauncher.cxx
old mode 100755 (executable)
new mode 100644 (file)
index b5cec5f..cdfd3b1
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 //
 
 #include "Launcher.hxx"
+#include <iostream>
+#include <string>
+#include <memory>
 
-int main(int argc, char** argv)
+int main()
 {
+  std::string xmlfile("");
 
   try {
     Launcher_cpp *lcpp = new Launcher_cpp();
-    ResourcesManager_cpp *rcpp = new ResourcesManager_cpp();
+    std::shared_ptr<ResourcesManager_cpp> rcpp(new ResourcesManager_cpp());
     lcpp->SetResourcesManager(rcpp);
+    if(!getenv("KERNEL_ROOT_DIR"))
+      throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!! -> cannot load testLauncher.xml");
+    xmlfile = getenv("KERNEL_ROOT_DIR");
+    xmlfile += "/share/salome/resources/kernel/testLauncher.xml";
+
+    long jobid = lcpp->createJobWithFile(xmlfile.c_str(),"localhost");
+    lcpp->launchJob(jobid);
     delete lcpp;
-    delete rcpp;
     std::cout << "test OK" << std::endl;
   } catch ( const ResourcesException &ex) {
     std::cout << ex.msg.c_str() << std::endl;