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

tests: loopback: check that files create after OPENDIR show up in READDIR

Without patch "nodefs: delay directory read till ReadDir":

	go-fuse/fuse/test$ go test
	13:56:23.932743 Unimplemented opcode INTERRUPT
	13:56:23.932902 writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
	--- FAIL: TestReaddir (0.02s)
	    loopback_test.go:578: Wrong number of directory entries: want=2 have=1
	FAIL
	exit status 1
	FAIL	github.com/hanwen/go-fuse/fuse/test	1.970s

With patch "nodefs: delay directory read till ReadDir":

	go-fuse/fuse/test$ go test
	13:57:03.848021 Unimplemented opcode INTERRUPT
	13:57:03.848159 writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
	PASS
	ok  	github.com/hanwen/go-fuse/fuse/test	1.960s

https://github.com/hanwen/go-fuse/issues/252
parent 8d47a84b
......@@ -25,9 +25,13 @@ import (
)
type testCase struct {
// Per-testcase temporary directory, usually in /tmp, named something like
// "$TESTNAME.123456".
tmpDir string
orig string
mnt string
// Backing directory. Lives in tmpDir.
orig string
// Mountpoint. Lives in tmpDir.
mnt string
mountFile string
mountSubdir string
......@@ -559,7 +563,6 @@ func TestReaddir(t *testing.T) {
defer tc.Cleanup()
contents := []byte{1, 2, 3}
tc.WriteFile(tc.origFile, []byte(contents), 0700)
tc.Mkdir(tc.origSubdir, 0777)
dir, err := os.Open(tc.mnt)
......@@ -568,6 +571,10 @@ func TestReaddir(t *testing.T) {
}
defer dir.Close()
// READDIR should show "hello.txt" even if it is created after the OPENDIR.
// https://github.com/hanwen/go-fuse/issues/252
tc.WriteFile(tc.origFile, []byte(contents), 0700)
infos, err := dir.Readdir(10)
if err != nil {
t.Fatalf("Readdir failed: %v", err)
......@@ -578,7 +585,7 @@ func TestReaddir(t *testing.T) {
"subdir": true,
}
if len(wanted) != len(infos) {
t.Errorf("Length mismatch %v", infos)
t.Errorf("Wrong number of directory entries: want=%d have=%d", len(wanted), len(infos))
} else {
for _, v := range infos {
_, ok := wanted[v.Name()]
......
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