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

tests: loopback: check that OPENDIR-RENAME-READDIR still works

Test that READDIR works even if the directory is renamed after the OPENDIR.
This checks that the fix for https://github.com/hanwen/go-fuse/issues/252
does not break this case.
parent a6cb4bb1
......@@ -596,6 +596,36 @@ func TestReaddir(t *testing.T) {
}
}
// Test that READDIR works even if the directory is renamed after the OPENDIR.
// This checks that the fix for https://github.com/hanwen/go-fuse/issues/252
// does not break this case.
func TestReaddirRename(t *testing.T) {
tc := NewTestCase(t)
defer tc.Cleanup()
tc.Mkdir(tc.origSubdir, 0777)
tc.WriteFile(tc.origSubdir+"/file.txt", []byte("foo"), 0700)
dir, err := os.Open(tc.mountSubdir)
if err != nil {
t.Fatalf("Open failed: %v", err)
}
defer dir.Close()
err = os.Rename(tc.mountSubdir, tc.mountSubdir+".2")
if err != nil {
t.Fatalf("Rename failed: %v", err)
}
names, err := dir.Readdirnames(-1)
if err != nil {
t.Fatalf("Readdirnames failed: %v", err)
}
if len(names) != 1 || names[0] != "file.txt" {
t.Fatalf("incorrect directory listing: %v", names)
}
}
func TestFSync(t *testing.T) {
tc := NewTestCase(t)
defer tc.Cleanup()
......
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