| 42 | namespace { |
| 43 | |
| 44 | TEST(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 | |
| 76 | TEST(MemoryMap, SelfBasic) { |
| 77 | ScopedMmap mmapping; |
nothing calls this directly
no test coverage detected