Commit 2fe7597c authored by Aaron Jacobs's avatar Aaron Jacobs

FlushFSTest.SetUp

parent ffa094be
...@@ -15,9 +15,11 @@ ...@@ -15,9 +15,11 @@
package flushfs_test package flushfs_test
import ( import (
"sync"
"testing" "testing"
"github.com/jacobsa/fuse/samples" "github.com/jacobsa/fuse/samples"
"github.com/jacobsa/fuse/samples/flushfs"
. "github.com/jacobsa/ogletest" . "github.com/jacobsa/ogletest"
) )
...@@ -30,13 +32,31 @@ func TestFlushFS(t *testing.T) { RunTests(t) } ...@@ -30,13 +32,31 @@ func TestFlushFS(t *testing.T) { RunTests(t) }
type FlushFSTest struct { type FlushFSTest struct {
samples.SampleTest samples.SampleTest
mu sync.Mutex
// GUARDED_BY(mu)
flushes []string flushes []string
// GUARDED_BY(mu)
fsyncs []string fsyncs []string
} }
func init() { RegisterTestSuite(&FlushFSTest{}) } func init() { RegisterTestSuite(&FlushFSTest{}) }
func (t *FlushFSTest) SetUp(ti *TestInfo) func (t *FlushFSTest) SetUp(ti *TestInfo) {
// Set up a file system.
reportTo := func(slice *[]string) func(string) {
return func(s string) {
t.mu.Lock()
defer t.mu.Unlock()
*slice = append(*slice, s)
}
}
t.FileSystem = flushfs.NewFileSystem(
reportTo(&t.flushes),
reportTo(&t.fsyncs))
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Test functions // Test functions
......
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