#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;
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);
res = SIMGRID_MC_EXIT_LIVENESS;
}
checker = nullptr;
- simgrid::mc::session->close();
+ mcapi::get().s_close();
return res;
}