Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug leaks in low level tests
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 17 Jul 2017 12:16:47 +0000 (14:16 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 17 Jul 2017 12:16:47 +0000 (14:16 +0200)
adding a higher level init function ensures that all data structures
are correctly deallocated.
Would be better to not allocate them at all (dict of mailboxes for
instance), but no user won't ever write XBT or SURF test, will they?

teshsuite/surf/lmm_usage/lmm_usage.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/xbt/heap_bench/heap_bench.c
teshsuite/xbt/log_large/log_large.c

index 01a2dfa..ce8eac5 100644 (file)
@@ -6,12 +6,13 @@
 /* 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. */
 
 /* 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. */
 
-#include "xbt/sysdep.h"
+#include "simgrid/msg.h"
+#include "src/surf/surf_interface.hpp"
 #include "surf/maxmin.h"
 #include "xbt/log.h"
 #include "xbt/module.h"
 #include "surf/maxmin.h"
 #include "xbt/log.h"
 #include "xbt/module.h"
+#include "xbt/sysdep.h"
 #include <math.h>
 #include <math.h>
-#include "src/surf/surf_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
@@ -298,8 +299,9 @@ static void test3(method_t method)
   xbt_free(A);
 }
 
   xbt_free(A);
 }
 
-int main()
+int main(int argc, char** argv)
 {
 {
+  MSG_init(&argc, argv);
   XBT_INFO("***** Test 1 (Max-Min)");
   test1(MAXMIN);
   XBT_INFO("***** Test 1 (Lagrange - Vegas)");
   XBT_INFO("***** Test 1 (Max-Min)");
   test1(MAXMIN);
   XBT_INFO("***** Test 1 (Lagrange - Vegas)");
index c4972b2..aed2abb 100644 (file)
@@ -7,9 +7,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf/maxmin.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf/maxmin.h"
+#include "simgrid/msg.h"
 #include "xbt/module.h"
 #include "xbt/module.h"
+#include "xbt/sysdep.h" /* time manipulation for benchmarking */
 #include "xbt/xbt_os_time.h"
 #include "xbt/xbt_os_time.h"
-#include "xbt/sysdep.h"         /* time manipulation for benchmarking */
 
 #define MYRANDMAX 1000
 
 
 #define MYRANDMAX 1000
 
@@ -117,6 +118,8 @@ unsigned int TestClasses [][4]=
 
 int main(int argc, char **argv)
 {
 
 int main(int argc, char **argv)
 {
+  MSG_init(&argc, argv);
+
   float rate_no_limit=0.2;
   float acc_date=0;
   float acc_date2=0;
   float rate_no_limit=0.2;
   float acc_date=0;
   float acc_date2=0;
index 3d2c542..47797d2 100644 (file)
@@ -10,6 +10,7 @@
 #include <math.h>
 #include <xbt/xbt_os_time.h>
 
 #include <math.h>
 #include <xbt/xbt_os_time.h>
 
+#include "simgrid/msg.h"
 #include "xbt/heap.h"
 #include "xbt/sysdep.h"
 
 #include "xbt/heap.h"
 #include "xbt/sysdep.h"
 
@@ -89,10 +90,11 @@ static void test_heap_mean_operation(int size)
   xbt_heap_free(heap);
 }
 
   xbt_heap_free(heap);
 }
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
 {
-  int size;
-  for (size = 100; size < 10000; size *= 10) {
+  MSG_init(&argc, argv);
+
+  for (int size = 100; size < 10000; size *= 10) {
     test_heap_validity(size);
     test_heap_mean_operation(size);
   }
     test_heap_validity(size);
     test_heap_mean_operation(size);
   }
index 9eeec68..3abb24a 100644 (file)
@@ -7,11 +7,13 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
+#include <simgrid/msg.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
 
 int main(int argc, char *argv[])
 {
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
 
 int main(int argc, char *argv[])
 {
+  MSG_init(&argc, argv);
   char *tmp = bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
     1, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     2, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
   char *tmp = bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
     1, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     2, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
@@ -24,8 +26,6 @@ int main(int argc, char *argv[])
     9, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     0, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
 
     9, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
     0, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
 
-  xbt_init(&argc, argv);
-
   XBT_INFO("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",
          tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp);
   XBT_INFO("Done (strlen>%d)", (int) (10 * strlen(tmp)));
   XBT_INFO("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",
          tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp);
   XBT_INFO("Done (strlen>%d)", (int) (10 * strlen(tmp)));