Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix MC_free_object
[simgrid.git] / src / mc / mc_snapshot.cpp
index 82b6ab8..7c587f9 100644 (file)
@@ -12,7 +12,7 @@
 #include "mc_snapshot.h"
 #include "mc_private.h"
 #include "mc_mmu.h"
-#include "mc_page_store.h"
+#include "PageStore.hpp"
 
 extern "C" {
 
@@ -193,17 +193,15 @@ static inline void init_memory(void* mem, size_t size)
 
 static void test_snapshot(bool sparse_checkpoint);
 
-XBT_TEST_UNIT("page_snapshots", test_per_snpashots, "Test per-page snapshots")
-{
-  test_snapshot(1);
-}
-
-
 XBT_TEST_UNIT("flat_snapshot", test_flat_snapshots, "Test flat snapshots")
 {
   test_snapshot(0);
 }
 
+XBT_TEST_UNIT("page_snapshots", test_per_snpashots, "Test per-page snapshots")
+{
+  test_snapshot(1);
+}
 
 static void test_snapshot(bool sparse_checkpoint) {
 
@@ -211,8 +209,7 @@ static void test_snapshot(bool sparse_checkpoint) {
   _sg_mc_sparse_checkpoint = sparse_checkpoint;
   xbt_assert(xbt_pagesize == getpagesize());
   xbt_assert(1 << xbt_pagebits == xbt_pagesize);
-  mc_model_checker = xbt_new0(s_mc_model_checker_t, 1);
-  mc_model_checker->pages = mc_pages_store_new();
+  mc_model_checker = new ::simgrid::mc::ModelChecker(getpid(), -1);
 
   for(int n=1; n!=256; ++n) {
 
@@ -235,7 +232,7 @@ static void test_snapshot(bool sparse_checkpoint) {
     xbt_assert(source!=MAP_FAILED, "Could not allocate destination memory");
 
     xbt_test_add("Reading whole region data for %i page(s)", n);
-    const void* read = MC_region_read(region, source, destination, byte_size);
+    const void* read = MC_region_read(region, destination, source, byte_size);
     xbt_test_assert(!memcmp(source, read, byte_size), "Mismatch in MC_region_read()");
 
     xbt_test_add("Reading parts of region data for %i page(s)", n);
@@ -285,8 +282,7 @@ static void test_snapshot(bool sparse_checkpoint) {
     munmap(source, byte_size);
   }
 
-  mc_pages_store_delete(mc_model_checker->pages);
-  xbt_free(mc_model_checker);
+  delete mc_model_checker;
   mc_model_checker = NULL;
 }