Skip to content

Commit

Permalink
fuse: remove VerboseTest from API.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwen committed Jul 7, 2013
1 parent 8922a4d commit 2f78639
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 38 deletions.
7 changes: 0 additions & 7 deletions fuse/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package fuse

import (
"flag"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -84,12 +83,6 @@ func CurrentOwner() *Owner {
}
}

// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}

func init() {
p := syscall.Getpagesize()
if p != PAGESIZE {
Expand Down
4 changes: 2 additions & 2 deletions fuse/nodefs/memnode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func setupMemNodeTest(t *testing.T) (wd string, fs FileSystem, clean func()) {
AttrTimeout: testTtl,
NegativeTimeout: 0.0,
})
connector.SetDebug(fuse.VerboseTest())
connector.SetDebug(VerboseTest())
state, err := fuse.NewServer(connector.RawFS(), mnt, nil)
if err != nil {
t.Fatal("NewServer", err)
}

//me.state.SetDebug(false)
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())

// Unthreaded, but in background.
go state.Serve()
Expand Down
2 changes: 1 addition & 1 deletion fuse/pathfs/xattr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())

go state.Serve()
return mountPoint, func() {
Expand Down
17 changes: 7 additions & 10 deletions fuse/test/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package test
import (
"bytes"
"io/ioutil"
"log"
"os"
"sync"
"testing"
Expand All @@ -14,8 +13,6 @@ import (
"github.com/hanwen/go-fuse/raw"
)

var _ = log.Println

type cacheFs struct {
pathfs.FileSystem
}
Expand Down Expand Up @@ -48,9 +45,9 @@ func setupCacheTest(t *testing.T) (string, *pathfs.PathNodeFs, func()) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
conn.SetDebug(fuse.VerboseTest())
pfs.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
conn.SetDebug(VerboseTest())
pfs.SetDebug(VerboseTest())
go state.Serve()

return dir, pfs, func() {
Expand Down Expand Up @@ -148,7 +145,7 @@ func TestNonseekable(t *testing.T) {
if err != nil {
t.Fatalf("failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
defer state.Unmount()

go state.Serve()
Expand Down Expand Up @@ -182,9 +179,9 @@ func TestGetAttrRace(t *testing.T) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
conn.SetDebug(fuse.VerboseTest())
pfs.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
conn.SetDebug(VerboseTest())
pfs.SetDebug(VerboseTest())
go state.Serve()

defer state.Unmount()
Expand Down
2 changes: 1 addition & 1 deletion fuse/test/defaultread_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()

return dir, func() {
Expand Down
2 changes: 1 addition & 1 deletion fuse/test/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestDeleteNotify(t *testing.T) {
if err != nil {
t.Fatal(err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()
defer state.Unmount()

Expand Down
2 changes: 1 addition & 1 deletion fuse/test/fsetattr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func(
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())

go state.Serve()

Expand Down
4 changes: 2 additions & 2 deletions fuse/test/loopback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ func NewTestCase(t *testing.T) *testCase {
AttrTimeout: testTtl,
NegativeTimeout: 0.0,
})
me.connector.SetDebug(fuse.VerboseTest())
me.connector.SetDebug(VerboseTest())
me.state, err = fuse.NewServer(
me.connector.RawFS(), me.mnt, &fuse.MountOptions{SingleThreaded: true})
if err != nil {
t.Fatal("NewServer:", err)
}

me.state.SetDebug(fuse.VerboseTest())
me.state.SetDebug(VerboseTest())

// Unthreaded, but in background.
go me.state.Serve()
Expand Down
2 changes: 1 addition & 1 deletion fuse/test/notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
me.state.SetDebug(fuse.VerboseTest())
me.state.SetDebug(VerboseTest())
go me.state.Serve()

return me
Expand Down
2 changes: 1 addition & 1 deletion raw/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (me *OpenOut) string() string {
FlagString(FuseOpenFlagNames, int64(me.OpenFlags), ""))
}

func (me *InitIn) string() string {
func (me *InitIn) String() string {
return fmt.Sprintf("{%d.%d Ra 0x%x %s}",
me.Major, me.Minor, me.MaxReadAhead,
FlagString(initFlagNames, int64(me.Flags), ""))
Expand Down
5 changes: 2 additions & 3 deletions unionfs/autounion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
conn.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
conn.SetDebug(VerboseTest())
go state.Serve()

return wd, func() {
Expand All @@ -82,7 +82,6 @@ func TestDebug(t *testing.T) {
if len(c) == 0 {
t.Fatal("No debug found.")
}
log.Println("Found version:", string(c))
}

func TestVersion(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions unionfs/unionfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
conn.SetDebug(fuse.VerboseTest())
state.SetDebug(fuse.VerboseTest())
conn.SetDebug(VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()

return wd, func() {
Expand Down Expand Up @@ -1161,7 +1161,7 @@ func TestUnionFsDisappearing(t *testing.T) {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
defer state.Unmount()
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()

log.Println("TestUnionFsDisappearing2")
Expand Down
11 changes: 7 additions & 4 deletions zipfs/multizip_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package zipfs

import (
"flag"
"io/ioutil"
"log"
"os"
"testing"
"time"

"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/fuse/pathfs"
)

var _ = log.Printf
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}

const testTtl = 100 * time.Millisecond

Expand All @@ -28,7 +31,7 @@ func setupMzfs(t *testing.T) (mountPoint string, cleanup func()) {
if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err)
}
state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()

return mountPoint, func() {
Expand Down
2 changes: 1 addition & 1 deletion zipfs/zipfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func setupZipfs(t *testing.T) (mountPoint string, cleanup func()) {
mountPoint, _ = ioutil.TempDir("", "")
state, _, err := nodefs.MountFileSystem(mountPoint, zfs, nil)

state.SetDebug(fuse.VerboseTest())
state.SetDebug(VerboseTest())
go state.Serve()

return mountPoint, func() {
Expand Down

0 comments on commit 2f78639

Please sign in to comment.