Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add test in activity-lifecycle turning off its own host.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Oct 2019 21:49:54 +0000 (22:49 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Oct 2019 22:31:05 +0000 (23:31 +0100)
Close https://github.com/simgrid/simgrid/issues/323

ChangeLog
teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp

index fd81419..7aa9e10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ Kernel:
 Fixed bugs (FG#.. -> framagit bugs; FG!.. -> framagit merge requests):
  - GH#31: [MC] please provide an option to make MPI_Send asynchronous
  - GH#305: Unscheduled tasks are still excuted
+ - GH#323: Crash when an actor turn off his physical host
  - FG!19: Removing RngStream
 
 ----------------------------------------------------------------------------
index 26da774..783367f 100644 (file)
@@ -239,6 +239,21 @@ static void test_exec_restart_end()
              "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
 }
 
+static void test_turn_off_itself()
+{
+  XBT_INFO("%s: Launch a sleep(5), then saw off the branch it's sitting on", __func__);
+
+  simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
+    assert_exit(true, 5);
+    simgrid::s4u::this_actor::sleep_for(5);
+    simgrid::s4u::this_actor::get_host()->turn_off();
+    xbt_die("I should be dead now");
+  });
+  simgrid::s4u::this_actor::sleep_for(9);
+  all_hosts[1]->turn_on();
+  XBT_INFO("Test %s is ending", __func__);
+}
+
 static void test_comm()
 {
   XBT_INFO("%s: Launch a communication", __func__);
@@ -554,6 +569,8 @@ static void main_dispatcher()
   run_test("exec restarted in middle", test_exec_restart_middle);
   run_test("exec restarted at end", test_exec_restart_end);
 
+  run_test("turn off its own host", test_turn_off_itself);
+
   run_test("comm", test_comm);
   run_test("comm dsend and quit (put before get)", test_comm_dsend_and_quit_put_before_get);
   run_test("comm dsend and quit (get before put)", test_comm_dsend_and_quit_get_before_put);