Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
coverage madness in examples
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 22 Jan 2016 19:34:08 +0000 (20:34 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 22 Jan 2016 19:34:43 +0000 (20:34 +0100)
39 files changed:
examples/msg/actions/actions.c
examples/msg/chainsend/chainsend.c
examples/msg/chord/chord.c
examples/msg/energy/consumption/energy_consumption.c
examples/msg/energy/onoff/onoff.c
examples/msg/energy/pstate/pstate.c
examples/msg/energy/vm/energy_vm.c
examples/msg/exception/exception.c
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/io/file.c
examples/msg/io/file_unlink.c
examples/msg/io/remote.c
examples/msg/io/storage.c
examples/msg/kademlia/kademlia.c
examples/msg/masterslave/masterslave_arg.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/migration/migration.c
examples/msg/ns3/ns3.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/pastry/pastry.c
examples/msg/pmm/msg_pmm.c
examples/msg/priority/priority.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/start_kill_time/sk_time.c
examples/msg/suspend/suspend.c
examples/msg/token_ring/ring_call.c
examples/msg/token_ring/token_bypass.c
teshsuite/msg/host_on_off/host_on_off.c

index 5e2a82d..bd5a62a 100644 (file)
@@ -481,16 +481,14 @@ int main(int argc, char *argv[])
   /* Explicit initialization of the action module is required now*/
   MSG_action_init();
 
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file [action_files]\n", argv[0]);
-    printf
-        ("example: %s msg_platform.xml msg_deployment.xml actions # if all actions are in the same file\n",
-         argv[0]);
-    printf
-        ("example: %s msg_platform.xml msg_deployment.xml # if actions are in separate files, specified in deployment\n",
-         argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2,
+            "Usage: %s platform_file deployment_file [action_files]\n"
+            "\t# if all actions are in the same file\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml actions\n"
+            "\t# if actions are in separate files, specified in deployment\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml ",
+            argv[0],argv[0],argv[0]);
+
   printf("WARNING: THIS BINARY IS KINDA DEPRECATED\n"
         "This example is still relevant if you want to learn about MSG-based trace replay, "
         "but if you want to simulate MPI-like traces, you should use the newer version "
@@ -527,8 +525,5 @@ int main(int argc, char *argv[])
   /* Explicit finalization of the action module is required now*/
   MSG_action_exit();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index ce6acfa..51ca4d7 100644 (file)
@@ -44,8 +44,6 @@ msg_error_t test_all(const char *platform_file,
 
   msg_error_t res = MSG_OK;
 
-
-
   XBT_DEBUG("test_all");
 
   /*  Simulation setting */
@@ -94,8 +92,5 @@ int main(int argc, char *argv[])
   _set_output_format(prev_exponent_format);
 #endif
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 81d3da0..21c6a8c 100644 (file)
@@ -1026,11 +1026,10 @@ static void random_lookup(node_t node)
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
-    printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, 
+            "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
+            "\tExample: %s ../msg_platform.xml chord.xml\n", 
+            argv[0], argv[0]);
 
   char **options = &argv[1];
   while (!strncmp(options[0], "-", 1)) {
@@ -1070,8 +1069,5 @@ int main(int argc, char *argv[])
 
   chord_exit();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 4203820..f919a12 100644 (file)
@@ -94,15 +94,10 @@ int main(int argc, char *argv[])
   sg_energy_plugin_init();
   MSG_init(&argc, argv);
 
-  if (argc != 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
-              argv[0]);
-    XBT_CRITICAL
-        ("example: %s msg_platform.xml msg_deployment.xml\n",
-         argv[0]);
-    exit(1);
-  }
-
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);
   MSG_create_environment(argv[1]);
 
   /*   Application deployment */
@@ -114,9 +109,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
 
index 56ce160..f06d512 100644 (file)
 #include "xbt/asserts.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-               "Messages specific for this msg example");
+                            "Messages specific for this msg example");
 
 static void simulate_bootup(msg_host_t host) {
 
-       int previous_pstate = MSG_host_get_pstate(host);
+  int previous_pstate = MSG_host_get_pstate(host);
 
-       XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
-       MSG_host_set_pstate(host,3);
+  XBT_INFO("Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example");
+  MSG_host_set_pstate(host,3);
 
-       msg_host_t host_list[1] = {host};
-       double flops_amount[1] = {1};
-       double bytes_amount[1] = {0};
+  msg_host_t host_list[1] = {host};
+  double flops_amount[1] = {1};
+  double bytes_amount[1] = {0};
 
-       XBT_INFO("Actually start the host");
-       MSG_host_on(host);
+  XBT_INFO("Actually start the host");
+  MSG_host_on(host);
 
-       XBT_INFO("Simulate the boot up by executing one flop on that host");
-       // We use a parallel task to run some task on a remote host.
-       msg_task_t bootup = MSG_parallel_task_create("boot up", 1, host_list, flops_amount, bytes_amount, NULL);
-       MSG_task_execute(bootup);
-       MSG_task_destroy(bootup);
+  XBT_INFO("Simulate the boot up by executing one flop on that host");
+  // We use a parallel task to run some task on a remote host.
+  msg_task_t bootup = MSG_parallel_task_create("boot up", 1, host_list, flops_amount, bytes_amount, NULL);
+  MSG_task_execute(bootup);
+  MSG_task_destroy(bootup);
 
-       XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
-       MSG_host_set_pstate(host, previous_pstate);
+  XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
+  MSG_host_set_pstate(host, previous_pstate);
 }
 
 static void simulate_shutdown(msg_host_t host) {
 
-       int previous_pstate = MSG_host_get_pstate(host);
+  int previous_pstate = MSG_host_get_pstate(host);
 
-       XBT_INFO("Switch to virtual pstate 4, that encodes the shutting down state in the XML file of that example");
-       MSG_host_set_pstate(host,4);
+  XBT_INFO("Switch to virtual pstate 4, that encodes the shutting down state in the XML file of that example");
+  MSG_host_set_pstate(host,4);
 
-       msg_host_t host_list[1] = {host};
-       double flops_amount[1] = {1};
-       double bytes_amount[1] = {0};
+  msg_host_t host_list[1] = {host};
+  double flops_amount[1] = {1};
+  double bytes_amount[1] = {0};
 
-       XBT_INFO("Simulate the shutdown by executing one flop on that remote host (using a parallel task)");
-       msg_task_t shutdown = MSG_parallel_task_create("shutdown", 1, host_list, flops_amount, bytes_amount, NULL);
-       MSG_task_execute(shutdown);
-       MSG_task_destroy(shutdown);
+  XBT_INFO("Simulate the shutdown by executing one flop on that remote host (using a parallel task)");
+  msg_task_t shutdown = MSG_parallel_task_create("shutdown", 1, host_list, flops_amount, bytes_amount, NULL);
+  MSG_task_execute(shutdown);
+  MSG_task_destroy(shutdown);
 
-       XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
-       MSG_host_set_pstate(host, previous_pstate);
+  XBT_INFO("Switch back to previously selected pstate %d", previous_pstate);
+  MSG_host_set_pstate(host, previous_pstate);
 
-       XBT_INFO("Actually shutdown the host");
-       MSG_host_off(host);
+  XBT_INFO("Actually shutdown the host");
+  MSG_host_off(host);
 }
 
 static int onoff(int argc, char *argv[]) {
-       msg_host_t host1 = MSG_host_by_name("MyHost1");
+  msg_host_t host1 = MSG_host_by_name("MyHost1");
 
-       XBT_INFO("Energetic profile: %s",
-                       MSG_host_get_property_value(host1,"watt_per_state"));
-       XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J",
-                       MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Energetic profile: %s",
+          MSG_host_get_property_value(host1,"watt_per_state"));
+  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J",
+          MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
 
-       XBT_INFO("Sleep for 10 seconds");
-       MSG_process_sleep(10);
-       XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
-                       MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Sleep for 10 seconds");
+  MSG_process_sleep(10);
+  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
+          MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
 
-       simulate_shutdown(host1);
-       XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-                       MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  simulate_shutdown(host1);
+  XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+          MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
 
-       XBT_INFO("Sleep for 10 seconds");
-       MSG_process_sleep(10);
-       XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
-                       MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  XBT_INFO("Sleep for 10 seconds");
+  MSG_process_sleep(10);
+  XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J",
+          MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
 
-       simulate_bootup(host1);
-       XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-                       MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
+  simulate_bootup(host1);
+  XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
+          MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1));
 
 
-       return 0;
+  return 0;
 }
 
 int main(int argc, char *argv[])
 {
-       msg_error_t res = MSG_OK;
-       sg_energy_plugin_init();
-       MSG_init(&argc, argv);
+  msg_error_t res = MSG_OK;
+  sg_energy_plugin_init();
+  MSG_init(&argc, argv);
 
-       if (argc != 3) {
-               XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
-                               argv[0]);
-               XBT_CRITICAL
-               ("example: %s msg_platform.xml msg_deployment.xml\n",
-                               argv[0]);
-               exit(1);
-       }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+            argv[0], argv[0]);
 
-       MSG_create_environment(argv[1]);
+  MSG_create_environment(argv[1]);
 
-       /*   Application deployment */
-       MSG_function_register("onoff_test", onoff);
+  /*   Application deployment */
+  MSG_function_register("onoff_test", onoff);
 
-       MSG_launch_application(argv[2]);
+  MSG_launch_application(argv[2]);
 
-       res = MSG_main();
+  res = MSG_main();
 
-       XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
+  XBT_INFO("Total simulation time: %.2f", MSG_get_clock());
 
-       if (res == MSG_OK)
-               return 0;
-       else
-               return 1;
+  return res != MSG_OK;
 }
 
index 4594747..3e07790 100644 (file)
@@ -92,15 +92,10 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
 
-  if (argc != 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
-              argv[0]);
-    XBT_CRITICAL
-        ("example: %s msg_platform.xml msg_deployment.xml\n",
-         argv[0]);
-    exit(1);
-  }
-
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);
+  
   MSG_create_environment(argv[1]);
 
   /*   Application deployment */
@@ -112,9 +107,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Total simulation time: %e", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
 
index d4aefc4..943cc6c 100644 (file)
@@ -18,72 +18,68 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(energy_vm, "Messages of this example");
 
 
 static int worker_func() {
-       msg_task_t task1 = MSG_task_create("t1", 300E6, 0, NULL);
-       MSG_task_execute (task1);
-       MSG_task_destroy(task1);
-       XBT_INFO("This worker is done.");
-       return 0;
+  msg_task_t task1 = MSG_task_create("t1", 300E6, 0, NULL);
+  MSG_task_execute (task1);
+  MSG_task_destroy(task1);
+  XBT_INFO("This worker is done.");
+  return 0;
 }
 
 static int dvfs(int argc, char *argv[])
 {
-       msg_host_t host1 = MSG_host_by_name("MyHost1");
-       msg_host_t host2 = MSG_host_by_name("MyHost2");
-       msg_host_t host3 = MSG_host_by_name("MyHost3");
-
-       /* Host 1 */
-       XBT_INFO("Creating and starting two VMs");
-       msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 4, 2048, 100, NULL, 1024 * 20, 10,50);
-       MSG_vm_start(vm_host1);
-       msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 4, 2048, 100, NULL, 1024 * 20, 10,50);
-       MSG_vm_start(vm_host3);
-
-       XBT_INFO("Create two tasks on Host1: one inside a VM, the other directly on the host");
-       MSG_process_create("p11", worker_func, NULL, vm_host1);
-       MSG_process_create("p12", worker_func, NULL, host1);
-
-       XBT_INFO("Create two tasks on Host2: both directly on the host");
-       MSG_process_create("p21", worker_func, NULL, host2);
-       MSG_process_create("p22", worker_func, NULL, host2);
-
-       XBT_INFO("Create two tasks on Host3: both inside a VM");
-       MSG_process_create("p31", worker_func, NULL, vm_host3);
-       MSG_process_create("p32", worker_func, NULL, vm_host3);
-
-       XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)");
-       MSG_process_sleep(5);
-       XBT_INFO("Wait another 5 seconds. The tasks stop at some point in between");
-       MSG_process_sleep(5);
-
-       MSG_vm_shutdown(vm_host1);
-       MSG_vm_shutdown(vm_host3);
-
-       return 0;
+  msg_host_t host1 = MSG_host_by_name("MyHost1");
+  msg_host_t host2 = MSG_host_by_name("MyHost2");
+  msg_host_t host3 = MSG_host_by_name("MyHost3");
+
+  /* Host 1 */
+  XBT_INFO("Creating and starting two VMs");
+  msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 4, 2048, 100, NULL, 1024 * 20, 10,50);
+  MSG_vm_start(vm_host1);
+  msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 4, 2048, 100, NULL, 1024 * 20, 10,50);
+  MSG_vm_start(vm_host3);
+
+  XBT_INFO("Create two tasks on Host1: one inside a VM, the other directly on the host");
+  MSG_process_create("p11", worker_func, NULL, vm_host1);
+  MSG_process_create("p12", worker_func, NULL, host1);
+
+  XBT_INFO("Create two tasks on Host2: both directly on the host");
+  MSG_process_create("p21", worker_func, NULL, host2);
+  MSG_process_create("p22", worker_func, NULL, host2);
+
+  XBT_INFO("Create two tasks on Host3: both inside a VM");
+  MSG_process_create("p31", worker_func, NULL, vm_host3);
+  MSG_process_create("p32", worker_func, NULL, vm_host3);
+
+  XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, so they run for 6 seconds)");
+  MSG_process_sleep(5);
+  XBT_INFO("Wait another 5 seconds. The tasks stop at some point in between");
+  MSG_process_sleep(5);
+
+  MSG_vm_shutdown(vm_host1);
+  MSG_vm_shutdown(vm_host3);
+
+  return 0;
 }
 
 int main(int argc, char *argv[])
 {
-       msg_error_t res = MSG_OK;
-       sg_energy_plugin_init();
-       MSG_init(&argc, argv);
+  msg_error_t res = MSG_OK;
+  sg_energy_plugin_init();
+  MSG_init(&argc, argv);
 
-       if (argc != 2) {
-               XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
-               xbt_die("example: %s msg_platform.xml\n", argv[0]);
-       }
+  xbt_assert(argc > 1, "Usage: %s platform_file\n"
+            "\tExample: %s msg_platform.xml\n", 
+            argv[0], argv[0]);
 
-       MSG_create_environment(argv[1]);
+  MSG_create_environment(argv[1]);
 
-       /*   Application deployment */
-       MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1"));
+  /*   Application deployment */
+  MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1"));
 
-       res = MSG_main();
+  res = MSG_main();
 
-       XBT_INFO("Total simulation time: %.2f; All hosts must have the exact same energy consumption.", MSG_get_clock());
+  XBT_INFO("Total simulation time: %.2f; All hosts must have the exact same energy consumption.", MSG_get_clock());
 
-       if (res == MSG_OK)
-               return 0;
-       else
-               return 1;
+  return res != MSG_OK;
 }
 
index 7073d35..7d8af4a 100644 (file)
@@ -114,50 +114,18 @@ int main(int argc, char *argv[]) {
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
 
   MSG_function_register("terrorist", terrorist);
   MSG_create_environment(argv[1]);
   MSG_launch_application(argv[2]);
 
-  /*
-  // Simplistic platform with only one host
-  sg_platf_begin();
-  s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER;
-  sg_platf_new_AS_begin(&AS);
-
-  s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER;
-  host.id = "host0";
-  sg_platf_new_host(&host);
-
-  sg_platf_new_AS_end();
-  sg_platf_end();
-
-  // Add one process -- super heavy just to launch an application!
-  SIMIX_init_application();
-  sg_platf_begin();
-
-  s_sg_platf_process_cbarg_t process = SG_PLATF_PROCESS_INITIALIZER;
-  process.argc=1;
-  process.argv = malloc(sizeof(char*)*2);
-  process.argv[0] = "terrorist";
-  process.argv[1] = NULL;
-  process.host = "host0";
-  process.function = "terrorist";
-  process.start_time = 0;
-  sg_platf_new_process(&process);
-  sg_platf_end();
-*/
 
   // Launch the simulation
   res = MSG_main();
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 7ac2c13..771352d 100644 (file)
@@ -32,8 +32,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("GPU task %p was created", mytask);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index b43b74c..0b97a75 100644 (file)
@@ -230,15 +230,12 @@ int main(int argc, char *argv[])
   bool_printed = 0;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    exit(1);
-  }
-
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s platform.xml deployment.xml\n", 
+                 argv[0], argv[0]);
+   
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
+   
\ No newline at end of file
index 1251630..d36b412 100644 (file)
@@ -171,15 +171,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
+
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 22c4aff..ddd51ca 100644 (file)
@@ -127,15 +127,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
+
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 154fa9d..155b702 100644 (file)
@@ -158,15 +158,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                  "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+                  argv[0], argv[0]);
+   
   res = test_all(argv[1], argv[2]);
-
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+   
+  return res != MSG_OK;
+}
index cb5df55..e42f2b6 100644 (file)
@@ -121,9 +121,5 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index 7b8e965..34f7dc0 100644 (file)
@@ -69,9 +69,5 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index 0cfae31..5661b61 100644 (file)
@@ -102,8 +102,5 @@ int main(int argc, char **argv)
   xbt_dynar_free_container(&storages);
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 180ab8e..ddae501 100644 (file)
@@ -151,8 +151,5 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_main();
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index d46c5b5..9952786 100644 (file)
@@ -473,10 +473,9 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
 
   /* Check the arguments */
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file \n", argv[0]);
-    return -1;
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+            argv[0], argv[0]);
 
   const char *platform_file = argv[1];
   const char *deployment_file = argv[2];
@@ -491,8 +490,5 @@ int main(int argc, char *argv[])
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 27f1602..69634cf 100644 (file)
@@ -85,7 +85,9 @@ int slave(int argc, char *argv[])
     MSG_task_destroy(task);
     task = NULL;
   }
-  XBT_DEBUG("I'm done. See you!");
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);XBT_DEBUG("I'm done. See you!");
   return 0;
 }                               /* end_of_slave */                              /* end_of_test_all */
 
@@ -96,11 +98,9 @@ int main(int argc, char *argv[])
   long i;
 
   MSG_init(&argc, argv);
-  if (argc < 4) {
-    printf("Usage: %s platform_file number_of_jobs number_of_slaves\n", argv[0]);
-    printf("example: %s msg_platform.xml 10 5\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 3, "Usage: %s platform_file number_of_jobs number_of_slaves\n"
+                 "\tExample: %s msg_platform.xml 10 5\n", 
+                 argv[0], argv[0]);
 
   MSG_function_register("master", master);
   MSG_function_register("slave", slave);
@@ -138,8 +138,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 1ff3e3a..ecdf4cd 100644 (file)
@@ -287,8 +287,5 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
   res = test_all();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index e6bc021..8415bdb 100644 (file)
@@ -221,8 +221,5 @@ int main(int argc, char *argv[])
   MSG_init(&argc, argv);
   res = test_all(argv[1]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index ce4eec9..8acbc13 100644 (file)
@@ -204,15 +204,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);
+  
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 01e1eb7..6e01b3b 100644 (file)
@@ -207,15 +207,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);
+  
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 858e66b..316516e 100644 (file)
@@ -66,16 +66,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
-              argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", 
+                 argv[0], argv[0]);
+
   test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 7a5ddbb..ed1a0a7 100644 (file)
@@ -102,11 +102,10 @@ int main(int argc, char *argv[])
   const char *application_file;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                 argv[0], argv[0]);
+  
   platform_file = argv[1];
   application_file = argv[2];
 
@@ -122,8 +121,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 1a89dd9..8a6bd75 100644 (file)
@@ -76,12 +76,9 @@ int main(int argc, char *argv[])
 
   /* Argument checking */
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
-              argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", 
+                 argv[0], argv[0]);
 
   /* Simulation setting */
   MSG_create_environment(argv[1]);
@@ -99,8 +96,5 @@ int main(int argc, char *argv[])
   xbt_cond_destroy(cond);
   xbt_mutex_destroy(mutex);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 4a8b214..2338f16 100644 (file)
@@ -209,15 +209,12 @@ int main(int argc, char *argv[])
   bool_printed = 0;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s platform.xml deployment.xml\n", 
+                 argv[0], argv[0]);
+   
 
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 836be3a..51a5b23 100644 (file)
@@ -95,15 +95,9 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 2) {
-    printf("Usage: %s platform_file\n", argv[0]);
-    printf("example: %s msg_platform.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 1, "Usage: %s platform_file\n"
+            "\tExample: %s msg_platform.xml", argv[0], argv[0]);
   res = test_all(argv[1]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 1618944..245990e 100644 (file)
@@ -158,14 +158,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+            argv[0], argv[0]);
+
   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 1627a37..131e8e7 100644 (file)
@@ -613,11 +613,10 @@ static int node(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
-    printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, 
+            "Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n"
+            "\tExample: %s ../msg_platform.xml pastry10.xml\n", 
+            argv[0], argv[0]);
   
   char **options = &argv[1];
   while (!strncmp(options[0], "-", 1)) {
@@ -653,9 +652,5 @@ int main(int argc, char *argv[])
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index 61ca06c..444aff3 100644 (file)
@@ -295,10 +295,7 @@ int main(int argc, char *argv[])
 #endif
   XBT_CRITICAL("Simulated time: %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
 
 static void create_jobs(xbt_matrix_t A, xbt_matrix_t B, node_job_t *jobs)
index f1efaa6..6cc0b81 100644 (file)
@@ -74,19 +74,15 @@ int main(int argc, char *argv[])
 
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
+  
   res = test_all(argv[1], argv[2]);
 
 #ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
 #endif
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index c77494e..9417692 100644 (file)
@@ -156,15 +156,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    printf("Usage: %s platform_file deployment_file\n", argv[0]);
-    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
-    exit(1);
-  }
-  res = test_all(argv[1], argv[2]);
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
+   res = test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 63b14f7..9b054bb 100644 (file)
@@ -161,11 +161,8 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
 
-  if (argc != 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n",
-              argv[0]);
-    xbt_die("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
 
   res = test_all(argv[1], argv[2]);
 
@@ -175,8 +172,5 @@ int main(int argc, char *argv[])
   _set_output_format(prev_exponent_format);
 #endif
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 3ade8f0..014059b 100644 (file)
@@ -50,16 +50,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
-              argv[0]);
-    exit(1);
-  }
+   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+                argv[0], argv[0]);
+  
   test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index c26e38f..19e5b84 100644 (file)
@@ -101,16 +101,11 @@ int main(int argc, char *argv[])
   msg_error_t res = MSG_OK;
 
   MSG_init(&argc, argv);
-  if (argc < 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
-              argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
+                 "\tExample: %s msg_platform.xml msg_deployment_suspend.xml\n", 
+                 argv[0], argv[0]);
+
   test_all(argv[1], argv[2]);
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-}                               /* end_of_main */
+  return res != MSG_OK;
+}
index 955c4b9..6b00f34 100644 (file)
@@ -80,9 +80,5 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index 64e840d..f4eb5dc 100644 (file)
@@ -123,9 +123,5 @@ int main(int argc, char **argv)
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index eb43030..427b45f 100644 (file)
@@ -109,7 +109,8 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-            "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
+            "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+            argv[0], argv[0]);
   
   platform_file = argv[1];
   application_file = argv[2];