summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-06-19 15:45:06 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-19 15:46:11 -0700
commit9781128d5ada2d9e8b28e61c7e7b3f19bc303af5 (patch)
tree1d8f28adf87f26dde577f1beb499194168b19256 /test/syscalls
parent773423a997eb19c48942ccb8a390be72bbd9d5e1 (diff)
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
Diffstat (limited to 'test/syscalls')
-rw-r--r--test/syscalls/linux/mount.cc8
1 files changed, 8 insertions, 0 deletions
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()));
{