summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-12 13:11:01 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-12 13:11:01 -0700
commiteff2c264a48611a714cb89f28693a18ac029886a (patch)
treec1adf06c534a2ce971efe52b13d2422acdd436a4 /test/syscalls/linux
parent69e0affaecda24b4d193e4592202b55b53afecc3 (diff)
parentf957fb23cf68e72084c7b50569242a07997f96bc (diff)
Merge pull request #282 from zhangningdlut:chris_test_proc
PiperOrigin-RevId: 257855479
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r--test/syscalls/linux/proc.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc
index 490bf4424..b440ba0df 100644
--- a/test/syscalls/linux/proc.cc
+++ b/test/syscalls/linux/proc.cc
@@ -1964,6 +1964,22 @@ TEST(ProcPid, RootDumpableOwner) {
EXPECT_THAT(st.st_gid, AnyOf(Eq(0), Eq(65534)));
}
+TEST(Proc, GetdentsEnoent) {
+ FileDescriptor fd;
+ ASSERT_NO_ERRNO(WithSubprocess(
+ [&](int pid) -> PosixError {
+ // Running.
+ ASSIGN_OR_RETURN_ERRNO(fd, Open(absl::StrCat("/proc/", pid, "/task"),
+ O_RDONLY | O_DIRECTORY));
+
+ return NoError();
+ },
+ nullptr, nullptr));
+ char buf[1024];
+ ASSERT_THAT(syscall(SYS_getdents, fd.get(), buf, sizeof(buf)),
+ SyscallFailsWithErrno(ENOENT));
+}
+
} // namespace
} // namespace testing
} // namespace gvisor