XBT_LOG_NEW_DEFAULT_SUBCATEGORY(Api, mc, "Logging specific to MC Facade APIs ");
XBT_LOG_EXTERNAL_CATEGORY(mc_global);
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
-simgrid::mc::Exploration* Api::initialize(char** argv, simgrid::mc::CheckerAlgorithm algo)
+simgrid::mc::Exploration* Api::initialize(char** argv, const std::unordered_map<std::string, std::string>& env,
+ simgrid::mc::ExplorationAlgorithm algo)
{
- session_ = std::make_unique<simgrid::mc::Session>([argv] {
+ session_ = std::make_unique<simgrid::mc::Session>([argv, &env] {
int i = 1;
while (argv[i] != nullptr && argv[i][0] == '-')
i++;
+
+ for (auto const& [key, val] : env) {
+ XBT_INFO("setenv '%s'='%s'", key.c_str(), val.c_str());
+ setenv(key.c_str(), val.c_str(), 1);
+ }
xbt_assert(argv[i] != nullptr,
"Unable to find a binary to exec on the command line. Did you only pass config flags?");
execvp(argv[i], argv + i);
simgrid::mc::Exploration* explo;
switch (algo) {
- case CheckerAlgorithm::CommDeterminism:
+ case ExplorationAlgorithm::CommDeterminism:
explo = simgrid::mc::create_communication_determinism_checker(session_.get());
break;
- case CheckerAlgorithm::UDPOR:
+ case ExplorationAlgorithm::UDPOR:
explo = simgrid::mc::create_udpor_checker(session_.get());
break;
- case CheckerAlgorithm::Safety:
- explo = simgrid::mc::create_safety_checker(session_.get());
+ case ExplorationAlgorithm::Safety:
+ explo = simgrid::mc::create_dfs_exploration(session_.get());
break;
- case CheckerAlgorithm::Liveness:
+ case ExplorationAlgorithm::Liveness:
explo = simgrid::mc::create_liveness_checker(session_.get());
break;
return explo;
}
-std::vector<simgrid::mc::ActorInformation>& Api::get_actors() const
-{
- return mc_model_checker->get_remote_process().actors();
-}
-
unsigned long Api::get_maxpid() const
{
return mc_model_checker->get_remote_process().get_maxpid();
void Api::mc_inc_visited_states() const
{
- mc_model_checker->visited_states++;
+ mc_model_checker->inc_visited_states();
}
unsigned long Api::mc_get_visited_states() const
{
- return mc_model_checker->visited_states;
+ return mc_model_checker->get_visited_states();
}
void Api::mc_exit(int status) const
mc_model_checker->exit(status);
}
-void Api::restore_state(std::shared_ptr<simgrid::mc::Snapshot> system_state) const
+void Api::restore_state(const simgrid::mc::Snapshot* system_state) const
{
system_state->restore(&mc_model_checker->get_remote_process());
}
return transition->dst;
}
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc