From 2da6847b5d9e5d3d289b31d817e28f9b307bf419 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 12 Sep 2024 16:18:00 -0700 Subject: [PATCH] Internal change. PiperOrigin-RevId: 674050572 --- test/syscalls/linux/mmap.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/syscalls/linux/mmap.cc b/test/syscalls/linux/mmap.cc index e9892e5dc..b07c3e4a3 100644 --- a/test/syscalls/linux/mmap.cc +++ b/test/syscalls/linux/mmap.cc @@ -1211,16 +1211,14 @@ TEST_F(MMapFileTest, WriteSharedTruncateUp) { std::string first(kPageSize / 2, 'A'); memcpy(reinterpret_cast(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(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());