Commit 97aecbbf authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

posixtest: fix some lint errors

Change-Id: I15d31de59b4c34caff132bdc7d09ad520d0e68cb
parent 29c89791
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package posixtest file systems for generic posix conformance.
package posixtest
import (
......
......@@ -12,13 +12,13 @@ import (
"os"
"path/filepath"
"runtime"
"sync"
"syscall"
"testing"
"github.com/hanwen/go-fuse/v2/fuse"
)
// All holds a map of all test functions
var All = map[string]func(*testing.T, string){
"AppendWrite": AppendWrite,
"SymlinkReadlink": SymlinkReadlink,
......@@ -261,24 +261,30 @@ func ParallelFileOpen(t *testing.T, mnt string) {
t.Fatalf("WriteFile: %v", err)
}
var wg sync.WaitGroup
N := 10
errs := make(chan error, N)
one := func(b byte) {
f, err := os.OpenFile(fn, os.O_RDWR, 0644)
if err != nil {
t.Fatalf("OpenFile: %v", err)
errs <- err
return
}
var buf [10]byte
f.Read(buf[:])
buf[0] = b
f.WriteAt(buf[0:1], 2)
f.Close()
wg.Done()
errs <- nil
}
for i := 0; i < 10; i++ {
wg.Add(1)
for i := 0; i < N; i++ {
go one(byte(i))
}
wg.Wait()
for i := 0; i < N; i++ {
if e := <-errs; e != nil {
t.Error(e)
}
}
}
func Link(t *testing.T, mnt string) {
......
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