#include "src/mc/mc_protocol.h"
#include "src/mc/mc_safety.h"
#include "src/mc/mc_comm_pattern.h"
-#include "src/mc/mc_liveness.h"
+#include "src/mc/LivenessChecker.hpp"
#include "src/mc/mc_exit.h"
#include "src/mc/Session.hpp"
#include "src/mc/Checker.hpp"
+#include "src/mc/CommunicationDeterminismChecker.hpp"
#include "src/mc/SafetyChecker.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc");
-static
+static inline
char** argvdup(int argc, char** argv)
{
char** argv_copy = xbt_new(char*, argc+1);
std::function<int(Session& session)> code;
if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
- code = [](Session& session) {
- return MC_modelcheck_comm_determinism(); };
+ return std::unique_ptr<simgrid::mc::Checker>(
+ new simgrid::mc::CommunicationDeterminismChecker(session));
else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0')
return std::unique_ptr<simgrid::mc::Checker>(
new simgrid::mc::SafetyChecker(session));
else
- code = [](Session& session) {
- return simgrid::mc::modelcheck_liveness(); };
+ return std::unique_ptr<simgrid::mc::Checker>(
+ new simgrid::mc::LivenessChecker(session));
return std::unique_ptr<simgrid::mc::Checker>(
new FunctionalChecker(session, std::move(code)));
mc_mode = MC_MODE_SERVER;
// The initialisation function can touch argv.
- // We need to keep the original parameters in order to pass them to the
- // model-checked process so we make a copy of them:
- int argc_copy = argc;
+ // We make a copy of argv before modifying it in order to pass the original
+ // value to the model-checked:
char** argv_copy = argvdup(argc, argv);
- xbt_log_init(&argc_copy, argv_copy);
- sg_config_init(&argc_copy, argv_copy);
+ xbt_log_init(&argc, argv);
+ sg_config_init(&argc, argv);
std::unique_ptr<Session> session =
- std::unique_ptr<Session>(Session::spawnvp(argv[1], argv+1));
+ std::unique_ptr<Session>(Session::spawnvp(argv_copy[1], argv_copy+1));
+ free(argv_copy);
+
+ simgrid::mc::session = session.get();
std::unique_ptr<simgrid::mc::Checker> checker = createChecker(*session);
int res = checker->run();
session->close();