X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/839aa39cec9e814fb9a6ccd5b3c3b870d25c7506..7b4766bf670b8042a39700c3f27e61b82db3d6cd:/src/mc/api.cpp diff --git a/src/mc/api.cpp b/src/mc/api.cpp index a9539193ab..f854af4da5 100644 --- a/src/mc/api.cpp +++ b/src/mc/api.cpp @@ -12,7 +12,6 @@ #include "src/mc/explo/Exploration.hpp" #include "src/mc/mc_base.hpp" #include "src/mc/mc_exit.hpp" -#include "src/mc/mc_pattern.hpp" #include "src/mc/mc_private.hpp" #include "src/mc/remote/RemoteProcess.hpp" #include "src/surf/HostImpl.hpp" @@ -28,15 +27,20 @@ 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::ExplorationAlgorithm algo) +simgrid::mc::Exploration* Api::initialize(char** argv, const std::unordered_map& env, + simgrid::mc::ExplorationAlgorithm algo) { - session_ = std::make_unique([argv] { + session_ = std::make_unique([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); @@ -69,11 +73,6 @@ simgrid::mc::Exploration* Api::initialize(char** argv, simgrid::mc::ExplorationA return explo; } -std::vector& 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(); @@ -88,12 +87,12 @@ std::size_t Api::get_remote_heap_bytes() const 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 @@ -101,7 +100,7 @@ void Api::mc_exit(int status) const mc_model_checker->exit(status); } -void Api::restore_state(std::shared_ptr system_state) const +void Api::restore_state(const simgrid::mc::Snapshot* system_state) const { system_state->restore(&mc_model_checker->get_remote_process()); } @@ -183,5 +182,4 @@ xbt_automaton_state_t Api::get_automaton_transition_dst(xbt_dynar_t const& dynar return transition->dst; } -} // namespace mc -} // namespace simgrid +} // namespace simgrid::mc