Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mcapi::log_state() in run()
[simgrid.git] / src / mc / checker / simgrid_mc.cpp
index d8544e5..e382e9f 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/mc/mc_config.hpp"
 #include "src/mc/mc_exit.hpp"
 #include "src/internal_config.h"
+#include "src/mc/mc_api.hpp"
 
 #if HAVE_SMPI
 #include "smpi/smpi.h"
 #include <memory>
 #include <unistd.h>
 
+using mcapi = simgrid::mc::mc_api;
+
 static inline
 char** argvdup(int argc, char** argv)
 {
-  char** argv_copy = new char*[argc + 1];
+  auto* argv_copy = new char*[argc + 1];
   std::memcpy(argv_copy, argv, sizeof(char*) * argc);
   argv_copy[argc] = nullptr;
   return argv_copy;
@@ -54,14 +57,7 @@ int main(int argc, char** argv)
   smpi_init_options(); // only performed once
 #endif
   sg_config_init(&argc, argv);
-  simgrid::mc::session = new simgrid::mc::Session([argv_copy] {
-    int i = 1;
-    while (argv_copy[i] != nullptr && argv_copy[i][0] == '-')
-      i++;
-    xbt_assert(argv_copy[i] != nullptr,
-               "Unable to find a binary to exec on the command line. Did you only pass config flags?");
-    execvp(argv_copy[i], argv_copy + i);
-  });
+  mcapi::get().initialize(argv_copy);
   delete[] argv_copy;
 
   auto checker = create_checker(*simgrid::mc::session);
@@ -76,6 +72,6 @@ int main(int argc, char** argv)
     res = SIMGRID_MC_EXIT_LIVENESS;
   }
   checker = nullptr;
-  simgrid::mc::session->close();
+  mcapi::get().s_close();
   return res;
 }