diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-28 12:22:00 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-28 12:24:37 -0800 |
commit | d8c330254a7df21cb5edac3440b62a512fcc8d2d (patch) | |
tree | 7c37b273cca0389da1375c7984cbd5fd21c01952 /test/syscalls/linux/sync.cc | |
parent | 449c155bc00aa36522f80f816b18e9a9521e1fe6 (diff) |
Add O_PATH support in vfs2
PiperOrigin-RevId: 354367665
Diffstat (limited to 'test/syscalls/linux/sync.cc')
-rw-r--r-- | test/syscalls/linux/sync.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/syscalls/linux/sync.cc b/test/syscalls/linux/sync.cc index 8aa2525a9..84a2c4ed7 100644 --- a/test/syscalls/linux/sync.cc +++ b/test/syscalls/linux/sync.cc @@ -49,10 +49,20 @@ TEST(SyncTest, SyncFromPipe) { EXPECT_THAT(close(pipes[1]), SyscallSucceeds()); } -TEST(SyncTest, CannotSyncFileSytemAtBadFd) { +TEST(SyncTest, CannotSyncFileSystemAtBadFd) { EXPECT_THAT(syncfs(-1), SyscallFailsWithErrno(EBADF)); } +TEST(SyncTest, CannotSyncFileSystemAtOpathFD) { + SKIP_IF(IsRunningWithVFS1()); + + const TempPath file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFileWith( + GetAbsoluteTestTmpdir(), "", TempPath::kDefaultFileMode)); + const FileDescriptor fd = + ASSERT_NO_ERRNO_AND_VALUE(Open(file.path(), O_PATH)); + + EXPECT_THAT(syncfs(fd.get()), SyscallFailsWithErrno(EBADF)); +} } // namespace } // namespace testing |