Commit 0757bc15 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

loopback: add test for "." and ".." dir entries

We have to use the low-level function syscall.Getdents because
os.Readdir and friends will filter out "." and "..".
parent d2167925
......@@ -962,3 +962,20 @@ func TestUmask(t *testing.T) {
t.Errorf("got %o, expect mode %o for file %s", got, expect, fn)
}
}
// Check that "." and ".." exists
func TestSpecialEntries(t *testing.T) {
tc := NewTestCase(t)
defer tc.Cleanup()
d, err := os.Open(tc.mnt)
if err != nil {
t.Fatalf("Open failed: %v", err)
}
defer d.Close()
buf := make([]byte, 100)
n, err := syscall.Getdents(int(d.Fd()), buf)
if n == 0 {
t.Errorf("directory is empty, entries '.' and '..' are missing")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment