From 8d8733c018b721a25cbab2edb8e7ba16fc98135a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 14 Jun 2017 23:31:21 +0200 Subject: [PATCH 1/1] simplify this test for the ongoing debugging --- teshsuite/s4u/comm-waitany/comm-waitany.cpp | 33 +++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/teshsuite/s4u/comm-waitany/comm-waitany.cpp b/teshsuite/s4u/comm-waitany/comm-waitany.cpp index 1f67aa0941..407c7e8d66 100644 --- a/teshsuite/s4u/comm-waitany/comm-waitany.cpp +++ b/teshsuite/s4u/comm-waitany/comm-waitany.cpp @@ -3,7 +3,7 @@ #include #include -#define NUM_COMMS 10 +#define NUM_COMMS 1 XBT_LOG_NEW_DEFAULT_CATEGORY(mwe, "Minimum Working Example"); @@ -15,24 +15,27 @@ static void receiver() std::vector pending_comms; XBT_INFO("Placing %d asynchronous recv requests", NUM_COMMS); - void* data = calloc(1, sizeof(int)); + void* data; for (int i = 0; i < NUM_COMMS; i++) { simgrid::s4u::CommPtr comm = simgrid::s4u::Comm::recv_async(mymailbox, &data); pending_comms.push_back(comm); } - XBT_INFO("Sleeping for 100 seconds..."); - simgrid::s4u::this_actor::sleep_for(100.0); - XBT_INFO("Calling wait_any() for %ld pending comms", pending_comms.size()); - std::vector::iterator ret_it = - simgrid::s4u::Comm::wait_any(pending_comms.begin(), pending_comms.end()); - XBT_INFO("Counting the number of completed comms..."); - - int count = 0; - for (; ret_it != pending_comms.end(); count++, ret_it++) - ; - - xbt_assert(count == 1, "wait_any() replied that %d comms have completed, which is broken!", count); + for (int i = 0; i < NUM_COMMS; i++) { + XBT_INFO("Sleeping for 100 seconds (for the %dth time)...", i + 1); + simgrid::s4u::this_actor::sleep_for(100.0); + XBT_INFO("Calling wait_any() for %ld pending comms", pending_comms.size()); + std::vector::iterator ret_it = + simgrid::s4u::Comm::wait_any(pending_comms.begin(), pending_comms.end()); + XBT_INFO("Counting the number of completed comms..."); + + int count = 0; + for (; ret_it != pending_comms.end(); count++, ret_it++) + ; + + XBT_INFO("wait_any() replied that %d comms have completed", count); + // xbt_assert(count == 1, "wait_any() replied that %d comms have completed, which is broken!", count); + } } static void sender() @@ -40,7 +43,7 @@ static void sender() simgrid::s4u::MailboxPtr mymailbox = simgrid::s4u::Mailbox::byName("sender_mailbox"); simgrid::s4u::MailboxPtr theirmailbox = simgrid::s4u::Mailbox::byName("receiver_mailbox"); - void* data = calloc(1, sizeof(int)); + void* data = (void*)"data"; for (int i = 0; i < NUM_COMMS; i++) { XBT_INFO("Sending a message to the receiver"); -- 2.20.1