Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : move functions about snapshot comparison in a separate file mc_compare.c
[simgrid.git] / src / mc / test / compare_snapshot.c
index 59d2e64..d8ad53b 100644 (file)
@@ -21,11 +21,11 @@ static void test1()
   mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1);
   MC_take_snapshot_liveness(snapshot2);
 
   mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1);
   MC_take_snapshot_liveness(snapshot2);
 
-  MC_UNSET_RAW_MEM;
-
   int res = snapshot_compare(snapshot1, snapshot2);
   xbt_assert(res == 0);
 
   int res = snapshot_compare(snapshot1, snapshot2);
   xbt_assert(res == 0);
 
+  MC_UNSET_RAW_MEM;
+
   fprintf(stderr, "\n**************** END TEST 1 ****************\n");
 
   MC_SET_RAW_MEM;
   fprintf(stderr, "\n**************** END TEST 1 ****************\n");
 
   MC_SET_RAW_MEM;
@@ -49,8 +49,9 @@ static void test2()
 
   MC_UNSET_RAW_MEM;
 
 
   MC_UNSET_RAW_MEM;
 
-  char* t = strdup("toto");
-
+  char* t = malloc(50);
+  t = strdup("toto");
   MC_SET_RAW_MEM;
 
   /* Save second snapshot */
   MC_SET_RAW_MEM;
 
   /* Save second snapshot */
@@ -87,7 +88,8 @@ static void test3()
 
   MC_UNSET_RAW_MEM;
 
 
   MC_UNSET_RAW_MEM;
 
-  char *t = strdup("toto");;
+  char *t = malloc(5);
+  t = strdup("toto");
   free(t);
 
   MC_SET_RAW_MEM;
   free(t);
 
   MC_SET_RAW_MEM;
@@ -116,7 +118,8 @@ static void test4()
 
   fprintf(stderr, "\n**************** TEST 4 ****************\n\n");
 
 
   fprintf(stderr, "\n**************** TEST 4 ****************\n\n");
 
-  char *t = strdup("toto");
+  char *t = malloc(5);
+  t = strdup("toto");
 
   MC_SET_RAW_MEM;
 
 
   MC_SET_RAW_MEM;
 
@@ -237,7 +240,13 @@ void MC_test_snapshot_comparison(){
   MC_take_snapshot_liveness(initial); 
   MC_UNSET_RAW_MEM;
 
   MC_take_snapshot_liveness(initial); 
   MC_UNSET_RAW_MEM;
 
+  /* Get .plt section (start and end addresses) for data libsimgrid comparison */
+  get_plt_section();
+
   test1();
   test1();
+
+  MC_restore_snapshot(initial);
+  MC_UNSET_RAW_MEM;
   
   test2();
   
   
   test2();
   
@@ -260,4 +269,7 @@ void MC_test_snapshot_comparison(){
   MC_UNSET_RAW_MEM;
   
   test6();
   MC_UNSET_RAW_MEM;
   
   test6();
+
+  MC_restore_snapshot(initial);
+  MC_UNSET_RAW_MEM;
 }
 }