MCPcopy Create free account
hub / github.com/baidu/babylon / SetUp

Method SetUp

test/test_mlock.cpp:26–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25struct MemoryLockerTest : public ::testing::Test {
26 virtual void SetUp() override {
27 file_name = "mlock_" + ::std::to_string(getpid());
28 fd = ::open(file_name.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
29 ASSERT_EQ(0, ::ftruncate(fd, REGION_SIZE));
30 region = ::mmap(nullptr, REGION_SIZE, PROT_READ, MAP_PRIVATE, fd, 0);
31 MemoryLocker::instance().set_check_interval(::std::chrono::seconds(1));
32 MemoryLocker::instance().set_filter([this](StringView path) {
33 return nullptr == strstr(path.data(), file_name.c_str());
34 });
35 }
36
37 virtual void TearDown() override {
38 ::munmap(region, REGION_SIZE);

Callers

nothing calls this directly

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected