From 1b3c3b1347ef711ec38bb4c5cb14661035faf2ce Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 23 May 2021 12:00:09 +0200 Subject: syscallcompat: add GetdentsSpecial() GetdentsSpecial calls then Getdents syscall, with normal entries and "." / ".." split into two slices. --- internal/syscallcompat/getdents_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'internal/syscallcompat/getdents_test.go') diff --git a/internal/syscallcompat/getdents_test.go b/internal/syscallcompat/getdents_test.go index cb95b7c..a6f41ca 100644 --- a/internal/syscallcompat/getdents_test.go +++ b/internal/syscallcompat/getdents_test.go @@ -83,7 +83,7 @@ func testGetdents(t *testing.T) { if err != nil { t.Fatal(err) } - getdentsEntries, err := getdentsUnderTest(int(fd.Fd())) + getdentsEntries, special, err := getdentsUnderTest(int(fd.Fd())) if err != nil { t.Log(err) skipOnGccGo(t) @@ -114,5 +114,20 @@ func testGetdents(t *testing.T) { } } } + if len(special) != 2 { + t.Error(special) + } + if !(special[0].Name == "." && special[1].Name == ".." || + special[1].Name == "." && special[0].Name == "..") { + t.Error(special) + } + for _, v := range special { + if v.Ino == 0 { + t.Error(v) + } + if v.Mode != syscall.S_IFDIR { + t.Error(v) + } + } } } -- cgit v1.2.3