aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-17 22:08:49 +0200
committerJakob Unterwurzacher2015-09-17 22:08:49 +0200
commit67fe4557e5225f5be1687aca3d1934ad1141a684 (patch)
tree7f8bc19e41eaba5a59109f46de6aa8b72809af96
parent338925aef45d8ec960e1ba4d160dbb3848bd7a9d (diff)
Fix read benchmark
-rw-r--r--main_test.go20
-rw-r--r--pathfs_frontend/fs.go2
2 files changed, 21 insertions, 1 deletions
diff --git a/main_test.go b/main_test.go
index 6157e5a..0dfa06a 100644
--- a/main_test.go
+++ b/main_test.go
@@ -129,11 +129,30 @@ func BenchmarkStreamWrite(t *testing.B) {
t.FailNow()
}
}
+ file.Close()
}
func BenchmarkStreamRead(t *testing.B) {
buf := make([]byte, 1024*1024)
t.SetBytes(int64(len(buf)))
+
+ if t.N > 100 {
+ // Grow file so we can satisfy the test
+ f2, err := os.OpenFile(plainDir + "BenchmarkWrite", os.O_WRONLY | os.O_APPEND, 0666)
+ if err != nil {
+ fmt.Println(err)
+ t.FailNow()
+ }
+ for h := 0; h < t.N - 100 ; h++ {
+ _, err = f2.Write(buf)
+ if err != nil {
+ fmt.Println(err)
+ t.FailNow()
+ }
+ }
+ f2.Close()
+ }
+
file, err := os.Open(plainDir + "BenchmarkWrite")
if err != nil {
t.FailNow()
@@ -150,4 +169,5 @@ func BenchmarkStreamRead(t *testing.B) {
t.FailNow()
}
}
+ file.Close()
}
diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go
index bf93766..2ae066f 100644
--- a/pathfs_frontend/fs.go
+++ b/pathfs_frontend/fs.go
@@ -38,7 +38,7 @@ func (fs *FS) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Stat
cName := fs.EncryptPath(name)
a, status := fs.FileSystem.GetAttr(cName, context)
if a == nil {
- cryptfs.Notice.Printf("FS.GetAttr failed: %s\n", status.String())
+ cryptfs.Debug.Printf("FS.GetAttr failed: %s\n", status.String())
return a, status
}
if a.IsRegular() {