From 84c478db8780ed42a269ae1aab24e5acd07a91b3 Mon Sep 17 00:00:00 2001 From: Henri Casanova Date: Fri, 17 Nov 2023 22:10:34 -1000 Subject: [PATCH] Test fixes More mailbox removal --- include/wrench/failure_causes/NetworkError.h | 4 +- .../wrench/managers/job_manager/JobManager.h | 2 +- .../compute/batch/BatschedNetworkListener.h | 4 +- .../services/storage/StorageServiceMessage.h | 10 +- .../compound/CompoundStorageServiceMessage.h | 4 +- .../services/storage/xrootd/XRootDMessage.h | 6 +- .../S4U_PendingCommunication.h | 8 +- include/wrench/util/MessageManager.h | 10 +- src/wrench/failure_causes/NetworkError.cpp | 4 +- .../compute/batch/BatschedNetworkListener.cpp | 8 +- .../compound/CompoundStorageService.cpp | 2 +- .../simple/SimpleStorageServiceBufferized.cpp | 1 - .../FileTransferThread.cpp | 8 -- src/wrench/simgrid_S4U_util/S4U_Daemon.cpp | 2 +- .../S4U_PendingCommunication.cpp | 21 +-- src/wrench/util/MessageManager.cpp | 65 ++++----- .../MessageConstructorTest.cpp | 124 +++++++++--------- .../EnergyConsumptionTest.cpp | 10 +- test/misc/BogusMessageTest.cpp | 12 +- ...puteServiceActionsThatCommunicateTests.cpp | 4 +- ...iceBatschedQueueWaitTimePredictionTest.cpp | 2 +- test/services/helper_services/AlarmTest.cpp | 4 +- .../CompoundStorageServiceFunctionalTest.cpp | 30 ++--- .../SimpleStorageServiceFunctionalTest.cpp | 2 +- .../StorageServiceProxyBasicTest.cpp | 2 +- .../StorageServiceProxySequentialTest.cpp | 2 +- ...RootDStorageServiceBasicFunctionalTest.cpp | 2 +- .../failure_test_util/ComputerVictim.cpp | 6 +- .../failure_test_util/ComputerVictim.h | 4 +- .../failure_test_util/SleeperVictim.cpp | 6 +- .../failure_test_util/SleeperVictim.h | 4 +- .../link_failures/AlarmLinkFailuresTest.cpp | 8 +- .../SimulationCommandLineArgumentsTest.cpp | 8 +- .../src/SimulationController.cpp | 2 +- 34 files changed, 186 insertions(+), 205 deletions(-) diff --git a/include/wrench/failure_causes/NetworkError.h b/include/wrench/failure_causes/NetworkError.h index 98187932d8..e7df645a0d 100755 --- a/include/wrench/failure_causes/NetworkError.h +++ b/include/wrench/failure_causes/NetworkError.h @@ -54,12 +54,12 @@ namespace wrench { bool whileReceiving(); bool whileSending(); bool isTimeout(); - std::string getMailbox(); + std::string getCommPortName(); private: NetworkError::OperationType operation_type; NetworkError::ErrorType error_type; - std::string commport_name = ""; + std::string commport_name; }; diff --git a/include/wrench/managers/job_manager/JobManager.h b/include/wrench/managers/job_manager/JobManager.h index df7edf802b..c6f3dde51b 100755 --- a/include/wrench/managers/job_manager/JobManager.h +++ b/include/wrench/managers/job_manager/JobManager.h @@ -154,7 +154,7 @@ namespace wrench { void processPilotJobFailure(const std::shared_ptr &job, std::shared_ptr compute_service, std::shared_ptr cause); - // Mailbox of the creator of this job manager + // CommPort of the creator of this job manager S4U_CommPort *creator_commport; std::vector> jobs_to_dispatch; diff --git a/include/wrench/services/compute/batch/BatschedNetworkListener.h b/include/wrench/services/compute/batch/BatschedNetworkListener.h index 76c0445a88..8aace1d5ea 100755 --- a/include/wrench/services/compute/batch/BatschedNetworkListener.h +++ b/include/wrench/services/compute/batch/BatschedNetworkListener.h @@ -30,7 +30,7 @@ namespace wrench { public: BatschedNetworkListener(std::string hostname, std::shared_ptr batch_service, - S4U_Mailbox *batch_service_commport, std::string sched_port, + S4U_CommPort *batch_service_commport, std::string sched_port, std::string data_to_send, WRENCH_PROPERTY_COLLECTION_TYPE property_list = {}); private: @@ -50,7 +50,7 @@ namespace wrench { std::shared_ptr batch_service; S4U_Commport *batch_service_commport; - void sendExecuteMessageToBatchComputeService(simgrid::s4u::Mailbox *answer_commport, std::string execute_job_reply_data); + void sendExecuteMessageToBatchComputeService(S4U_CommPort *answer_commport, std::string execute_job_reply_data); void sendQueryAnswerMessageToBatchComputeService(double estimated_waiting_time); void send_receive(); }; diff --git a/include/wrench/services/storage/StorageServiceMessage.h b/include/wrench/services/storage/StorageServiceMessage.h index 3871d69617..3a70a76088 100755 --- a/include/wrench/services/storage/StorageServiceMessage.h +++ b/include/wrench/services/storage/StorageServiceMessage.h @@ -43,7 +43,7 @@ namespace wrench { public: StorageServiceFreeSpaceRequestMessage(S4U_CommPort *answer_commport, const std::string &path, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The path */ std::string path; @@ -69,7 +69,7 @@ namespace wrench { const std::shared_ptr &location, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The location to lookup */ std::shared_ptr location; @@ -98,7 +98,7 @@ namespace wrench { const std::shared_ptr &location, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The location to delete */ std::shared_ptr location; @@ -135,7 +135,7 @@ namespace wrench { std::shared_ptr dst, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The source location */ std::shared_ptr src; @@ -175,7 +175,7 @@ namespace wrench { double num_bytes_to_write, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The requesting host */ simgrid::s4u::Host *requesting_host; diff --git a/include/wrench/services/storage/compound/CompoundStorageServiceMessage.h b/include/wrench/services/storage/compound/CompoundStorageServiceMessage.h index 15ebcb64f1..e686cdbffe 100644 --- a/include/wrench/services/storage/compound/CompoundStorageServiceMessage.h +++ b/include/wrench/services/storage/compound/CompoundStorageServiceMessage.h @@ -37,7 +37,7 @@ namespace wrench { public: CompoundStorageAllocationRequestMessage(S4U_CommPort *answer_commport, std::shared_ptr file, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The path */ std::shared_ptr file; @@ -61,7 +61,7 @@ namespace wrench { public: CompoundStorageLookupRequestMessage(S4U_CommPort *answer_commport, std::shared_ptr file, double payload); - /** @brief Mailbox to which the answer message should be sent */ + /** @brief CommPort to which the answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The path */ std::shared_ptr file; diff --git a/include/wrench/services/storage/xrootd/XRootDMessage.h b/include/wrench/services/storage/xrootd/XRootDMessage.h index 46c8894e89..117bd05623 100755 --- a/include/wrench/services/storage/xrootd/XRootDMessage.h +++ b/include/wrench/services/storage/xrootd/XRootDMessage.h @@ -51,7 +51,7 @@ namespace wrench { std::shared_ptr answered, int timeToLive); ContinueSearchMessage(ContinueSearchMessage *toCopy); - /** @brief Mailbox to which the FINAL answer message should be sent */ + /** @brief CommPort to which the FINAL answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The original file read request that kicked off the search (if null this was a lookup request)*/ @@ -78,7 +78,7 @@ namespace wrench { double payload, std::shared_ptr answered); UpdateCacheMessage(UpdateCacheMessage &other); UpdateCacheMessage(UpdateCacheMessage *other); - /** @brief Mailbox to which the FINAL answer message should be sent */ + /** @brief CommPort to which the FINAL answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The original file read request that kicked off the search (if null this was a lookup request)*/ std::shared_ptr original; @@ -102,7 +102,7 @@ namespace wrench { bool fileReadRequest, std::shared_ptr answered); - /** @brief Mailbox to which the FINAL answer message should be sent */ + /** @brief CommPort to which the FINAL answer message should be sent */ S4U_CommPort *answer_commport; /** @brief The file being searched for */ std::shared_ptr file; diff --git a/include/wrench/simgrid_S4U_util/S4U_PendingCommunication.h b/include/wrench/simgrid_S4U_util/S4U_PendingCommunication.h index 031e14fd9b..f2ac3c8d98 100755 --- a/include/wrench/simgrid_S4U_util/S4U_PendingCommunication.h +++ b/include/wrench/simgrid_S4U_util/S4U_PendingCommunication.h @@ -39,10 +39,10 @@ namespace wrench { /** * @brief Constructor * - * @param mailbox: the S4U mailbox + * @param commport: the CommPort * @param operation_type: the operation type */ - S4U_PendingCommunication(simgrid::s4u::Mailbox *mailbox, OperationType operation_type) : s4u_mb(mailbox), operation_type(operation_type) {} + S4U_PendingCommunication(S4U_CommPort *commport, OperationType operation_type) : commport(commport), operation_type(operation_type) {} std::unique_ptr wait(); std::unique_ptr wait(double timeout); @@ -62,8 +62,8 @@ namespace wrench { /** @brief The message */ std::unique_ptr simulation_message; - /** @brief The S4U mailbox */ - simgrid::s4u::Mailbox *s4u_mb; + /** @brief The CommPort */ + S4U_CommPort *commport; /** @brief The operation type */ OperationType operation_type; }; diff --git a/include/wrench/util/MessageManager.h b/include/wrench/util/MessageManager.h index d919ccd30e..7feb838c3a 100755 --- a/include/wrench/util/MessageManager.h +++ b/include/wrench/util/MessageManager.h @@ -29,17 +29,17 @@ namespace wrench { * a message was sent but never received). That is, if messages are in flight when the receiver daemon fails, * than, because the receiver is the one freeing memory, we have memory leaks. * This takes extra time however, and many simulations never simulate failures anyway, so it's use is only optional - * at compile time. Perhaps woudl be a good idea to make its usage optional at runtime? + * at compile time. Perhaps would be a good idea to make its usage optional at runtime? */ class MessageManager { - static std::unordered_map> mailbox_messages; + static std::unordered_map> messages; public: - static void manageMessage(const std::string &commport_name, SimulationMessage *msg); - static void cleanUpMessages(const std::string &commport_name); - static void removeReceivedMessage(const std::string &commport_name, SimulationMessage *msg); + static void manageMessage(const S4U_CommPort *commport, SimulationMessage *msg); + static void cleanUpMessages(const S4U_CommPort *commport); + static void removeReceivedMessage(const S4U_CommPort *commport, SimulationMessage *msg); static void cleanUpAllMessages(); static void print(); }; diff --git a/src/wrench/failure_causes/NetworkError.cpp b/src/wrench/failure_causes/NetworkError.cpp index 1141e07a2b..2263c07139 100755 --- a/src/wrench/failure_causes/NetworkError.cpp +++ b/src/wrench/failure_causes/NetworkError.cpp @@ -63,10 +63,10 @@ namespace wrench { } /** - * @brief Returns the commport_name name on which the error occurred + * @brief Returns the name of the CommPort on which the error occurred * @return the commport_name name */ - std::string NetworkError::getMailbox() { + std::string NetworkError::getCommPortName() { return this->commport_name; } diff --git a/src/wrench/services/compute/batch/BatschedNetworkListener.cpp b/src/wrench/services/compute/batch/BatschedNetworkListener.cpp index 50f0537a89..ddef97cb5e 100644 --- a/src/wrench/services/compute/batch/BatschedNetworkListener.cpp +++ b/src/wrench/services/compute/batch/BatschedNetworkListener.cpp @@ -46,7 +46,7 @@ namespace wrench { * @param property_list: property list ({} means "use all defaults") */ BatschedNetworkListener::BatschedNetworkListener(std::string hostname, std::shared_ptr batch_service, - simgrid::s4u::Mailbox *batch_service_commport, + S4U_CommPort *batch_service_commport, std::string sched_port, std::string data_to_send, WRENCH_PROPERTY_COLLECTION_TYPE property_list) : BatschedNetworkListener(hostname, batch_service, batch_service_commport, @@ -65,7 +65,7 @@ namespace wrench { * @param suffix the suffix to append */ BatschedNetworkListener::BatschedNetworkListener( - std::string hostname, std::shared_ptr batch_service, simgrid::s4u::Mailbox *batch_service_commport, + std::string hostname, std::shared_ptr batch_service, S4U_CommPort *batch_service_commport, std::string sched_port, std::string data_to_send, WRENCH_PROPERTY_COLLECTION_TYPE property_list, std::string suffix = "") : Service(hostname, "batch_network_listener" + suffix) { @@ -102,7 +102,7 @@ namespace wrench { * @param answer_commport: commport_name on which ack will be received * @param execute_job_reply_data: message to send */ - void BatschedNetworkListener::sendExecuteMessageToBatchComputeService(simgrid::s4u::Mailbox *answer_commport, + void BatschedNetworkListener::sendExecuteMessageToBatchComputeService(S4U_CommPort *answer_commport, std::string execute_job_reply_data) { S4U_CommPort::putMessage(this->batch_service_commport, new BatchExecuteJobFromBatSchedMessage(answer_commport, execute_job_reply_data, 0)); @@ -157,7 +157,7 @@ namespace wrench { reply_decisions = nlohmann::json::parse(reply_data); decision_events = reply_decisions["events"]; - auto answer_commport = S4U_Daemon::getRunningActorRecvMailbox(); + auto answer_commport = S4U_Daemon::getRunningActorRecvCommPort(); for (auto decisions: decision_events) { std::string decision_type = decisions["type"]; double decision_timestamp = decisions["timestamp"]; diff --git a/src/wrench/services/storage/compound/CompoundStorageService.cpp b/src/wrench/services/storage/compound/CompoundStorageService.cpp index 0e95b609d7..b426d3bc38 100644 --- a/src/wrench/services/storage/compound/CompoundStorageService.cpp +++ b/src/wrench/services/storage/compound/CompoundStorageService.cpp @@ -309,7 +309,7 @@ namespace wrench { * @return A vector of shared_ptr on a FileLocation if the DataFile is known to the CompoundStorageService or empty vector if it's not. */ std::vector> CompoundStorageService::lookupFileLocation(const std::shared_ptr &file, S4U_CommPort *answer_commport) { - WRENCH_INFO("CSS::lookupFileLocation() - DataFile + Mailbox"); + WRENCH_INFO("CSS::lookupFileLocation() - DataFile + CommPort"); this->commport->putMessage( new CompoundStorageLookupRequestMessage( diff --git a/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp b/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp index 0ff8c00cf6..e3ab0b3933 100755 --- a/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp +++ b/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp @@ -221,7 +221,6 @@ namespace wrench { // Generate a commport_name name on which to receive the file auto file_reception_commport = S4U_CommPort::getTemporaryCommPort(); - // auto file_reception_commport = S4U_CommPort::generateUniqueMailbox("faa_does_not_work"); // Reply with a "go ahead, send me the file" message answer_commport->dputMessage( diff --git a/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp b/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp index 12d0d52b61..74b7b28c21 100755 --- a/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp +++ b/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp @@ -519,14 +519,6 @@ namespace wrench { // Send a message to the source auto request_answer_commport = S4U_Daemon::getRunningActorRecvCommPort(); - // auto commport_that_should_receive_file_content = S4U_CommPort::generateUniqueMailbox("works_by_itself"); - - // S4U_CommPort *commport_that_should_receive_file_content; - // if (src_loc->getStorageService()->buffer_size > DBL_EPSILON) { - // commport_that_should_receive_file_content = S4U_CommPort::getTemporaryCommPort(); - // } else { - // commport_that_should_receive_file_content = nullptr; - // } src_loc->getStorageService()->commport->putMessage( new StorageServiceFileReadRequestMessage( diff --git a/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp b/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp index 4c4a393311..6e1ab3f54e 100755 --- a/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp +++ b/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp @@ -231,7 +231,7 @@ namespace wrench { if ((S4U_Daemon::num_non_daemonized_actors_running == 0) or (not this->isSetToAutoRestart())) { // Service::increaseNumCompletedServicesCount(); #ifdef MESSAGE_MANAGER - MessageManager::cleanUpMessages(this->commport_name); + MessageManager::cleanUpMessages(this->commport); #endif this->deleteLifeSaver(); } diff --git a/src/wrench/simgrid_S4U_util/S4U_PendingCommunication.cpp b/src/wrench/simgrid_S4U_util/S4U_PendingCommunication.cpp index 30c5f64520..18649cdde7 100755 --- a/src/wrench/simgrid_S4U_util/S4U_PendingCommunication.cpp +++ b/src/wrench/simgrid_S4U_util/S4U_PendingCommunication.cpp @@ -43,12 +43,15 @@ namespace wrench { } catch (simgrid::NetworkFailureException &e) { if (this->operation_type == S4U_PendingCommunication::OperationType::SENDING) { throw ExecutionException(std::make_shared( - NetworkError::OperationType::SENDING, NetworkError::FAILURE, s4u_mb->get_name())); + NetworkError::OperationType::SENDING, NetworkError::FAILURE, this->commport->s4u_mb->get_name())); } else { throw ExecutionException(std::make_shared( - NetworkError::OperationType::RECEIVING, NetworkError::FAILURE, s4u_mb->get_name())); + NetworkError::OperationType::RECEIVING, NetworkError::FAILURE, this->commport->s4u_mb->get_name())); } } +#ifdef MESSAGE_MANAGER + MessageManager::removeReceivedMessage(this->commport, this->simulation_message.get()); +#endif return std::move(this->simulation_message); } @@ -68,20 +71,23 @@ namespace wrench { } catch (simgrid::NetworkFailureException &e) { if (this->operation_type == S4U_PendingCommunication::OperationType::SENDING) { throw ExecutionException(std::make_shared( - NetworkError::OperationType::SENDING, NetworkError::FAILURE, s4u_mb->get_name())); + NetworkError::OperationType::SENDING, NetworkError::FAILURE, this->commport->s4u_mb->get_name())); } else { throw ExecutionException(std::make_shared( - NetworkError::OperationType::RECEIVING, NetworkError::FAILURE, s4u_mb->get_name())); + NetworkError::OperationType::RECEIVING, NetworkError::FAILURE, this->commport->s4u_mb->get_name())); } } catch (simgrid::TimeoutException &e) { if (this->operation_type == S4U_PendingCommunication::OperationType::SENDING) { throw ExecutionException(std::make_shared( - NetworkError::OperationType::SENDING, NetworkError::TIMEOUT, s4u_mb->get_name())); + NetworkError::OperationType::SENDING, NetworkError::TIMEOUT, this->commport->s4u_mb->get_name())); } else { throw ExecutionException(std::make_shared( - NetworkError::OperationType::RECEIVING, NetworkError::TIMEOUT, s4u_mb->get_name())); + NetworkError::OperationType::RECEIVING, NetworkError::TIMEOUT, this->commport->s4u_mb->get_name())); } } +#ifdef MESSAGE_MANAGER + MessageManager::removeReceivedMessage(this->commport, this->simulation_message.get()); +#endif return std::move(this->simulation_message); } @@ -139,9 +145,6 @@ namespace wrench { simgrid::s4u::ActivityPtr finished_activity = nullptr; try { finished_activity = pending_activities.wait_any_for(timeout); -#ifdef MESSAGE_MANAGER - MessageManager::removeReceivedMessage(pending_comms[index]->mailbox_name, pending_comms[index]->simulation_message.get()); -#endif } catch (simgrid::Exception &e) { auto failed_activity = pending_activities.get_failed_activity(); for (unsigned long idx = 0; idx < pending_comms.size(); idx++ ) { diff --git a/src/wrench/util/MessageManager.cpp b/src/wrench/util/MessageManager.cpp index 9c1046ba49..eca13b8ec3 100755 --- a/src/wrench/util/MessageManager.cpp +++ b/src/wrench/util/MessageManager.cpp @@ -21,37 +21,37 @@ namespace wrench { // TODO: At some point, we may want to make this with only unique pointers... - std::unordered_map> MessageManager::mailbox_messages = {}; + std::unordered_map> MessageManager::messages = {}; /** * @brief Insert a message in the manager's "database" - * @param commport_name: the name of the relevant commport_name + * @param commport: the name of the relevant commport * @param msg: the message * @throw std::runtime_error */ - void MessageManager::manageMessage(const std::string &commport_name, SimulationMessage *msg) { + void MessageManager::manageMessage(const S4U_CommPort *commport, SimulationMessage *msg) { if (msg == nullptr) { throw std::runtime_error( "MessageManager::manageMessage()::Null Message cannot be managed by MessageManager"); } - if (mailbox_messages.find(commport_name) == mailbox_messages.end()) { - mailbox_messages.insert({commport_name, {}}); + if (messages.find(commport) == messages.end()) { + messages.insert({commport, {}}); } - mailbox_messages[commport_name].insert(msg); - // WRENCH_INFO("MESSAGE_MANAGER: INSERTING [%s]:%s (%lu)", commport_name.c_str(), msg->getName().c_str(), (unsigned long)msg); + messages[commport].insert(msg); + // WRENCH_INFO("MESSAGE_MANAGER: INSERTING [%s]:%s (%lu)", commport.c_str(), msg->getName().c_str(), (unsigned long)msg); } /** - * @brief Clean up messages for a given commport_name (so as to free up memory_manager_service) - * @param commport_name: the commport_name name + * @brief Clean up messages for a given commport (so as to free up memory_manager_service) + * @param commport: the commport name */ - void MessageManager::cleanUpMessages(const std::string &commport_name) { - if (mailbox_messages.find(commport_name) != mailbox_messages.end()) { - for (auto msg: mailbox_messages[commport_name]) { + void MessageManager::cleanUpMessages(const S4U_CommPort *commport) { + if (messages.find(commport) != messages.end()) { + for (auto msg: messages[commport]) { delete msg; } - mailbox_messages[commport_name].clear(); - mailbox_messages.erase(commport_name); + messages[commport].clear(); + messages.erase(commport); } } @@ -59,7 +59,7 @@ namespace wrench { * @brief Clean up all the messages that MessageManager has stored (so as to free up memory_manager_service) */ void MessageManager::cleanUpAllMessages() { - for (auto m: mailbox_messages) { + for (auto const &m: messages) { cleanUpMessages(m.first); } } @@ -69,41 +69,28 @@ namespace wrench { */ void MessageManager::print() { WRENCH_INFO("MessageManager DB:"); - for (auto const &x: mailbox_messages) { - WRENCH_INFO(" ==> [%s]:%lu", x.first.c_str(), x.second.size()); + for (auto const &m: messages) { + WRENCH_INFO(" ==> [%s]:%lu", m.first->get_cname(), m.second.size()); } } /** * @brief Remove a received message from the "database" of messages - * @param commport_name: the name of the commport_name from which the message was received + * @param commport: the name of the commport from which the message was received * @param msg: the message */ - void MessageManager::removeReceivedMessage(const std::string &commport_name, SimulationMessage *msg) { - // if (mailbox_messages.find(commport_name) != mailbox_messages.end()) { - // if (mailbox_messages[commport_name].find(msg) != mailbox_messages[commport_name].end()) { - // WRENCH_INFO("MESSAGE_MANAGER: REMOVING [%s]:%s (%lu)", commport_name.c_str(), msg->getName().c_str(), (unsigned long)msg); - mailbox_messages[commport_name].erase(msg); - // if (mailbox_messages[commport_name].empty()) { - // mailbox_messages.erase(commport_name); + void MessageManager::removeReceivedMessage(const S4U_CommPort *commport, SimulationMessage *msg) { + // if (messages.find(commport) != messages.end()) { + // if (messages[commport].find(msg) != messages[commport].end()) { + // WRENCH_INFO("MESSAGE_MANAGER: REMOVING [%s]:%s (%lu)", commport.c_str(), msg->getName().c_str(), (unsigned long)msg); + messages[commport].erase(msg); + // if (messages[commport].empty()) { + // messages.erase(commport); // } // } // } -#if 0 - std::map>::iterator msg_itr; - for (msg_itr = mailbox_messages.begin(); msg_itr != mailbox_messages.end(); msg_itr++) { - if ((*msg_itr).first == commport_name) { - std::vector::iterator it; - for (it = (*msg_itr).second.begin(); it != (*msg_itr).second.end(); it++) { - if ((*it) == msg) { - it = (*msg_itr).second.erase(it); - break; - } - } - } - } -#endif + } }// namespace wrench diff --git a/test/constructors/simulation_message_constructors/MessageConstructorTest.cpp b/test/constructors/simulation_message_constructors/MessageConstructorTest.cpp index f818a5cf9d..0a8ae31639 100755 --- a/test/constructors/simulation_message_constructors/MessageConstructorTest.cpp +++ b/test/constructors/simulation_message_constructors/MessageConstructorTest.cpp @@ -120,11 +120,11 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { auto compute_service = this->test->compute_service; auto storage_service = this->test->storage_service; auto failure_cause = std::shared_ptr(new wrench::FatalFailure("msg")); - auto mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); + auto commport = wrench::S4U_CommPort::getTemporaryCommPort(); auto network_proximity_daemon = std::shared_ptr( new wrench::NetworkProximityDaemon(this->simulation, "Host1", - mailbox, + commport, 10.0, 1.0, 1.0, 0, {})); auto batch_job = std::make_shared(compound_job, 1, 10, 1, @@ -143,26 +143,26 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_THROW(new wrench::SimulationMessage(-1), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::FileRegistryFileLookupRequestMessage(mailbox, file, 666)); + CUSTOM_NO_THROW(new wrench::FileRegistryFileLookupRequestMessage(commport, file, 666)); CUSTOM_THROW(new wrench::FileRegistryFileLookupRequestMessage(nullptr, file, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::FileRegistryFileLookupRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::FileRegistryFileLookupRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::FileRegistryFileLookupAnswerMessage({location}, 666)); // CUSTOM_THROW(new wrench::FileRegistryFileLookupAnswerMessage({}, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::FileRegistryRemoveEntryRequestMessage(mailbox, location, 666)); + CUSTOM_NO_THROW(new wrench::FileRegistryRemoveEntryRequestMessage(commport, location, 666)); CUSTOM_THROW(new wrench::FileRegistryRemoveEntryRequestMessage(nullptr, location, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::FileRegistryRemoveEntryRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::FileRegistryRemoveEntryRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::FileRegistryRemoveEntryAnswerMessage(true, 666)); - CUSTOM_NO_THROW(new wrench::FileRegistryAddEntryRequestMessage(mailbox, location, 666)); + CUSTOM_NO_THROW(new wrench::FileRegistryAddEntryRequestMessage(commport, location, 666)); CUSTOM_THROW(new wrench::FileRegistryAddEntryRequestMessage(nullptr, location, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::FileRegistryAddEntryRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::FileRegistryAddEntryRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::FileRegistryAddEntryAnswerMessage(666)); - CUSTOM_NO_THROW(new wrench::FileRegistryFileLookupByProximityRequestMessage(mailbox, file, "reference_host", + CUSTOM_NO_THROW(new wrench::FileRegistryFileLookupByProximityRequestMessage(commport, file, "reference_host", this->test->network_proximity_service, 666)); CUSTOM_THROW(new wrench::FileRegistryFileLookupByProximityRequestMessage(nullptr, file, "reference_host", network_proximity_service, 666), @@ -196,9 +196,9 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_THROW(new wrench::ComputeServiceCompoundJobFailedMessage(nullptr, compute_service, 666), std::invalid_argument); CUSTOM_THROW(new wrench::ComputeServiceCompoundJobFailedMessage(compound_job, nullptr, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::ComputeServiceTerminateCompoundJobRequestMessage(mailbox, compound_job, 666)); + CUSTOM_NO_THROW(new wrench::ComputeServiceTerminateCompoundJobRequestMessage(commport, compound_job, 666)); CUSTOM_THROW(new wrench::ComputeServiceTerminateCompoundJobRequestMessage(nullptr, compound_job, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::ComputeServiceTerminateCompoundJobRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::ComputeServiceTerminateCompoundJobRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::ComputeServiceTerminateCompoundJobAnswerMessage(compound_job, compute_service, true, nullptr, 666)); CUSTOM_NO_THROW(new wrench::ComputeServiceTerminateCompoundJobAnswerMessage(compound_job, compute_service, false, failure_cause, 666)); @@ -208,14 +208,14 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_THROW(new wrench::ComputeServiceTerminateCompoundJobAnswerMessage(compound_job, compute_service, false, nullptr, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::ComputeServiceResourceInformationRequestMessage(mailbox, "stuff", 666)); + CUSTOM_NO_THROW(new wrench::ComputeServiceResourceInformationRequestMessage(commport, "stuff", 666)); CUSTOM_THROW(new wrench::ComputeServiceResourceInformationRequestMessage(nullptr, "stuff", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::ComputeServiceResourceInformationRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::ComputeServiceResourceInformationRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::ComputeServiceResourceInformationAnswerMessage({std::map({{"aa", 2.3}, {"bb", 4.5}})}, 666)); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceGetExecutionHostsRequestMessage(mailbox, 600)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceGetExecutionHostsRequestMessage(commport, 600)); CUSTOM_THROW(new wrench::CloudComputeServiceGetExecutionHostsRequestMessage(nullptr, 666), std::invalid_argument); std::vector arg; @@ -224,66 +224,66 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { std::map property_list; std::map messagepayload_list; - CUSTOM_NO_THROW(new wrench::CloudComputeServiceCreateVMRequestMessage(mailbox, 42, 10, "stuff", {}, {}, 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceCreateVMRequestMessage(commport, 42, 10, "stuff", {}, {}, 666)); CUSTOM_THROW( new wrench::CloudComputeServiceCreateVMRequestMessage(nullptr, 42, 0, "stuff", {}, {}, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(mailbox, "host", "host", 666)); + CUSTOM_NO_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(commport, "host", "host", 666)); CUSTOM_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(nullptr, "host", "host", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(mailbox, "", "host", 666), + CUSTOM_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(commport, "", "host", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(mailbox, "host", "", 666), + CUSTOM_THROW(new wrench::VirtualizedClusterComputeServiceMigrateVMRequestMessage(commport, "host", "", 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceShutdownVMRequestMessage(mailbox, "vm", false, wrench::ComputeService::TerminationCause::TERMINATION_NONE, 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceShutdownVMRequestMessage(commport, "vm", false, wrench::ComputeService::TerminationCause::TERMINATION_NONE, 666)); CUSTOM_THROW(new wrench::CloudComputeServiceShutdownVMRequestMessage(nullptr, "vm", false, wrench::ComputeService::TerminationCause::TERMINATION_NONE, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CloudComputeServiceShutdownVMRequestMessage(mailbox, "", false, wrench::ComputeService::TerminationCause::TERMINATION_NONE, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CloudComputeServiceShutdownVMRequestMessage(commport, "", false, wrench::ComputeService::TerminationCause::TERMINATION_NONE, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CloudComputeServiceShutdownVMAnswerMessage(true, nullptr, 666)); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceStartVMRequestMessage(mailbox, "vm", 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceStartVMRequestMessage(commport, "vm", 666)); CUSTOM_THROW(new wrench::CloudComputeServiceStartVMRequestMessage(nullptr, "vm", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CloudComputeServiceStartVMRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CloudComputeServiceStartVMRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CloudComputeServiceStartVMAnswerMessage(true, nullptr, nullptr, 666)); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceSuspendVMRequestMessage(mailbox, "vm", 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceSuspendVMRequestMessage(commport, "vm", 666)); CUSTOM_THROW(new wrench::CloudComputeServiceSuspendVMRequestMessage(nullptr, "vm", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CloudComputeServiceSuspendVMRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CloudComputeServiceSuspendVMRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CloudComputeServiceSuspendVMAnswerMessage(true, nullptr, 666)); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceResumeVMRequestMessage(mailbox, "vm", 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceResumeVMRequestMessage(commport, "vm", 666)); CUSTOM_THROW(new wrench::CloudComputeServiceResumeVMRequestMessage(nullptr, "vm", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CloudComputeServiceResumeVMRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CloudComputeServiceResumeVMRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CloudComputeServiceResumeVMAnswerMessage(true, nullptr, 666)); - CUSTOM_NO_THROW(new wrench::CloudComputeServiceDestroyVMRequestMessage(mailbox, "vm", 666)); + CUSTOM_NO_THROW(new wrench::CloudComputeServiceDestroyVMRequestMessage(commport, "vm", 666)); CUSTOM_THROW(new wrench::CloudComputeServiceDestroyVMRequestMessage(nullptr, "vm", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CloudComputeServiceDestroyVMRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CloudComputeServiceDestroyVMRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CloudComputeServiceDestroyVMAnswerMessage(true, nullptr, 666)); - CUSTOM_NO_THROW(new wrench::StorageServiceFreeSpaceRequestMessage(mailbox, "/", 666)); - CUSTOM_NO_THROW(new wrench::StorageServiceFreeSpaceRequestMessage(mailbox, "", 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFreeSpaceRequestMessage(commport, "/", 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFreeSpaceRequestMessage(commport, "", 666)); CUSTOM_THROW(new wrench::StorageServiceFreeSpaceRequestMessage(nullptr, "/", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::StorageServiceFreeSpaceAnswerMessage(1000, 666)); CUSTOM_THROW(new wrench::StorageServiceFreeSpaceAnswerMessage(-10, 666), std::invalid_argument); std::string root_dir = "/"; - CUSTOM_NO_THROW(new wrench::StorageServiceFileLookupRequestMessage(mailbox, location, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileLookupRequestMessage(commport, location, 666)); CUSTOM_THROW(new wrench::StorageServiceFileLookupRequestMessage(nullptr, location, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileLookupRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileLookupRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::StorageServiceFileLookupAnswerMessage(file, true, 666)); CUSTOM_THROW(new wrench::StorageServiceFileLookupAnswerMessage(nullptr, true, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileDeleteRequestMessage(mailbox, location, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileDeleteRequestMessage(commport, location, 666)); CUSTOM_THROW(new wrench::StorageServiceFileDeleteRequestMessage(nullptr, location, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileDeleteRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileDeleteRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::StorageServiceFileDeleteAnswerMessage(file, storage_service, true, nullptr, 666)); CUSTOM_NO_THROW(new wrench::StorageServiceFileDeleteAnswerMessage(file, storage_service, false, failure_cause, 666)); @@ -296,10 +296,10 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_THROW(new wrench::StorageServiceFileDeleteAnswerMessage(file, storage_service, true, failure_cause, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileCopyRequestMessage(mailbox, location, location, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileCopyRequestMessage(commport, location, location, 666)); CUSTOM_THROW(new wrench::StorageServiceFileCopyRequestMessage(nullptr, location, location, nullptr, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileCopyRequestMessage(mailbox, nullptr, location, nullptr, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileCopyRequestMessage(mailbox, location, nullptr, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileCopyRequestMessage(commport, nullptr, location, nullptr, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileCopyRequestMessage(commport, location, nullptr, nullptr, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::StorageServiceFileCopyAnswerMessage(location, location, true, nullptr, 666)); CUSTOM_NO_THROW(new wrench::StorageServiceFileCopyAnswerMessage(location, location, false, failure_cause, 666)); @@ -309,37 +309,37 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_THROW(new wrench::StorageServiceFileCopyAnswerMessage(location, nullptr, nullptr, false, false, nullptr, 666), std::invalid_argument); CUSTOM_THROW(new wrench::StorageServiceFileCopyAnswerMessage(location, nullptr, nullptr, false, true, failure_cause, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileWriteRequestMessage(mailbox, (simgrid::s4u::Host *) 666, location, 1024, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileWriteRequestMessage(commport, (simgrid::s4u::Host *) 666, location, 1024, 666)); CUSTOM_THROW(new wrench::StorageServiceFileWriteRequestMessage(nullptr, (simgrid::s4u::Host *) 666, location, 10, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileWriteRequestMessage(mailbox, nullptr, location, 10, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileWriteRequestMessage(mailbox, (simgrid::s4u::Host *) 666, nullptr, 10, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileWriteRequestMessage(commport, nullptr, location, 10, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileWriteRequestMessage(commport, (simgrid::s4u::Host *) 666, nullptr, 10, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, true, nullptr, {{mailbox, 0.0}}, 10, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, true, nullptr, {{commport, 0.0}}, 10, 666)); CUSTOM_NO_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, false, failure_cause, {{nullptr, 0.0}}, 10, 666)); - CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(nullptr, true, nullptr, mailbox, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(nullptr, true, nullptr, commport, 666), std::invalid_argument); CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, true, nullptr, nullptr, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, true, failure_cause, mailbox, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, false, nullptr, mailbox, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, true, failure_cause, commport, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileWriteAnswerMessage(location, false, nullptr, commport, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileReadRequestMessage(mailbox, (simgrid::s4u::Host *) 666, location, 10, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileReadRequestMessage(commport, (simgrid::s4u::Host *) 666, location, 10, 666)); CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(nullptr, (simgrid::s4u::Host *) 666, location, 10, 10, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(mailbox, (simgrid::s4u::Host *) 666, location, 10, 10, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(mailbox, (simgrid::s4u::Host *) 666, nullptr, 10, 10, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(mailbox, (simgrid::s4u::Host *) 666, location, -1.0, 10, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(commport, (simgrid::s4u::Host *) 666, location, 10, 10, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(commport, (simgrid::s4u::Host *) 666, nullptr, 10, 10, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileReadRequestMessage(commport, (simgrid::s4u::Host *) 666, location, -1.0, 10, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, true, nullptr, mailbox, 10, 1, 666)); - CUSTOM_NO_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, false, failure_cause, mailbox, 0, 1, 666)); - CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(nullptr, true, nullptr, mailbox, 10, 1, 1, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, true, failure_cause, mailbox, 10, 1, 1, 666), std::invalid_argument); - CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, false, nullptr, mailbox, 10, 1, 1, 666), std::invalid_argument); + CUSTOM_NO_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, true, nullptr, commport, 10, 1, 666)); + CUSTOM_NO_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, false, failure_cause, commport, 0, 1, 666)); + CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(nullptr, true, nullptr, commport, 10, 1, 1, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, true, failure_cause, commport, 10, 1, 1, 666), std::invalid_argument); + CUSTOM_THROW(new wrench::StorageServiceFileReadAnswerMessage(location, false, nullptr, commport, 10, 1, 1, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::StorageServiceFileContentChunkMessage(file, 666, true)); CUSTOM_THROW(new wrench::StorageServiceFileContentChunkMessage(nullptr, 666, true), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::NetworkProximityLookupRequestMessage(mailbox, std::make_pair("a", "b"), 666)); + CUSTOM_NO_THROW(new wrench::NetworkProximityLookupRequestMessage(commport, std::make_pair("a", "b"), 666)); CUSTOM_THROW(new wrench::NetworkProximityLookupRequestMessage(nullptr, std::make_pair("a", "b"), 666), std::invalid_argument); - CUSTOM_THROW(new wrench::NetworkProximityLookupRequestMessage(mailbox, std::make_pair("", "b"), 666), std::invalid_argument); - CUSTOM_THROW(new wrench::NetworkProximityLookupRequestMessage(mailbox, std::make_pair("a", ""), 666), std::invalid_argument); + CUSTOM_THROW(new wrench::NetworkProximityLookupRequestMessage(commport, std::make_pair("", "b"), 666), std::invalid_argument); + CUSTOM_THROW(new wrench::NetworkProximityLookupRequestMessage(commport, std::make_pair("a", ""), 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::NetworkProximityLookupAnswerMessage(std::make_pair("a", "b"), 1.0, 1.0, 666)); CUSTOM_THROW(new wrench::NetworkProximityLookupAnswerMessage(std::make_pair("", "b"), 1.0, 1.0, 666), std::invalid_argument); @@ -352,21 +352,21 @@ class MessageConstructorTestWMS : public wrench::ExecutionController { CUSTOM_NO_THROW(new wrench::NextContactDaemonRequestMessage(network_proximity_daemon, 666)); CUSTOM_THROW(new wrench::NextContactDaemonRequestMessage(nullptr, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::CoordinateLookupRequestMessage(mailbox, "requested_host", 666)); + CUSTOM_NO_THROW(new wrench::CoordinateLookupRequestMessage(commport, "requested_host", 666)); CUSTOM_THROW(new wrench::CoordinateLookupRequestMessage(nullptr, "requested_host", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::CoordinateLookupRequestMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::CoordinateLookupRequestMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::CoordinateLookupAnswerMessage("requested_host", true, std::make_pair(1.0, 1.0), 1.0, 666)); CUSTOM_THROW(new wrench::CoordinateLookupAnswerMessage("", true, std::make_pair(1.0, 1.0), 1.0, 666), std::invalid_argument); - CUSTOM_NO_THROW(new wrench::BatchExecuteJobFromBatSchedMessage(mailbox, "string", 666)); + CUSTOM_NO_THROW(new wrench::BatchExecuteJobFromBatSchedMessage(commport, "string", 666)); CUSTOM_THROW(new wrench::BatchExecuteJobFromBatSchedMessage(nullptr, "string", 666), std::invalid_argument); - CUSTOM_THROW(new wrench::BatchExecuteJobFromBatSchedMessage(mailbox, "", 666), std::invalid_argument); + CUSTOM_THROW(new wrench::BatchExecuteJobFromBatSchedMessage(commport, "", 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::BatchQueryAnswerMessage(1.0, 666)); - CUSTOM_NO_THROW(new wrench::BatchComputeServiceJobRequestMessage(mailbox, batch_job, 666)); - CUSTOM_THROW(new wrench::BatchComputeServiceJobRequestMessage(mailbox, nullptr, 666), std::invalid_argument); + CUSTOM_NO_THROW(new wrench::BatchComputeServiceJobRequestMessage(commport, batch_job, 666)); + CUSTOM_THROW(new wrench::BatchComputeServiceJobRequestMessage(commport, nullptr, 666), std::invalid_argument); CUSTOM_THROW(new wrench::BatchComputeServiceJobRequestMessage(nullptr, batch_job, 666), std::invalid_argument); CUSTOM_NO_THROW(new wrench::AlarmJobTimeOutMessage(batch_job, 666)); CUSTOM_THROW(new wrench::AlarmJobTimeOutMessage(nullptr, 666), std::invalid_argument); diff --git a/test/energy_consumption/EnergyConsumptionTest.cpp b/test/energy_consumption/EnergyConsumptionTest.cpp index 848e256f69..dc48bbdd37 100755 --- a/test/energy_consumption/EnergyConsumptionTest.cpp +++ b/test/energy_consumption/EnergyConsumptionTest.cpp @@ -165,7 +165,7 @@ class EnergyApiAccessExceptionsTestWMS : public wrench::ExecutionController { //sleep for 10 seconds wrench::S4U_Simulation::sleep(10); //let's execute the job, this should take ~100 sec based on the 100MF speed - std::string my_mailbox = "test_callback_mailbox"; + std::string my_commport = "test_callback_commport"; job_manager->submitJob(job, this->test->compute_service); this->waitForAndProcessNextEvent(); @@ -337,7 +337,7 @@ class EnergyApiAccessExceptionsPluginNotActiveTestWMS : public wrench::Execution //sleep for 10 seconds wrench::S4U_Simulation::sleep(10); //let's execute the job, this should take ~100 sec based on the 100MF speed - std::string my_mailbox = "test_callback_mailbox"; + std::string my_commport = "test_callback_commport"; job_manager->submitJob(job, this->test->compute_service); this->waitForAndProcessNextEvent(); @@ -491,7 +491,7 @@ class EnergyConsumptionTestWMS : public wrench::ExecutionController { //sleep for 10 seconds wrench::S4U_Simulation::sleep(10); //let's execute the job, this should take ~100 sec based on the 100MF speed - std::string my_mailbox = "test_callback_mailbox"; + std::string my_commport = "test_callback_commport"; double before = wrench::S4U_Simulation::getClock(); job_manager->submitJob(job, this->test->compute_service); @@ -768,7 +768,7 @@ class EnergyConsumptionPStateChangeTestWMS : public wrench::ExecutionController double before_current_energy_consumed_by_host1 = this->simulation->getEnergyConsumed(simulation_hosts[1]); //run a new job //let's execute the job, this should take ~100 sec based on the 100MF speed - std::string my_mailbox = "test_callback_mailbox"; + std::string my_commport = "test_callback_commport"; job_manager->submitJob(job1, this->test->compute_service); this->waitForAndProcessNextEvent(); @@ -792,7 +792,7 @@ class EnergyConsumptionPStateChangeTestWMS : public wrench::ExecutionController double before_current_energy_consumed_by_host2 = this->simulation->getEnergyConsumed(simulation_hosts[1]); //run a new job //let's execute the job, this should take ~100 sec based on the 100MF speed - my_mailbox = "test_callback_mailbox"; + my_commport = "test_callback_commport"; job_manager->submitJob(job2, this->test->compute_service); this->waitForAndProcessNextEvent(); diff --git a/test/misc/BogusMessageTest.cpp b/test/misc/BogusMessageTest.cpp index a6426f38d5..d52579c503 100755 --- a/test/misc/BogusMessageTest.cpp +++ b/test/misc/BogusMessageTest.cpp @@ -22,7 +22,7 @@ class BogusMessageTest : public ::testing::Test { public: std::shared_ptr service = nullptr; - wrench::S4U_CommPort *dst_mailbox; + wrench::S4U_CommPort *dst_commport; void do_BogusMessage_Test(std::string service_type); @@ -133,7 +133,7 @@ class BogusMessageTestWMS : public wrench::ExecutionController { int main() override { wrench::Simulation::sleep(1000); try { - this->test->dst_mailbox->putMessage(new BogusMessage()); + this->test->dst_commport->putMessage(new BogusMessage()); } catch (std::runtime_error &e) { } return 0; @@ -157,7 +157,7 @@ class NoopWMS : public wrench::ExecutionController { if (this->create_data_movement_manager) { auto dmm = this->createDataMovementManager(); - this->test->dst_mailbox = dmm->commport; + this->test->dst_commport = dmm->commport; } this->waitForAndProcessNextEvent(); return 0; @@ -203,14 +203,14 @@ void BogusMessageTest::do_BogusMessage_Test(std::string service_type) { // Create a service if (service_type == "file_registry") { this->service = simulation->add(new wrench::FileRegistryService(hostname)); - this->dst_mailbox = this->service->commport; + this->dst_commport = this->service->commport; } else if (service_type == "simple_storage") { this->service = simulation->add(wrench::SimpleStorageService::createSimpleStorageService(hostname, {"/"})); - this->dst_mailbox = this->service->commport; + this->dst_commport = this->service->commport; } else if (service_type == "data_movement_manager") { auto wms = new NoopWMS(this, hostname, true); this->service = simulation->add(wms); - this->dst_mailbox = nullptr;// Will be set by the WMS on DMM is created + this->dst_commport = nullptr;// Will be set by the WMS on DMM is created } // Create the Bogus Message WMS diff --git a/test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceActionsThatCommunicateTests.cpp b/test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceActionsThatCommunicateTests.cpp index 4ad7acc12b..e03115b225 100755 --- a/test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceActionsThatCommunicateTests.cpp +++ b/test/services/compute_services/bare_metal_compound_jobs/BareMetalComputeServiceActionsThatCommunicateTests.cpp @@ -181,7 +181,7 @@ void BareMetalComputeServiceActionsThatCommunicateTest::do_TwoCommunicatingActio auto argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); - // argv[2] = strdup("--log=wrench_core_mailbox.threshold:debug"); + // argv[2] = strdup("--log=wrench_core_commport.threshold:debug"); simulation->init(&argc, argv); @@ -308,7 +308,7 @@ void BareMetalComputeServiceActionsThatCommunicateTest::do_MPICollectives_test() argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); // argv[2] = strdup("--cfg=smpi/host-speed:0.001"); - // argv[2] = strdup("--log=wrench_core_mailbox.threshold:debug"); + // argv[2] = strdup("--log=wrench_core_commport.threshold:debug"); simulation->init(&argc, argv); diff --git a/test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceBatschedQueueWaitTimePredictionTest.cpp b/test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceBatschedQueueWaitTimePredictionTest.cpp index 69431d783f..8c7f46b07c 100755 --- a/test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceBatschedQueueWaitTimePredictionTest.cpp +++ b/test/services/compute_services/batch_standard_and_pilot_jobs/BatchServiceBatschedQueueWaitTimePredictionTest.cpp @@ -615,7 +615,7 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobEstimateWaiting auto argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); - // argv[2] = strdup("--log=wrench_core_mailbox.t:debug"); + // argv[2] = strdup("--log=wrench_core_commport.t:debug"); ASSERT_NO_THROW(simulation->init(&argc, argv)); diff --git a/test/services/helper_services/AlarmTest.cpp b/test/services/helper_services/AlarmTest.cpp index 379fd81afc..1d87031576 100755 --- a/test/services/helper_services/AlarmTest.cpp +++ b/test/services/helper_services/AlarmTest.cpp @@ -92,9 +92,9 @@ class AlarmDownHostTestWMS : public wrench::ExecutionController { wrench::Simulation::turnOffHost("Host2"); // Start an alarm - auto mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); + auto commport = wrench::S4U_CommPort::getTemporaryCommPort(); try { - wrench::Alarm::createAndStartAlarm(this->simulation, 10.0, "Host2", mailbox, + wrench::Alarm::createAndStartAlarm(this->simulation, 10.0, "Host2", commport, new wrench::SimulationMessage(1), "bogus"); throw std::runtime_error("Should not be able to create an alarm on a down host"); } catch (wrench::ExecutionException &e) { diff --git a/test/services/storage_services/CompoundStorageService/CompoundStorageServiceFunctionalTest.cpp b/test/services/storage_services/CompoundStorageService/CompoundStorageServiceFunctionalTest.cpp index 9adf53a812..2cc7588dde 100644 --- a/test/services/storage_services/CompoundStorageService/CompoundStorageServiceFunctionalTest.cpp +++ b/test/services/storage_services/CompoundStorageService/CompoundStorageServiceFunctionalTest.cpp @@ -255,8 +255,8 @@ class CSSCopyToCSSTestCtrl : public wrench::ExecutionController { } // Check that all file copies worked as intended - auto tmp_mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); - auto read_file_copy_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_mailbox); + auto tmp_commport = wrench::S4U_CommPort::getTemporaryCommPort(); + auto read_file_copy_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_commport); if (read_file_copy_1.size() != 1) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_100 on CSS"); } @@ -264,7 +264,7 @@ class CSSCopyToCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("file_100 should be on /disk510/"); } - auto read_file_copy_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_mailbox); + auto read_file_copy_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_commport); if (read_file_copy_2.size() != 2) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_500 on CSS"); } @@ -285,7 +285,7 @@ class CSSCopyToCSSTestCtrl : public wrench::ExecutionController { if (external_free_space != 400) { throw std::runtime_error("Residual data on external free space not cleaned up after stropped copy"); } - wrench::S4U_CommPort::retireTemporaryCommPort(tmp_mailbox); + wrench::S4U_CommPort::retireTemporaryCommPort(tmp_commport); return 0; } @@ -403,9 +403,9 @@ class CSSWriteToCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("Unexpected job state: " + job->getStateAsString()); } - auto tmp_mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); + auto tmp_commport = wrench::S4U_CommPort::getTemporaryCommPort(); // Check that all file copies worked as intended - auto write_file_lookup_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_mailbox); + auto write_file_lookup_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_commport); if (write_file_lookup_1.size() != 1) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_500 on CSS"); } @@ -413,7 +413,7 @@ class CSSWriteToCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("file_100 should be on /disk510/"); } - auto write_file_lookup_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_mailbox); + auto write_file_lookup_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_commport); if (write_file_lookup_2.size() != 2) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_500 on CSS"); } @@ -424,7 +424,7 @@ class CSSWriteToCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("file_500_part_1 should be on /disk510/"); } - wrench::S4U_CommPort::retireTemporaryCommPort(tmp_mailbox); + wrench::S4U_CommPort::retireTemporaryCommPort(tmp_commport); return 0; } @@ -547,9 +547,9 @@ class CSSCopyFromCSSTestCtrl : public wrench::ExecutionController { } // Check that all file copies worked as intended - auto tmp_mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); + auto tmp_commport = wrench::S4U_CommPort::getTemporaryCommPort(); - auto write_file_lookup_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_mailbox); + auto write_file_lookup_1 = test->compound_storage_service->lookupFileLocation(test->file_100, tmp_commport); if (write_file_lookup_1.size() != 1) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_500 on CSS"); } @@ -567,7 +567,7 @@ class CSSCopyFromCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("External storage doesn't have the expected free space (should be 400)"); } - auto write_file_lookup_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_mailbox); + auto write_file_lookup_2 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_commport); if (write_file_lookup_2.size() != 2) { throw std::runtime_error("Lookup returned an incorrect number of parts for file_500 on CSS"); } @@ -578,7 +578,7 @@ class CSSCopyFromCSSTestCtrl : public wrench::ExecutionController { throw std::runtime_error("file_500_part_1 should be on /disk510/"); } - wrench::S4U_CommPort::retireTemporaryCommPort(tmp_mailbox); + wrench::S4U_CommPort::retireTemporaryCommPort(tmp_commport); return 0; } @@ -744,13 +744,13 @@ class CSSFullJobTestCtrl : public wrench::ExecutionController { throw std::runtime_error(exc_msg); } - auto tmp_mailbox = wrench::S4U_CommPort::getTemporaryCommPort(); - auto css_File_500 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_mailbox); + auto tmp_commport = wrench::S4U_CommPort::getTemporaryCommPort(); + auto css_File_500 = test->compound_storage_service->lookupFileLocation(test->file_500, tmp_commport); if (!css_File_500.empty()) { throw std::runtime_error("file_500 is still present on CSS, it shouldn't"); } - wrench::S4U_CommPort::retireTemporaryCommPort(tmp_mailbox); + wrench::S4U_CommPort::retireTemporaryCommPort(tmp_commport); return 0; } diff --git a/test/services/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp b/test/services/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp index 0dd4efe371..91336ffebb 100755 --- a/test/services/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp +++ b/test/services/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp @@ -1190,7 +1190,7 @@ void SimpleStorageServiceFunctionalTest::do_SynchronousFileCopyFailures_test(dou char **argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); - // argv[2] = strdup("--log=wrench_core_mailbox.t=debug"); + // argv[2] = strdup("--log=wrench_core_commport.t=debug"); ASSERT_NO_THROW(simulation->init(&argc, argv)); diff --git a/test/services/storage_services/StorageServiceProxy/StorageServiceProxyBasicTest.cpp b/test/services/storage_services/StorageServiceProxy/StorageServiceProxyBasicTest.cpp index 0489b5b536..c1146472ee 100755 --- a/test/services/storage_services/StorageServiceProxy/StorageServiceProxyBasicTest.cpp +++ b/test/services/storage_services/StorageServiceProxy/StorageServiceProxyBasicTest.cpp @@ -265,7 +265,7 @@ void StorageServiceProxyBasicTest::do_BasicFunctionality_test(bool arg, std::str char **argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); - //argv[2] = strdup("--log=wrench_core_mailbox.threshold=debug"); + //argv[2] = strdup("--log=wrench_core_commport.threshold=debug"); //argv[3] = strdup("--log=wrench_core_proxy_file_server.threshold=debug"); simulation->init(&argc, argv); diff --git a/test/services/storage_services/StorageServiceProxy/StorageServiceProxySequentialTest.cpp b/test/services/storage_services/StorageServiceProxy/StorageServiceProxySequentialTest.cpp index 8a9dcdda74..9b25639cac 100755 --- a/test/services/storage_services/StorageServiceProxy/StorageServiceProxySequentialTest.cpp +++ b/test/services/storage_services/StorageServiceProxy/StorageServiceProxySequentialTest.cpp @@ -120,7 +120,7 @@ void StorageServiceProxySimultaneousTest::do_Simultaneous_test(std::string mode) char **argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); //argv[3] = strdup("--wrench-full-log"); - //argv[1] = strdup("--log=wrench_core_mailbox.threshold=debug"); + //argv[1] = strdup("--log=wrench_core_commport.threshold=debug"); //argv[2] = strdup("--log=wrench_core_proxy_file_server.threshold=debug"); simulation->init(&argc, argv); diff --git a/test/services/storage_services/XRootDStorageService/XRootDStorageServiceBasicFunctionalTest.cpp b/test/services/storage_services/XRootDStorageService/XRootDStorageServiceBasicFunctionalTest.cpp index 229fbd79bf..60bd858f03 100755 --- a/test/services/storage_services/XRootDStorageService/XRootDStorageServiceBasicFunctionalTest.cpp +++ b/test/services/storage_services/XRootDStorageService/XRootDStorageServiceBasicFunctionalTest.cpp @@ -241,7 +241,7 @@ void XRootDServiceBasicFunctionalTest::do_BasicFunctionality_test(std::string ar char **argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); // argv[1] = strdup("--wrench-full-log"); - // argv[2] = strdup("--log=wrench_core_mailbox.t=debug"); + // argv[2] = strdup("--log=wrench_core_commport.t=debug"); simulation->init(&argc, argv); diff --git a/test/simulated_failures/failure_test_util/ComputerVictim.cpp b/test/simulated_failures/failure_test_util/ComputerVictim.cpp index 0338e760b6..017ece272e 100755 --- a/test/simulated_failures/failure_test_util/ComputerVictim.cpp +++ b/test/simulated_failures/failure_test_util/ComputerVictim.cpp @@ -15,11 +15,11 @@ WRENCH_LOG_CATEGORY(computer_victim, "Log category for Computer"); -wrench::ComputerVictim::ComputerVictim(std::string host_on_which_to_run, double flops, SimulationMessage *msg, wrench::S4U_CommPort *mailbox_to_notify) +wrench::ComputerVictim::ComputerVictim(std::string host_on_which_to_run, double flops, SimulationMessage *msg, wrench::S4U_CommPort *commport_to_notify) : Service(host_on_which_to_run, "victim") { this->flops = flops; this->msg = msg; - this->mailbox_to_notify = mailbox_to_notify; + this->commport_to_notify = commport_to_notify; } @@ -28,7 +28,7 @@ int wrench::ComputerVictim::main() { WRENCH_INFO("Starting (%u)", this->num_starts); WRENCH_INFO("Computing %.3lf flops...", this->flops); wrench::Simulation::compute(this->flops); - this->mailbox_to_notify->putMessage(this->msg); + this->commport_to_notify->putMessage(this->msg); return 0; } diff --git a/test/simulated_failures/failure_test_util/ComputerVictim.h b/test/simulated_failures/failure_test_util/ComputerVictim.h index 3277a8670f..0fc81ab829 100755 --- a/test/simulated_failures/failure_test_util/ComputerVictim.h +++ b/test/simulated_failures/failure_test_util/ComputerVictim.h @@ -20,14 +20,14 @@ namespace wrench { : public Service { public: - explicit ComputerVictim(std::string host_on_which_to_run, double flops, SimulationMessage *msg, wrench::S4U_CommPort *mailbox_to_notify); + explicit ComputerVictim(std::string host_on_which_to_run, double flops, SimulationMessage *msg, wrench::S4U_CommPort *commport_to_notify); void cleanup(bool has_terminated_cleanly, int return_value) override; private: double flops; SimulationMessage *msg; - wrench::S4U_CommPort *mailbox_to_notify; + wrench::S4U_CommPort *commport_to_notify; int main() override; }; diff --git a/test/simulated_failures/failure_test_util/SleeperVictim.cpp b/test/simulated_failures/failure_test_util/SleeperVictim.cpp index 52540887fb..8cd754baf4 100755 --- a/test/simulated_failures/failure_test_util/SleeperVictim.cpp +++ b/test/simulated_failures/failure_test_util/SleeperVictim.cpp @@ -15,11 +15,11 @@ WRENCH_LOG_CATEGORY(sleeper_victom, "Log category for Sleeper"); -wrench::SleeperVictim::SleeperVictim(std::string host_on_which_to_run, double seconds_of_life, SimulationMessage *msg, S4U_CommPort *mailbox_to_notify) +wrench::SleeperVictim::SleeperVictim(std::string host_on_which_to_run, double seconds_of_life, SimulationMessage *msg, S4U_CommPort *commport_to_notify) : Service(host_on_which_to_run, "victim") { this->seconds_of_life = seconds_of_life; this->msg = msg; - this->mailbox_to_notify = mailbox_to_notify; + this->commport_to_notify = commport_to_notify; } @@ -28,7 +28,7 @@ int wrench::SleeperVictim::main() { WRENCH_INFO("Starting (%u)", this->num_starts); WRENCH_INFO("Sleeping for %.3lf seconds...", this->seconds_of_life); wrench::Simulation::sleep(this->seconds_of_life); - this->mailbox_to_notify->putMessage(this->msg); + this->commport_to_notify->putMessage(this->msg); return 0; } diff --git a/test/simulated_failures/failure_test_util/SleeperVictim.h b/test/simulated_failures/failure_test_util/SleeperVictim.h index b189d72964..0e3a224131 100755 --- a/test/simulated_failures/failure_test_util/SleeperVictim.h +++ b/test/simulated_failures/failure_test_util/SleeperVictim.h @@ -19,14 +19,14 @@ namespace wrench { class SleeperVictim : public Service { public: - explicit SleeperVictim(std::string host_on_which_to_run, double seconds_of_life, SimulationMessage *msg, S4U_CommPort *mailbox_to_notify); + explicit SleeperVictim(std::string host_on_which_to_run, double seconds_of_life, SimulationMessage *msg, S4U_CommPort *commport_to_notify); void cleanup(bool has_terminated_cleanly, int return_value) override; private: double seconds_of_life; SimulationMessage *msg; - S4U_CommPort *mailbox_to_notify; + S4U_CommPort *commport_to_notify; int main() override; }; diff --git a/test/simulated_failures/link_failures/AlarmLinkFailuresTest.cpp b/test/simulated_failures/link_failures/AlarmLinkFailuresTest.cpp index ea7690c600..cc951a71b9 100755 --- a/test/simulated_failures/link_failures/AlarmLinkFailuresTest.cpp +++ b/test/simulated_failures/link_failures/AlarmLinkFailuresTest.cpp @@ -76,8 +76,8 @@ class AlarmLinkFailuresTestWMS : public wrench::ExecutionController { int main() override { // Create an Alarm service that will go of in 10 seconds - auto mailbox = this->commport; - wrench::Alarm::createAndStartAlarm(this->simulation, 10, "Host2", mailbox, + auto commport = this->commport; + wrench::Alarm::createAndStartAlarm(this->simulation, 10, "Host2", commport, new wrench::ExecutionControllerAlarmTimerMessage("hello", 10000), "wms_timer"); // Start the link killer that will turn off link1 in 20 seconds @@ -90,12 +90,12 @@ class AlarmLinkFailuresTestWMS : public wrench::ExecutionController { // Wait for the message std::shared_ptr message; try { - message = mailbox->getMessage(); + message = commport->getMessage(); throw std::runtime_error("Should never have gotten the alarm's message"); } catch (wrench::ExecutionException &e) { e.getCause()->toString(); auto cause = std::dynamic_pointer_cast(e.getCause()); - cause->getMailbox(); + cause->getCommPortName(); } return 0; diff --git a/test/simulation/SimulationCommandLineArgumentsTest.cpp b/test/simulation/SimulationCommandLineArgumentsTest.cpp index 09eb5a9578..44aa7789ed 100755 --- a/test/simulation/SimulationCommandLineArgumentsTest.cpp +++ b/test/simulation/SimulationCommandLineArgumentsTest.cpp @@ -30,7 +30,7 @@ class SimulationCommandLineArgumentsTest : public ::testing::Test { void do_NoColorArgument_test(); - void do_MailboxPoolSizeArgument_test(); + void do_CommPortPoolSizeArgument_test(); void do_FullLogArgument_test(std::string arg, int num_log_lines); @@ -293,11 +293,11 @@ void SimulationCommandLineArgumentsTest::do_HelpArgument_test() { /** MAILBOX-POOL-SIZE COMMAND-LINE ARGUMENT **/ /**********************************************************************/ -TEST_F(SimulationCommandLineArgumentsTest, MailboxPoolSizeArgument) { - DO_TEST_WITH_FORK(do_MailboxPoolSizeArgument_test); +TEST_F(SimulationCommandLineArgumentsTest, CommPortPoolSizeArgument) { + DO_TEST_WITH_FORK(do_CommPortPoolSizeArgument_test); } -void SimulationCommandLineArgumentsTest::do_MailboxPoolSizeArgument_test() { +void SimulationCommandLineArgumentsTest::do_CommPortPoolSizeArgument_test() { // Create and initialize a simulation auto simulation = wrench::Simulation::createSimulation(); int argc = 2; diff --git a/tools/wrench/wrench-daemon/src/SimulationController.cpp b/tools/wrench/wrench-daemon/src/SimulationController.cpp index 776a237493..62f58d6e88 100644 --- a/tools/wrench/wrench-daemon/src/SimulationController.cpp +++ b/tools/wrench/wrench-daemon/src/SimulationController.cpp @@ -100,7 +100,7 @@ namespace wrench { // Initial setup wrench::TerminalOutput::setThisProcessLoggingColor(TerminalOutput::COLOR_RED); - S4U_Daemon::map_actor_to_recv_commport[simgrid::s4u::this_actor::get_pid()] = this->recv_mailbox; + S4U_Daemon::map_actor_to_recv_commport[simgrid::s4u::this_actor::get_pid()] = this->recv_commport; WRENCH_INFO("Starting"); this->job_manager = this->createJobManager();