Skip to content

Commit 6f0a7de

Browse files
committed
Add regression test for google#128 (fixed in ab6774c)
Tests run at HEAD (35719d5): ``` $ bazel test $(bazel query 'filter(".*getdents.*", //test/syscalls:all)') <snip> //test/syscalls:getdents_test_native PASSED in 0.3s //test/syscalls:getdents_test_runsc_ptrace PASSED in 4.9s //test/syscalls:getdents_test_runsc_ptrace_overlay PASSED in 4.7s //test/syscalls:getdents_test_runsc_ptrace_shared PASSED in 5.2s //test/syscalls:getdents_test_runsc_kvm FAILED in 4.0s ``` Tests run at ab6774c~1 (6f933a9): ``` $ bazel test $(bazel query 'filter(".*getdents.*", //test/syscalls:all)') //test/syscalls:getdents_test_native PASSED in 0.2s //test/syscalls:getdents_test_runsc_kvm FAILED in 4.2s /usr/local/google/home/brb/.cache/bazel/_bazel_brb/967240a6aae7d353a221d73f4375e038/execroot/__main__/bazel-out/k8-fastbuild/testlogs/test/syscalls/getdents_test_runsc_kvm/test.log //test/syscalls:getdents_test_runsc_ptrace FAILED in 5.3s /usr/local/google/home/brb/.cache/bazel/_bazel_brb/967240a6aae7d353a221d73f4375e038/execroot/__main__/bazel-out/k8-fastbuild/testlogs/test/syscalls/getdents_test_runsc_ptrace/test.log //test/syscalls:getdents_test_runsc_ptrace_overlay FAILED in 4.9s /usr/local/google/home/brb/.cache/bazel/_bazel_brb/967240a6aae7d353a221d73f4375e038/execroot/__main__/bazel-out/k8-fastbuild/testlogs/test/syscalls/getdents_test_runsc_ptrace_overlay/test.log //test/syscalls:getdents_test_runsc_ptrace_shared FAILED in 5.2s /usr/local/google/home/brb/.cache/bazel/_bazel_brb/967240a6aae7d353a221d73f4375e038/execroot/__main__/bazel-out/k8-fastbuild/testlogs/test/syscalls/getdents_test_runsc_ptrace_shared/test.log ``` (I think all runsc_kvm tests are broken on my machine -- I'll rerun them if you can point me at the documentation to set it up)
1 parent 35719d5 commit 6f0a7de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/syscalls/linux/getdents.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,19 @@ TYPED_TEST(GetdentsTest, SeekResetsCursor) {
437437
EXPECT_EQ(expect, this->ReadAndCountAllEntries(&dirents));
438438
}
439439

440+
// Test that getdents() after SEEK_END succeeds.
441+
// This is a regression test for #128.
442+
TYPED_TEST(GetdentsTest, Issue128ProcSeekEnd) {
443+
auto fd =
444+
ASSERT_NO_ERRNO_AND_VALUE(Open("/proc/self", O_RDONLY | O_DIRECTORY));
445+
typename TestFixture::DirentBufferType dirents(256);
446+
447+
ASSERT_THAT(lseek(fd.get(), 0, SEEK_END), SyscallSucceeds());
448+
ASSERT_THAT(RetryEINTR(syscall)(this->SyscallNum(), fd.get(), dirents.Data(),
449+
dirents.Size()),
450+
SyscallSucceeds());
451+
}
452+
440453
// Some tests using the glibc readdir interface.
441454
TEST(ReaddirTest, OpenDir) {
442455
DIR* dev;

0 commit comments

Comments
 (0)