Commit 2f786397 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: remove VerboseTest from API.

parent 8922a4da
......@@ -3,7 +3,6 @@
package fuse
import (
"flag"
"fmt"
"log"
"os"
......@@ -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 {
......
......@@ -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()
......
......@@ -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() {
......
......@@ -3,7 +3,6 @@ package test
import (
"bytes"
"io/ioutil"
"log"
"os"
"sync"
"testing"
......@@ -14,8 +13,6 @@ import (
"github.com/hanwen/go-fuse/raw"
)
var _ = log.Println
type cacheFs struct {
pathfs.FileSystem
}
......@@ -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() {
......@@ -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()
......@@ -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()
......
......@@ -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() {
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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), ""))
......
......@@ -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() {
......@@ -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) {
......
......@@ -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() {
......@@ -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")
......
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
......@@ -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() {
......
......@@ -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() {
......
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