Commit e1375f33 authored by Aaron Jacobs's avatar Aaron Jacobs

NewFileSystem

parent 2fe7597c
......@@ -14,7 +14,10 @@
package flushfs
import "github.com/jacobsa/fuse"
import (
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseutil"
)
// Create a file system containing a single file named "foo".
//
......@@ -23,4 +26,11 @@ import "github.com/jacobsa/fuse"
// called with the current contents of the file.
func NewFileSystem(
reportFlush func(string),
reportFsync func(string)) (fs fuse.FileSystem, err error)
reportFsync func(string)) (fs fuse.FileSystem, err error) {
fs = &flushFS{}
return
}
type flushFS struct {
fuseutil.NotImplementedFileSystem
}
......@@ -44,6 +44,8 @@ type FlushFSTest struct {
func init() { RegisterTestSuite(&FlushFSTest{}) }
func (t *FlushFSTest) SetUp(ti *TestInfo) {
var err error
// Set up a file system.
reportTo := func(slice *[]string) func(string) {
return func(s string) {
......@@ -53,9 +55,16 @@ func (t *FlushFSTest) SetUp(ti *TestInfo) {
}
}
t.FileSystem = flushfs.NewFileSystem(
t.FileSystem, err = flushfs.NewFileSystem(
reportTo(&t.flushes),
reportTo(&t.fsyncs))
if err != nil {
panic(err)
}
// Mount it.
t.SampleTest.SetUp(ti)
}
////////////////////////////////////////////////////////////////////////
......
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