Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
HostImpl::turn_off(): SIMIX_process_self is maestro there, save real process before...
[simgrid.git] / teshsuite / s4u / activity-lifecycle / activity-lifecycle.cpp
1 /* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/s4u.hpp"
7
8 #include <cmath>
9
10 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
11
12 std::vector<simgrid::s4u::Host*> all_hosts;
13
14 /* Helper function easing the testing of actor's ending condition */
15 static void assert_exit(bool exp_failed, double duration)
16 {
17   double expected_time = simgrid::s4u::Engine::get_clock() + duration;
18   simgrid::s4u::this_actor::on_exit([exp_failed, expected_time](bool got_failed) {
19     xbt_assert(exp_failed == got_failed, "Exit failure status mismatch. Expected %d, got %d", exp_failed, got_failed);
20     xbt_assert(std::fabs(expected_time - simgrid::s4u::Engine::get_clock()) < 0.001, "Exit time mismatch. Expected %f",
21                expected_time);
22     XBT_VERB("Checks on exit successful");
23   });
24 }
25 /* Helper function in charge of running a test and doing some sanity checks afterward */
26 static void run_test(const char* test_name, const std::function<void()>& test)
27 {
28   simgrid::s4u::Actor::create(test_name, all_hosts[0], test);
29   simgrid::s4u::this_actor::sleep_for(10);
30
31   /* Check that no actor remain (but on host[0], where main_dispatcher lives */
32   for (unsigned int i = 0; i < all_hosts.size(); i++) {
33     std::vector<simgrid::s4u::ActorPtr> all_actors = all_hosts[i]->get_all_actors();
34     unsigned int expected_count = (i == 0) ? 1 : 0; // host[0] contains main_dispatcher, all other are empty
35     if (all_actors.size() != expected_count) {
36       XBT_CRITICAL("Host %s contains %zu actors but %u are expected (i=%u). Existing actors: ",
37                    all_hosts[i]->get_cname(), all_actors.size(), expected_count, i);
38       for (auto act : all_actors)
39         XBT_CRITICAL(" - %s", act->get_cname());
40       xbt_die("This is wrong");
41     }
42   }
43   xbt_assert("TODO: Check that all LMM are empty");
44   XBT_INFO("SUCCESS: %s", test_name);
45   XBT_INFO("#########################################################################################################");
46 }
47
48 /**
49  ** Each tests
50  **/
51
52 static void test_sleep()
53 {
54   XBT_INFO("%s: Launch a sleep(5), and let it proceed", __func__);
55   bool global = false;
56
57   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5", all_hosts[1], [&global]() {
58     assert_exit(false, 5.);
59     simgrid::s4u::this_actor::sleep_for(5);
60     global = true;
61   });
62   simgrid::s4u::this_actor::sleep_for(9);
63   xbt_assert(global, "The forked actor did not modify the global after sleeping. Was it killed before?");
64 }
65
66 static void test_sleep_kill_middle()
67 {
68   XBT_INFO("%s: Launch a sleep(5), and kill it after 2 secs", __func__);
69
70   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_killed", all_hosts[1], []() {
71     assert_exit(true, 2);
72     simgrid::s4u::this_actor::sleep_for(5);
73     xbt_die("I should be dead now");
74   });
75
76   simgrid::s4u::this_actor::sleep_for(2);
77   sleeper5->kill();
78 }
79
80 static void test_sleep_kill_begin()
81 {
82   XBT_INFO("%s: Launch a sleep(5), and kill it right after start", __func__);
83
84   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_killed", all_hosts[1], []() {
85     assert_exit(true, 0);
86     simgrid::s4u::this_actor::sleep_for(5);
87     xbt_die("I should be dead now");
88   });
89
90   simgrid::s4u::this_actor::yield();
91   sleeper5->kill();
92 }
93
94 static void test_sleep_restart_begin()
95 {
96   XBT_INFO("%s: Launch a sleep(5), and restart its host right after start", __func__);
97
98   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
99     assert_exit(true, 0);
100     simgrid::s4u::this_actor::sleep_for(5);
101     xbt_die("I should be dead now");
102   });
103
104   simgrid::s4u::this_actor::yield();
105   sleeper5->get_host()->turn_off();
106   sleeper5->get_host()->turn_on();
107   XBT_INFO("Test %s is ending", __func__);
108 }
109
110 static void test_sleep_restart_middle()
111 {
112   XBT_INFO("%s: Launch a sleep(5), and restart its host after 2 secs", __func__);
113
114   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
115     assert_exit(true, 2);
116     simgrid::s4u::this_actor::sleep_for(5);
117     xbt_die("I should be dead now");
118   });
119
120   simgrid::s4u::this_actor::sleep_for(2);
121   sleeper5->get_host()->turn_off();
122   sleeper5->get_host()->turn_on();
123   XBT_INFO("Test %s is ending", __func__);
124 }
125
126 static void test_sleep_restart_end()
127 {
128   XBT_INFO("%s: Launch a sleep(5), and restart its host right when it stops", __func__);
129   bool sleeper_done = false;
130
131   simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], [&sleeper_done]() {
132     assert_exit(false, 5);
133     simgrid::s4u::this_actor::sleep_for(5);
134     sleeper_done = true;
135   });
136   simgrid::s4u::Actor::create("killer", all_hosts[0], []() {
137     simgrid::s4u::this_actor::sleep_for(5);
138     XBT_INFO("Killer!");
139     all_hosts[1]->turn_off();
140     all_hosts[1]->turn_on();
141   });
142   simgrid::s4u::this_actor::sleep_for(9);
143   xbt_assert(sleeper_done,
144              "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
145 }
146
147 static void test_exec()
148 {
149   XBT_INFO("%s: Launch a execute(5s), and let it proceed", __func__);
150   bool global = false;
151
152   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5", all_hosts[1], [&global]() {
153     assert_exit(false, 5.);
154     simgrid::s4u::this_actor::execute(500000000);
155     global = true;
156   });
157   simgrid::s4u::this_actor::sleep_for(9);
158   xbt_assert(global, "The forked actor did not modify the global after executing. Was it killed before?");
159 }
160
161 static void test_exec_kill_middle()
162 {
163   XBT_INFO("%s: Launch a execute(5s), and kill it after 2 secs", __func__);
164
165   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_killed", all_hosts[1], []() {
166     assert_exit(true, 2);
167     simgrid::s4u::this_actor::execute(500000000);
168     xbt_die("I should be dead now");
169   });
170
171   simgrid::s4u::this_actor::sleep_for(2);
172   exec5->kill();
173 }
174
175 static void test_exec_kill_begin()
176 {
177   XBT_INFO("%s: Launch a execute(5s), and kill it right after start", __func__);
178
179   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_killed", all_hosts[1], []() {
180     assert_exit(true, 0);
181     simgrid::s4u::this_actor::execute(500000000);
182     xbt_die("I should be dead now");
183   });
184
185   simgrid::s4u::this_actor::yield();
186   exec5->kill();
187 }
188
189 static void test_exec_restart_begin()
190 {
191   XBT_INFO("%s: Launch a execute(5s), and restart its host right after start", __func__);
192
193   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], []() {
194     assert_exit(1, 0);
195     simgrid::s4u::this_actor::execute(500000000);
196     xbt_die("I should be dead now");
197   });
198
199   simgrid::s4u::this_actor::yield();
200   exec5->get_host()->turn_off();
201   exec5->get_host()->turn_on();
202   XBT_INFO("Test %s is ending", __func__);
203 }
204
205 static void test_exec_restart_middle()
206 {
207   XBT_INFO("%s: Launch a execute(5s), and restart its host after 2 secs", __func__);
208
209   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], []() {
210     assert_exit(true, 2);
211     simgrid::s4u::this_actor::execute(500000000);
212     xbt_die("I should be dead now");
213   });
214
215   simgrid::s4u::this_actor::sleep_for(2);
216   exec5->get_host()->turn_off();
217   exec5->get_host()->turn_on();
218   XBT_INFO("Test %s is ending", __func__);
219 }
220
221 static void test_exec_restart_end()
222 {
223   XBT_INFO("%s: Launch a execute(5s), and restart its host right when it stops", __func__);
224   bool execution_done = false;
225
226   simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], [&execution_done]() {
227     assert_exit(false, 5);
228     simgrid::s4u::this_actor::execute(500000000);
229     execution_done = true;
230   });
231   simgrid::s4u::Actor::create("killer", all_hosts[0], []() {
232     simgrid::s4u::this_actor::sleep_for(5);
233     XBT_INFO("Killer!");
234     all_hosts[1]->turn_off();
235     all_hosts[1]->turn_on();
236   });
237   simgrid::s4u::this_actor::sleep_for(9);
238   xbt_assert(execution_done,
239              "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
240 }
241
242 static void test_comm()
243 {
244   XBT_INFO("%s: Launch a communication", __func__);
245   bool send_done = false;
246   bool recv_done = false;
247
248   simgrid::s4u::Actor::create("sender", all_hosts[1], [&send_done]() {
249     assert_exit(false, 5);
250     char* payload = xbt_strdup("toto");
251     simgrid::s4u::Mailbox::by_name("mb")->put(payload, 5000);
252     send_done = true;
253   });
254   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
255     assert_exit(false, 5);
256     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
257     xbt_free(payload);
258     recv_done = true;
259   });
260
261   simgrid::s4u::this_actor::sleep_for(9);
262   xbt_assert(send_done, "Sender killed somehow. It shouldn't");
263   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
264 }
265
266 static void test_comm_dsend_and_quit_put_before_get()
267 {
268   XBT_INFO("%s: Launch a detached communication and end right after", __func__);
269   bool dsend_done = false;
270   bool recv_done  = false;
271
272   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&dsend_done]() {
273     assert_exit(false, 0);
274     char* payload = xbt_strdup("toto");
275     simgrid::s4u::Mailbox::by_name("mb")->put_init(payload, 1000)->detach();
276     dsend_done = true;
277   });
278
279   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
280     assert_exit(false, 3);
281     simgrid::s4u::this_actor::sleep_for(2);
282     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
283     xbt_free(payload);
284     recv_done = true;
285   });
286
287   // Sleep long enough to let the test ends by itself. 3 + surf_precision should be enough.
288   simgrid::s4u::this_actor::sleep_for(4);
289   xbt_assert(dsend_done, "Sender killed somehow. It shouldn't");
290   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
291 }
292
293 static void test_comm_dsend_and_quit_get_before_put()
294 {
295   XBT_INFO("%s: Launch a detached communication and end right after", __func__);
296   bool dsend_done = false;
297   bool recv_done  = false;
298
299   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&dsend_done]() {
300     assert_exit(false, 2);
301     char* payload = xbt_strdup("toto");
302     simgrid::s4u::this_actor::sleep_for(2);
303     simgrid::s4u::Mailbox::by_name("mb")->put_init(payload, 1000)->detach();
304     dsend_done = true;
305   });
306
307   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
308     assert_exit(false, 3);
309     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
310     xbt_free(payload);
311     recv_done = true;
312   });
313
314   // Sleep long enough to let the test ends by itself. 3 + surf_precision should be enough.
315   simgrid::s4u::this_actor::sleep_for(4);
316   xbt_assert(dsend_done, "Sender killed somehow. It shouldn't");
317   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
318 }
319
320
321 static void test_comm_killsend()
322 {
323   XBT_INFO("%s: Launch a communication and kill the sender", __func__);
324   bool send_done = false;
325   bool recv_done = false;
326
327   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&send_done]() {
328     assert_exit(true, 2);
329     // Encapsulate the payload in a std::unique_ptr so that it is correctly free'd when the sender is killed during its
330     // communication (thanks to RAII).  The pointer is then released when the communication is over.
331     std::unique_ptr<char, decltype(&xbt_free_f)> payload(xbt_strdup("toto"), &xbt_free_f);
332     simgrid::s4u::Mailbox::by_name("mb")->put(payload.get(), 5000);
333     payload.release();
334     send_done = true;
335   });
336   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
337     assert_exit(false, 2);
338     bool got_exception = false;
339     try {
340       void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
341       xbt_free(payload);
342     } catch (simgrid::NetworkFailureException const&) {
343       got_exception = true;
344     }
345     xbt_assert(got_exception);
346     recv_done = true;
347   });
348
349   simgrid::s4u::this_actor::sleep_for(2);
350   sender->kill();
351   // let the test ends by itself. waiting for surf_precision should be enough.
352   simgrid::s4u::this_actor::sleep_for(0.00001);
353
354   xbt_assert(not send_done, "Sender was not killed properly");
355   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
356 }
357
358 static void test_host_off_while_receive()
359 {
360   XBT_INFO("%s: Launch an actor that waits on a recv, kill its host", __func__);
361   bool in_on_exit = false;
362   bool returned_from_main = false;
363   bool in_catch_before_on_exit = false;
364   bool in_catch_after_on_exit = false;
365   bool send_done               = false;
366
367   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create(
368     "receiver", all_hosts[1], 
369     [&in_on_exit, &returned_from_main, &in_catch_before_on_exit, &in_catch_after_on_exit]() {
370        assert_exit(true, 1);
371        try {
372          simgrid::s4u::Mailbox::by_name("mb")->get();
373        } catch (simgrid::NetworkFailureException const&) {
374          // Shouldn't get in here
375          in_catch_before_on_exit = not in_on_exit;
376          in_catch_after_on_exit = in_on_exit;
377        }
378        returned_from_main = true;
379      });
380
381   receiver->on_exit([&in_on_exit](bool) { in_on_exit = true; });
382
383   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], [&send_done]() {
384     assert_exit(false, 1);
385     bool got_exception = false;
386     try {
387       int data = 42;
388       simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
389     } catch (simgrid::NetworkFailureException const&) {
390       got_exception = true;
391     }
392     xbt_assert(got_exception);
393     send_done = true;
394   });
395
396   simgrid::s4u::this_actor::sleep_for(1);
397   receiver->get_host()->turn_off();
398   
399   // Note: If we don't sleep here, we don't "see" the bug
400   simgrid::s4u::this_actor::sleep_for(1);
401
402   xbt_assert(in_on_exit, 
403     "Receiver's on_exit function was never called");
404   xbt_assert(not in_catch_before_on_exit, 
405     "Receiver mistakenly went to catch clause (before the on_exit function was called)");
406   xbt_assert(not in_catch_after_on_exit, 
407     "Receiver mistakenly went to catch clause (after the on_exit function was called)");
408   xbt_assert(not returned_from_main, 
409     "Receiver returned from main normally even though its host was killed");
410   xbt_assert(send_done, "Sender killed somehow. It shouldn't");
411   receiver->get_host()->turn_on();
412 }
413
414 static void test_link_off_helper(double delay)
415 {
416   const double start = simgrid::s4u::Engine::get_clock();
417
418   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create("receiver", all_hosts[1], [&start]() {
419     assert_exit(false, 9);
420     double milestone[5] = {0.5, 3.5, 4.5, 7.5, 9.0};
421     for (int i = 0; i < 5; i++)
422       milestone[i] += start;
423     for (int i = 0; i < 4; i++) {
424       simgrid::s4u::this_actor::sleep_until(milestone[i]);
425       try {
426         XBT_VERB("get(%c)", 'A' + i);
427         simgrid::s4u::Mailbox::by_name("mb")->get();
428         return;
429       } catch (simgrid::NetworkFailureException const&) {
430         XBT_VERB("got expected NetworkFailureException");
431       }
432     }
433     simgrid::s4u::this_actor::sleep_until(milestone[4]);
434   });
435
436   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], [&start]() {
437     assert_exit(false, 9);
438     int data            = 42;
439     double milestone[5] = {1.5, 2.5, 5.5, 6.5, 9.0};
440     for (int i = 0; i < 5; i++)
441       milestone[i] += start;
442     for (int i = 0; i < 2; i++) {
443       simgrid::s4u::this_actor::sleep_until(milestone[i]);
444       XBT_VERB("dsend(%c)", 'A' + i);
445       simgrid::s4u::Mailbox::by_name("mb")->put_init(&data, 100000)->detach();
446     }
447     for (int i = 2; i < 4; i++) {
448       simgrid::s4u::this_actor::sleep_until(milestone[i]);
449       try {
450         XBT_VERB("put(%c)", 'A' + i);
451         simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
452         return;
453       } catch (simgrid::NetworkFailureException const&) {
454         XBT_VERB("got expected NetworkFailureException");
455       }
456     }
457     simgrid::s4u::this_actor::sleep_until(milestone[4]);
458   });
459
460   for (int i = 0; i < 4; i++) {
461     XBT_VERB("##### %d / 4 #####", i + 1);
462     simgrid::s4u::this_actor::sleep_for(delay);
463     XBT_VERB("link off");
464     simgrid::s4u::Link::by_name("link1")->turn_off();
465     simgrid::s4u::this_actor::sleep_for(2.0 - delay);
466     XBT_VERB("link on");
467     simgrid::s4u::Link::by_name("link1")->turn_on();
468   }
469   simgrid::s4u::this_actor::sleep_for(1.5);
470 }
471
472 static void test_link_off_before_send_recv()
473 {
474   XBT_INFO("%s: try to communicate with communicating link turned off before start", __func__);
475   test_link_off_helper(0.0);
476 }
477 static void test_link_off_between_send_recv()
478 {
479   XBT_INFO("%s: try to communicate with communicating link turned off between send and receive", __func__);
480   test_link_off_helper(1.0);
481 }
482 static void test_link_off_during_transfer()
483 {
484   XBT_INFO("%s: try to communicate with communicating link turned off during transfer", __func__);
485   test_link_off_helper(2.0);
486 }
487
488 static void test_link_off_during_wait_any()
489 {
490   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create("receiver", all_hosts[1], []() {
491     assert_exit(false, 2);
492     bool receiver_got_network_failure_execution = false;
493     bool receiver_got_base_execution = false;
494     int *data;
495     std::vector<simgrid::s4u::CommPtr> pending_comms;
496     simgrid::s4u::CommPtr comm = simgrid::s4u::Mailbox::by_name("mb")->get_async((void**)&data);
497     pending_comms.push_back(comm);
498     try {
499       simgrid::s4u::Comm::wait_any(&pending_comms);
500     } catch (simgrid::NetworkFailureException const&) {
501       XBT_VERB("got expected NetworkFailureException");
502       receiver_got_network_failure_execution = true;
503     } catch (simgrid::Exception const&) {
504       XBT_VERB("got unexpected base Exception");
505       receiver_got_base_execution = true;
506     }
507     xbt_assert(receiver_got_network_failure_execution, "The receiver should have gotten a NetworkFailureException");
508     xbt_assert(not receiver_got_base_execution, "The receiver should not have gotten a base Exception");
509   });
510
511   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], []() {
512     assert_exit(false, 2);
513     int data = 42;
514     bool sender_got_network_failure_execution = false;
515     bool sender_got_base_execution = false;
516     try {
517       simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
518     } catch (simgrid::NetworkFailureException const&) {
519       XBT_VERB("got expected NetworkFailureException");
520       sender_got_network_failure_execution = true;
521     } catch (simgrid::Exception const&) {
522       XBT_VERB("got unexpected base Exception");
523       sender_got_base_execution = true;
524     }
525     xbt_assert(sender_got_network_failure_execution, "The sender should have gotten a NetworkFailureException");
526     xbt_assert(not sender_got_base_execution, "The sender should not have gotten a base Exception");
527   });
528
529   simgrid::s4u::this_actor::sleep_for(2.0);
530   XBT_VERB("link off");
531   simgrid::s4u::Link::by_name("link1")->turn_off();
532   simgrid::s4u::this_actor::sleep_for(2.0);
533   XBT_VERB("link on");
534   simgrid::s4u::Link::by_name("link1")->turn_on();
535 }
536
537
538 /* We need an extra actor here, so that it can sleep until the end of each test */
539 static void main_dispatcher()
540 {
541   run_test("sleep", test_sleep);
542   run_test("sleep killed at start", test_sleep_kill_begin);
543   run_test("sleep killed in middle", test_sleep_kill_middle);
544   /* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
545    * to avoid that they exit before their victim dereferences their name */
546   run_test("sleep restarted at start", test_sleep_restart_begin);
547   run_test("sleep restarted in middle", test_sleep_restart_middle);
548   run_test("sleep restarted at end", test_sleep_restart_end);
549
550   run_test("exec", test_exec);
551   run_test("exec killed at start", test_exec_kill_begin);
552   run_test("exec killed in middle", test_exec_kill_middle);
553   run_test("exec restarted at start", test_exec_restart_begin);
554   run_test("exec restarted in middle", test_exec_restart_middle);
555   run_test("exec restarted at end", test_exec_restart_end);
556
557   run_test("comm", test_comm);
558   run_test("comm dsend and quit (put before get)", test_comm_dsend_and_quit_put_before_get);
559   run_test("comm dsend and quit (get before put)", test_comm_dsend_and_quit_get_before_put);
560   run_test("comm kill sender", test_comm_killsend);
561
562   run_test("comm recv and kill", test_host_off_while_receive);
563   run_test("comm turn link off before send/recv", test_link_off_before_send_recv);
564   run_test("comm turn link off between send/recv", test_link_off_between_send_recv);
565   run_test("comm turn link off during transfer", test_link_off_during_transfer);
566   run_test("comm turn link off during wait_any", test_link_off_during_wait_any);
567 }
568
569 int main(int argc, char* argv[])
570 {
571   simgrid::s4u::Engine e(&argc, argv);
572
573   const char* platf = argv[1];
574   if (argc <= 1) {
575     XBT_WARN("No platform file provided. Using './testing_platform.xml'");
576     platf = "./testing_platform.xml";
577   }
578   e.load_platform(platf);
579
580   all_hosts = e.get_all_hosts();
581   simgrid::s4u::Actor::create("main_dispatcher", all_hosts[0], main_dispatcher);
582
583   e.run();
584
585   XBT_INFO("Simulation done");
586
587   return 0;
588 }