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

nodefs: add TestReadDirStress

This currently fails on Linux 5.0 and may be related to
https://github.com/hanwen/go-fuse/issues/287 .

1 jakob@brikett:~/go/src/github.com/hanwen/go-fuse/nodefs$ go test
21:42:47.356529 writer: Write/Writev failed, err: 2=no such file or directory. opcode: RELEASE
21:42:47.598309 writer: Write/Writev failed, err: 22=invalid argument. opcode: READDIRPLUS
21:42:47.604424 writer: Write/Writev failed, err: 22=invalid argument. opcode: READDIRPLUS
21:42:47.606073 writer: Write/Writev failed, err: 22=invalid argument. opcode: READDIRPLUS
--- FAIL: TestReadDirStress (0.36s)
    simple_test.go:270: goroutine 2 iteration 5: readdirent: input/output error
    simple_test.go:270: goroutine 1 iteration 9: readdirent: input/output error
    simple_test.go:270: goroutine 3 iteration 10: readdirent: input/output error
    simple_test.go:43: /usr/bin/fusermount: entry for /tmp/TestReadDirStress639795934/mnt not found in /etc/mtab
         (code exit status 1)

FAIL
exit status 1
FAIL	github.com/hanwen/go-fuse/nodefs	0.994s
parent a856a74e
......@@ -250,6 +250,39 @@ func TestReadDir(t *testing.T) {
posixtest.ReadDir(t, tc.mntDir)
}
func TestReadDirStress(t *testing.T) {
tc := newTestCase(t, true, true)
defer tc.Clean()
// (ab)use posixtest.ReadDir to create 110 test files
posixtest.ReadDir(t, tc.mntDir)
var wg sync.WaitGroup
stress := func(gr int) {
defer wg.Done()
for i := 1; i < 100; i++ {
f, err := os.Open(tc.mntDir)
if err != nil {
t.Error(err)
return
}
_, err = f.Readdirnames(-1)
if err != nil {
t.Errorf("goroutine %d iteration %d: %v", gr, i, err)
f.Close()
return
}
f.Close()
}
}
n := 3
for i := 1; i <= n; i++ {
wg.Add(1)
go stress(i)
}
wg.Wait()
}
// This test is racy. If an external process consumes space while this
// runs, we may see spurious differences between the two statfs() calls.
func TestStatFs(t *testing.T) {
......
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