From: Martin Quinson Date: Tue, 21 Mar 2023 20:06:51 +0000 (+0100) Subject: Fix the liveness tests when the reforks are compiled in but not activated X-Git-Tag: v3.34~287 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3427c060e899b47c103c6981aa69afbb22378b24 Fix the liveness tests when the reforks are compiled in but not activated --- diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index 7c970ff288..7e6e4145f2 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -147,8 +147,9 @@ void AppSide::handle_finalize(const s_mc_message_int_t* msg) const if (terminate_asap) ::_Exit(0); } -void AppSide::handle_initial_addresses() const +void AppSide::handle_initial_addresses() { + this->need_memory_info_ = true; s_mc_message_initial_addresses_reply_t answer = {}; answer.type = MessageType::INITIAL_ADDRESSES_REPLY; answer.mmalloc_default_mdp = mmalloc_get_current_heap(); @@ -237,7 +238,7 @@ void AppSide::handle_actors_maxpid() const xbt_assert(received_size == sizeof(_type_), "Unexpected size for " _name_ " (%zd != %zu)", received_size, \ sizeof(_type_)) -void AppSide::handle_messages() const +void AppSide::handle_messages() { while (true) { // Until we get a CONTINUE message XBT_DEBUG("Waiting messages from model-checker"); @@ -292,7 +293,7 @@ void AppSide::handle_messages() const } } -void AppSide::main_loop() const +void AppSide::main_loop() { simgrid::mc::processes_time.resize(simgrid::kernel::actor::ActorImpl::get_maxpid()); MC_ignore_heap(simgrid::mc::processes_time.data(), @@ -308,7 +309,7 @@ void AppSide::main_loop() const } } -void AppSide::report_assertion_failure() const +void AppSide::report_assertion_failure() { xbt_assert(channel_.send(MessageType::ASSERTION_FAILED) == 0, "Could not send assertion to model-checker"); this->handle_messages(); @@ -363,8 +364,10 @@ void AppSide::unignore_heap(void* address, std::size_t size) const void AppSide::declare_symbol(const char* name, int* value) const { - if (not MC_is_active() || not need_memory_info_) + if (not MC_is_active() || not need_memory_info_) { + XBT_CRITICAL("Ignore AppSide::declare_symbol(%s)", name); return; + } s_mc_message_register_symbol_t message = {}; message.type = MessageType::REGISTER_SYMBOL; diff --git a/src/mc/remote/AppSide.hpp b/src/mc/remote/AppSide.hpp index 137c19e261..8d8a3cfbcc 100644 --- a/src/mc/remote/AppSide.hpp +++ b/src/mc/remote/AppSide.hpp @@ -27,21 +27,21 @@ private: public: AppSide(); explicit AppSide(int fd) : channel_(fd) {} - void handle_messages() const; + void handle_messages(); private: void handle_deadlock_check(const s_mc_message_t* msg) const; void handle_simcall_execute(const s_mc_message_simcall_execute_t* message) const; void handle_finalize(const s_mc_message_int_t* msg) const; - void handle_initial_addresses() const; + void handle_initial_addresses(); void handle_actors_status() const; void handle_actors_maxpid() const; public: Channel const& get_channel() const { return channel_; } Channel& get_channel() { return channel_; } - XBT_ATTRIB_NORETURN void main_loop() const; - void report_assertion_failure() const; + XBT_ATTRIB_NORETURN void main_loop(); + void report_assertion_failure(); void ignore_memory(void* addr, std::size_t size) const; void ignore_heap(void* addr, std::size_t size) const; void unignore_heap(void* addr, std::size_t size) const; diff --git a/src/mc/remote/CheckerSide.cpp b/src/mc/remote/CheckerSide.cpp index da98ad5154..a6ce4dcb5c 100644 --- a/src/mc/remote/CheckerSide.cpp +++ b/src/mc/remote/CheckerSide.cpp @@ -193,8 +193,6 @@ CheckerSide::CheckerSide(const std::vector& args, bool need_memory_intros setup_events(); wait_application_process(pid_); - wait_for_requests(); - // Request the initial memory on need if (need_memory_introspection) { channel_.send(MessageType::INITIAL_ADDRESSES); @@ -209,6 +207,8 @@ CheckerSide::CheckerSide(const std::vector& args, bool need_memory_intros /* We now have enough info to create the memory address space */ remote_memory_ = std::make_unique(pid_, answer.mmalloc_default_mdp); } + + wait_for_requests(); } CheckerSide::~CheckerSide()