Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
only install when branch is master (avoid installing PRs)
[simgrid.git] / teshsuite / s4u / activity-lifecycle / activity-lifecycle.cpp
index 41637c1..8e82825 100644 (file)
@@ -35,7 +35,7 @@ static void run_test(const char* test_name, std::function<void()> test)
     std::vector<simgrid::s4u::ActorPtr> all_actors = all_hosts[i]->get_all_actors();
     unsigned int expected_count = (i == 0) ? 1 : 0; // host[0] contains main_dispatcher, all other are empty
     if (all_actors.size() != expected_count) {
-      XBT_CRITICAL("Host %s contains %lu actors but %u are expected (i=%u). Existing actors: ",
+      XBT_CRITICAL("Host %s contains %zu actors but %u are expected (i=%u). Existing actors: ",
                    all_hosts[i]->get_cname(), all_actors.size(), expected_count, i);
       for (auto act : all_actors)
         XBT_CRITICAL(" - %s", act->get_cname());
@@ -204,7 +204,7 @@ static void test_comm_killsend()
 /* We need an extra actor here, so that it can sleep until the end of each test */
 static void main_dispatcher()
 {
-  run_test("sleep", test_sleep);
+  run_test("sleep", static_cast<std::function<void()>>(test_sleep));
   run_test("sleep killed at start", test_sleep_kill_begin);
   run_test("sleep killed in middle", test_sleep_kill_middle);
   /* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
@@ -220,8 +220,13 @@ static void main_dispatcher()
 int main(int argc, char* argv[])
 {
   simgrid::s4u::Engine e(&argc, argv);
-  xbt_assert(argc > 1);
-  e.load_platform(argv[1]);
+
+  const char* platf = argv[1];
+  if (argc <= 1) {
+    XBT_WARN("No platform file provided. Using './testing_platform.xml'");
+    platf = "./testing_platform.xml";
+  }
+  e.load_platform(platf);
 
   all_hosts = e.get_all_hosts();
   simgrid::s4u::Actor::create("main_dispatcher", all_hosts[0], main_dispatcher);