MCPcopy Create free account
hub / github.com/chromium/crashpad / TEST

Function TEST

util/linux/memory_map_test.cc:44–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42namespace {
43
44TEST(MemoryMap, SelfLargeFiles) {
45 // This test is meant to test the handler's ability to understand files
46 // mapped from large offsets, even if the handler wasn't built with
47 // _FILE_OFFSET_BITS=64. ScopedTempDir needs to stat files to determine
48 // whether to recurse into directories, which may will fail without large file
49 // support. ScopedRemoveFile doesn't have that restriction.
50 ScopedTempDir dir;
51 ScopedRemoveFile large_file_path(dir.path().Append("crashpad_test_file"));
52 ScopedFileHandle handle(
53 LoggingOpenFileForReadAndWrite(large_file_path.get(),
54 FileWriteMode::kCreateOrFail,
55 FilePermissions::kWorldReadable));
56 ASSERT_TRUE(handle.is_valid());
57
58 // sys_fallocate supports large files as long as the kernel supports them,
59 // regardless of _FILE_OFFSET_BITS.
60 off64_t off = 1llu + UINT32_MAX;
61 ASSERT_EQ(sys_fallocate(handle.get(), 0, off, getpagesize()), 0)
62 << ErrnoMessage("fallocate");
63
64 ScopedMmap mapping;
65 void* addr = sys_mmap(
66 nullptr, getpagesize(), PROT_READ, MAP_SHARED, handle.get(), off);
67 ASSERT_TRUE(addr);
68 ASSERT_TRUE(mapping.ResetAddrLen(addr, getpagesize()));
69
70 FakePtraceConnection connection;
71 ASSERT_TRUE(connection.Initialize(getpid()));
72 MemoryMap map;
73 ASSERT_TRUE(map.Initialize(&connection));
74}
75
76TEST(MemoryMap, SelfBasic) {
77 ScopedMmap mmapping;

Callers

nothing calls this directly

Calls 15

ErrnoMessageFunction · 0.85
InitializeMappingsFunction · 0.85
ExpectMappingsFunction · 0.85
InitializeFileFunction · 0.85
AppendMethod · 0.80
pathMethod · 0.80
ResetAddrLenMethod · 0.80
ResetMmapMethod · 0.80
FindMappingMethod · 0.80
EndMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected