Internal change.

PiperOrigin-RevId: 674050572
This commit is contained in:
gVisor bot
2024-09-12 16:21:59 -07:00
parent 684a1c8665
commit 2da6847b5d
+4 -6
View File
@@ -1211,16 +1211,14 @@ TEST_F(MMapFileTest, WriteSharedTruncateUp) {
std::string first(kPageSize / 2, 'A');
memcpy(reinterpret_cast<void*>(addr), first.c_str(), first.size());
// Second half; this is not reflected in the file now (see
// WriteSharedBeyondEnd), but will be after the truncate.
// Extend the file to a full page.
EXPECT_THAT(ftruncate(fd_.get(), kPageSize), SyscallSucceeds());
// Second half; this will be reflected in the file now.
std::string second(kPageSize / 2, 'B');
memcpy(reinterpret_cast<void*>(addr + kPageSize / 2), second.c_str(),
second.size());
// Extend the file to a full page. The second half of the page will be
// reflected in the file.
EXPECT_THAT(ftruncate(fd_.get(), kPageSize), SyscallSucceeds());
// The file may not actually be updated until munmap is called.
ASSERT_THAT(Unmap(), SyscallSucceeds());