Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
improve coverage in teshsuite
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 22 Jan 2016 14:31:05 +0000 (15:31 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 22 Jan 2016 15:50:06 +0000 (16:50 +0100)
14 files changed:
teshsuite/mc/mutex_handling.c
teshsuite/msg/get_sender/get_sender.c
teshsuite/msg/host_on_off/host_on_off.c
teshsuite/msg/host_on_off/host_on_off_recv.c
teshsuite/msg/host_on_off/host_on_off_wait.c
teshsuite/msg/host_on_off_processes/host_on_off_processes.c
teshsuite/msg/pid/pid.c
teshsuite/msg/process/process.c
teshsuite/msg/process_join/process_join.c
teshsuite/msg/storage/concurrent_rw.c
teshsuite/msg/storage/storage_basic.c
teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c
teshsuite/msg/trace/test_trace_integration.c
teshsuite/simdag/platforms/basic_tracing.c

index 4db2783..d5aad96 100644 (file)
@@ -65,12 +65,10 @@ static int sender(int argc, char *argv[])
 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);
-  }
-  const char *platform_file = argv[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 *application_file = argv[2];
   MSG_create_environment(platform_file);
   MSG_function_register("receiver", receiver);
@@ -86,8 +84,5 @@ int main(int argc, char *argv[])
 #endif
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
\ No newline at end of file
index 68bd184..592f13a 100644 (file)
@@ -47,8 +47,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(argv[2]);
   res = MSG_main();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 9d6544d..eb43030 100644 (file)
@@ -108,11 +108,9 @@ 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];
 
@@ -129,8 +127,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 3763cac..73adf38 100644 (file)
@@ -85,11 +85,9 @@ 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];
 
@@ -105,8 +103,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 5c35cb9..a3d829e 100644 (file)
@@ -64,11 +64,9 @@ 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];
 
@@ -85,8 +83,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 0b19a41..c6e8222 100644 (file)
@@ -274,8 +274,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 8542e30..66c27dc 100644 (file)
@@ -62,8 +62,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(argv[2]);
   res = MSG_main();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 2339ebc..18cf2d1 100644 (file)
@@ -78,11 +78,9 @@ 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 == 3, "Usage: %s platform_file deployment_file\n"
+            "\n Example: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
   platform_file = argv[1];
   application_file = argv[2];
 
@@ -99,8 +97,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index 7fcb141..e6d8f78 100644 (file)
@@ -65,11 +65,9 @@ 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 == 3, "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];
 
@@ -86,8 +84,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index c3c02d7..201d8bc 100644 (file)
@@ -130,9 +130,5 @@ int main(int argc, char **argv)
   storage_info(MSG_host_by_name(xbt_strdup("host")));
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
-
+  return res != MSG_OK;
 }
index 63f322d..c19be28 100644 (file)
@@ -205,10 +205,7 @@ 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", argv[0]);
 
   const char *platform_file = argv[1];
   const char *deployment_file = argv[2];
@@ -222,8 +219,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 cc9ea1c..112c719 100644 (file)
@@ -144,11 +144,9 @@ 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];
 
@@ -165,8 +163,5 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }                               /* end_of_main */
index e06af1d..ff5292c 100644 (file)
@@ -53,10 +53,7 @@ int main(int argc, char *argv[])
 
   /* Verify if the platform xml file was passed by command line. */
   MSG_init(&argc, argv);
-  if (argc < 2) {
-    printf("Usage: %s test_trace_integration_model.xml\n", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 2, "Usage: %s test_trace_integration_model.xml deployment.xml\n", argv[0]);
 
   /* Register SimGrid process function. */
   MSG_function_register("test_trace", test_trace);
@@ -66,8 +63,5 @@ int main(int argc, char *argv[])
   /* Run the example. */
   res = MSG_main();
 
-  if (res == MSG_OK)
-    return 0;
-  else
-    return 1;
+  return res != MSG_OK;
 }
index 006ab59..5b8db61 100644 (file)
@@ -35,8 +35,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;
 }