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