From 4f665a8da58b767297d57983f2e178f022dcf0a4 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 12 May 2023 10:39:47 -0700 Subject: [PATCH] Internal change. PiperOrigin-RevId: 531546285 --- test/syscalls/linux/inotify.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/test/syscalls/linux/inotify.cc b/test/syscalls/linux/inotify.cc index 154a86522..07fd89c63 100644 --- a/test/syscalls/linux/inotify.cc +++ b/test/syscalls/linux/inotify.cc @@ -374,20 +374,27 @@ TEST(Inotify, NonBlockingReadReturnsEagain) { TEST(Inotify, AddWatchOnInvalidFdFails) { // Garbage fd. - EXPECT_THAT(inotify_add_watch(-1, "/tmp", IN_ALL_EVENTS), - SyscallFailsWithErrno(EBADF)); - EXPECT_THAT(inotify_add_watch(1337, "/tmp", IN_ALL_EVENTS), - SyscallFailsWithErrno(EBADF)); + EXPECT_THAT( + inotify_add_watch(-1, GetAbsoluteTestTmpdir().c_str(), IN_ALL_EVENTS), + SyscallFailsWithErrno(EBADF)); + EXPECT_THAT( + inotify_add_watch(1337, GetAbsoluteTestTmpdir().c_str(), IN_ALL_EVENTS), + SyscallFailsWithErrno(EBADF)); // Non-inotify fds. - EXPECT_THAT(inotify_add_watch(0, "/tmp", IN_ALL_EVENTS), - SyscallFailsWithErrno(EINVAL)); - EXPECT_THAT(inotify_add_watch(1, "/tmp", IN_ALL_EVENTS), - SyscallFailsWithErrno(EINVAL)); - EXPECT_THAT(inotify_add_watch(2, "/tmp", IN_ALL_EVENTS), - SyscallFailsWithErrno(EINVAL)); - const FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE(Open("/tmp", O_RDONLY)); - EXPECT_THAT(inotify_add_watch(fd.get(), "/tmp", IN_ALL_EVENTS), + EXPECT_THAT( + inotify_add_watch(0, GetAbsoluteTestTmpdir().c_str(), IN_ALL_EVENTS), + SyscallFailsWithErrno(EINVAL)); + EXPECT_THAT( + inotify_add_watch(1, GetAbsoluteTestTmpdir().c_str(), IN_ALL_EVENTS), + SyscallFailsWithErrno(EINVAL)); + EXPECT_THAT( + inotify_add_watch(2, GetAbsoluteTestTmpdir().c_str(), IN_ALL_EVENTS), + SyscallFailsWithErrno(EINVAL)); + const FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE( + Open(GetAbsoluteTestTmpdir().c_str(), O_RDONLY)); + EXPECT_THAT(inotify_add_watch(fd.get(), GetAbsoluteTestTmpdir().c_str(), + IN_ALL_EVENTS), SyscallFailsWithErrno(EINVAL)); }