X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aa64bb0b015da853b7f904a9384cfa14cf42326f..28b9e83a90c238b71d27f5cb3c6596906a3d4641:/src/mc/sosp/Snapshot_test.cpp diff --git a/src/mc/sosp/Snapshot_test.cpp b/src/mc/sosp/Snapshot_test.cpp index 3d9bb72480..95c10a06ab 100644 --- a/src/mc/sosp/Snapshot_test.cpp +++ b/src/mc/sosp/Snapshot_test.cpp @@ -1,9 +1,9 @@ -/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2014-2023. The SimGrid Team. All rights reserved. */ /* 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 "src/include/catch.hpp" +#include "src/3rd-party/catch.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/sosp/Snapshot.hpp" @@ -15,6 +15,8 @@ /**************** Class BOOST_tests *************************/ using simgrid::mc::Region; class snap_test_helper { + static simgrid::mc::PageStore page_store_; + public: static void init_memory(void* mem, size_t size); static void Init(); @@ -38,11 +40,12 @@ public: mc_model_checker = nullptr; } - static std::unique_ptr process; + static std::unique_ptr process; }; // static member variables init. -std::unique_ptr snap_test_helper::process = nullptr; +std::unique_ptr snap_test_helper::process = nullptr; +simgrid::mc::PageStore snap_test_helper::page_store_(500); void snap_test_helper::init_memory(void* mem, size_t size) { @@ -57,8 +60,8 @@ void snap_test_helper::Init() REQUIRE(xbt_pagesize == getpagesize()); REQUIRE(1 << xbt_pagebits == xbt_pagesize); - process = std::make_unique(getpid()); - process->init(nullptr, nullptr, nullptr); + process = std::make_unique(getpid()); + process->init(nullptr); mc_model_checker = new ::simgrid::mc::ModelChecker(std::move(process), -1); } @@ -72,11 +75,11 @@ snap_test_helper::prologue_return snap_test_helper::prologue(int n) // Init memory and take snapshots: init_memory(source, byte_size); - auto* region0 = new simgrid::mc::Region(simgrid::mc::RegionType::Data, source, byte_size); + auto* region0 = new simgrid::mc::Region(page_store_, simgrid::mc::RegionType::Data, source, byte_size); for (int i = 0; i < n; i += 2) { init_memory((char*)source + i * xbt_pagesize, xbt_pagesize); } - auto* region = new simgrid::mc::Region(simgrid::mc::RegionType::Data, source, byte_size); + auto* region = new simgrid::mc::Region(page_store_, simgrid::mc::RegionType::Data, source, byte_size); void* destination = mmap(nullptr, byte_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); INFO("Could not allocate destination memory"); @@ -158,7 +161,7 @@ void snap_test_helper::read_pointer() { prologue_return ret = prologue(1); memcpy(ret.src, &mc_model_checker, sizeof(void*)); - const simgrid::mc::Region region2(simgrid::mc::RegionType::Data, ret.src, ret.size); + const simgrid::mc::Region region2(page_store_, simgrid::mc::RegionType::Data, ret.src, ret.size); INFO("Mismtach in MC_region_read_pointer()"); REQUIRE(MC_region_read_pointer(®ion2, ret.src) == mc_model_checker);