X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3c0a4cd82fe92f060595748b8e5ddc31e2e60637..8c6bbb14f44b8daed5ea43d80880c6bf2155118b:/teshsuite/s4u/activity-lifecycle/testing_comm.cpp diff --git a/teshsuite/s4u/activity-lifecycle/testing_comm.cpp b/teshsuite/s4u/activity-lifecycle/testing_comm.cpp index 6c9326a5a1..f485fc831b 100644 --- a/teshsuite/s4u/activity-lifecycle/testing_comm.cpp +++ b/teshsuite/s4u/activity-lifecycle/testing_comm.cpp @@ -1,9 +1,9 @@ -/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "catch_simgrid.hpp" +#include "teshsuite/catch_simgrid.hpp" #include static void test_link_off_helper(double delay) @@ -172,7 +172,7 @@ TEST_CASE("Activity lifecycle: comm activities") simgrid::s4u::this_actor::sleep_for(2); receiver_basic(recv_done, true, 1); - // Sleep long enough to let the test ends by itself. 1 + surf_precision should be enough. + // Sleep long enough to let the test ends by itself. 1 + precision_timing should be enough. simgrid::s4u::this_actor::sleep_for(4); INFO("Sender or receiver killed somehow. It shouldn't"); REQUIRE(dsend_done); @@ -191,7 +191,7 @@ TEST_CASE("Activity lifecycle: comm activities") simgrid::s4u::this_actor::sleep_for(2); sender_dtach(dsend_done, true, 0); - // Sleep long enough to let the test ends by itself. 3 + surf_precision should be enough. + // Sleep long enough to let the test ends by itself. 3 + precision_timing should be enough. simgrid::s4u::this_actor::sleep_for(4); INFO("Sender or receiver killed somehow. It shouldn't"); REQUIRE(dsend_done); @@ -206,15 +206,7 @@ TEST_CASE("Activity lifecycle: comm activities") bool send_done = false; bool recv_done = false; - simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&send_done]() { - assert_exit(false, 2); - // Encapsulate the payload in a std::unique_ptr so that it is correctly free'd when the sender is killed during - // its communication (thanks to RAII). The pointer is then released when the communication is over. - std::unique_ptr payload(xbt_strdup("toto"), &xbt_free_f); - simgrid::s4u::Mailbox::by_name("mb")->put(payload.get(), 5000); - payload.release(); - send_done = true; - }); + simgrid::s4u::ActorPtr sender = sender_basic(send_done, false, 2); simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() { assert_exit(true, 2); @@ -227,7 +219,7 @@ TEST_CASE("Activity lifecycle: comm activities") simgrid::s4u::this_actor::sleep_for(2); sender->kill(); - // let the test ends by itself. waiting for surf_precision should be enough. + // let the test ends by itself. waiting for precision_timing should be enough. simgrid::s4u::this_actor::sleep_for(0.00001); INFO("Sender was not killed properly or receiver killed somehow. It shouldn't");