From 6eece18e97088f220dde6b281319f35ddd40a920 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 31 Oct 2019 22:49:54 +0100 Subject: [PATCH] Add test in activity-lifecycle turning off its own host. Close https://github.com/simgrid/simgrid/issues/323 --- ChangeLog | 1 + .../activity-lifecycle/activity-lifecycle.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd8141987d..7aa9e10373 100644 --- 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 ---------------------------------------------------------------------------- diff --git a/teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp b/teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp index 26da7744bb..783367f8e3 100644 --- a/teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp +++ b/teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp @@ -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); -- 2.20.1