Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not promote bad practices: use "accessor" to get task name
[simgrid.git] / teshsuite / msg / host_on_off_processes / host_on_off_processes.cpp
index 9d311e5..eb6b463 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -61,7 +61,7 @@ static int commRX(int /*argc*/, char** /*argv*/)
   XBT_INFO("  Start RX");
   msg_error_t error = MSG_task_receive(&(task), mailbox);
   if (error == MSG_OK) {
-    XBT_INFO("  Receive message: %s", task->name);
+    XBT_INFO("  Receive message: %s", MSG_task_get_name(task));
     MSG_task_destroy(task);
   } else if (error == MSG_HOST_FAILURE) {
     XBT_INFO("  Receive message: HOST_FAILURE");
@@ -170,6 +170,7 @@ static int test_launcher(int /*argc*/, char** /*argv*/)
   test = 6;
   if (xbt_dynar_search_or_negative(tests, &test) != -1) {
     XBT_INFO("Test 6: Turn on Jupiter, assign a VM on Jupiter, launch a process inside the VM, and turn off the node");
+    MSG_process_set_data_cleanup(nullptr); // If set for test 6, cleanup handler gives double-free errors.
 
     // Create VM0
     msg_vm_t vm0 = MSG_vm_create_core(jupiter, "vm0");
@@ -224,6 +225,7 @@ int main(int argc, char* argv[])
 
   MSG_create_environment(argv[1]);
 
+  MSG_process_set_data_cleanup(task_cleanup_handler);
   MSG_process_create("test_launcher", test_launcher, NULL, MSG_get_host_by_name("Tremblay"));
 
   res = MSG_main();