Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix another Asan false alarm (with clang 12).
[simgrid.git] / teshsuite / s4u / activity-lifecycle / testing_comm_direct.cpp
index 8ae8fbc..ac4b169 100644 (file)
@@ -5,18 +5,6 @@
 
 #include "activity-lifecycle.hpp"
 
-// Normally, we should be able use Catch2's REQUIRE_THROWS_AS(...), but it generates errors with Address Sanitizer.
-// They're certainly false positive. Nevermind and use this simpler replacement.
-#define REQUIRE_NETWORK_FAILURE(...)                                                                                   \
-  do {                                                                                                                 \
-    try {                                                                                                              \
-      __VA_ARGS__;                                                                                                     \
-      FAIL("Expected exception NetworkFailureException not caught");                                                   \
-    } catch (simgrid::NetworkFailureException const&) {                                                                \
-      XBT_VERB("got expected NetworkFailureException");                                                                \
-    }                                                                                                                  \
-  } while (0)
-
 TEST_CASE("Activity lifecycle: direct communication activities")
 {
   XBT_INFO("#####[ launch next \"direct-comm\" test ]#####");
@@ -28,7 +16,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
 
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5", all_hosts[1], [&global]() {
       assert_exit(true, 5.);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       global = true;
     });
 
@@ -44,7 +32,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
     XBT_INFO("Launch a dcomm(5s), and kill it right after start");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_killed", all_hosts[1], []() {
       assert_exit(false, 0);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       FAIL("I should be dead now");
     });
 
@@ -59,7 +47,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
     XBT_INFO("Launch a dcomm(5s), and kill it after 2 secs");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_killed", all_hosts[1], []() {
       assert_exit(false, 2);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       FAIL("I should be dead now");
     });
 
@@ -74,7 +62,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
     XBT_INFO("Launch a dcomm(5s), and restart its host right after start");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], []() {
       assert_exit(false, 0);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       FAIL("I should be dead now");
     });
 
@@ -90,7 +78,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
     XBT_INFO("Launch a dcomm(5s), and restart its host after 2 secs");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], []() {
       assert_exit(false, 2);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       FAIL("I should be dead now");
     });
 
@@ -108,7 +96,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
 
     simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], [&execution_done]() {
       assert_exit(true, 5);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       execution_done = true;
     });
 
@@ -126,13 +114,12 @@ TEST_CASE("Activity lifecycle: direct communication activities")
     END_SECTION;
   }
 
-/*
   BEGIN_SECTION("dcomm link restarted at start")
   {
     XBT_INFO("Launch a dcomm(5s), and restart the used link right after start");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], []() {
       assert_exit(true, 0);
-      REQUIRE_NETWORK_FAILURE(all_hosts[1]->sendto(all_hosts[2], 5000));
+      REQUIRE_NETWORK_FAILURE(simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000));
     });
 
     simgrid::s4u::this_actor::yield();
@@ -142,14 +129,13 @@ TEST_CASE("Activity lifecycle: direct communication activities")
 
     END_SECTION;
   }
-*/
 
   BEGIN_SECTION("dcomm link restarted in middle")
   {
     XBT_INFO("Launch a dcomm(5s), and restart the used link after 2 secs");
     simgrid::s4u::ActorPtr dcomm5 = simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], []() {
       assert_exit(true, 2);
-      REQUIRE_NETWORK_FAILURE(all_hosts[1]->sendto(all_hosts[2], 5000));
+      REQUIRE_NETWORK_FAILURE(simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000));
     });
 
     simgrid::s4u::this_actor::sleep_for(2);
@@ -167,7 +153,7 @@ TEST_CASE("Activity lifecycle: direct communication activities")
 
     simgrid::s4u::Actor::create("dcomm5_restarted", all_hosts[1], [&execution_done]() {
       assert_exit(true, 5);
-      all_hosts[1]->sendto(all_hosts[2], 5000);
+      simgrid::s4u::Comm::sendto(all_hosts[1], all_hosts[2], 5000);
       execution_done = true;
     });