From 9781128d5ada2d9e8b28e61c7e7b3f19bc303af5 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Wed, 19 Jun 2019 15:45:06 -0700 Subject: Deflake mount_test. Inode ids are only stable across Save/Restore if we have an open FD on the inode. All tests that compare inode ids must therefor hold an FD open. PiperOrigin-RevId: 254086603 --- test/syscalls/linux/mount.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/syscalls/linux/mount.cc') diff --git a/test/syscalls/linux/mount.cc b/test/syscalls/linux/mount.cc index 3a17672aa..e35be3cab 100644 --- a/test/syscalls/linux/mount.cc +++ b/test/syscalls/linux/mount.cc @@ -190,6 +190,14 @@ TEST(MountTest, MountTmpfs) { SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); auto const dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir()); + + // NOTE(b/129868551): Inode IDs are only stable across S/R if we have an open + // FD for that inode. Since we are going to compare inode IDs below, get a + // FileDescriptor for this directory here, which will be closed automatically + // at the end of the test. + auto const fd = + ASSERT_NO_ERRNO_AND_VALUE(Open(dir.path(), O_DIRECTORY, O_RDONLY)); + const struct stat before = ASSERT_NO_ERRNO_AND_VALUE(Stat(dir.path())); { -- cgit v1.2.3