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

fuse: remove VerboseTest from API.

parent 8922a4da
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
package fuse package fuse
import ( import (
"flag"
"fmt" "fmt"
"log" "log"
"os" "os"
...@@ -84,12 +83,6 @@ func CurrentOwner() *Owner { ...@@ -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() { func init() {
p := syscall.Getpagesize() p := syscall.Getpagesize()
if p != PAGESIZE { if p != PAGESIZE {
......
...@@ -31,14 +31,14 @@ func setupMemNodeTest(t *testing.T) (wd string, fs FileSystem, clean func()) { ...@@ -31,14 +31,14 @@ func setupMemNodeTest(t *testing.T) (wd string, fs FileSystem, clean func()) {
AttrTimeout: testTtl, AttrTimeout: testTtl,
NegativeTimeout: 0.0, NegativeTimeout: 0.0,
}) })
connector.SetDebug(fuse.VerboseTest()) connector.SetDebug(VerboseTest())
state, err := fuse.NewServer(connector.RawFS(), mnt, nil) state, err := fuse.NewServer(connector.RawFS(), mnt, nil)
if err != nil { if err != nil {
t.Fatal("NewServer", err) t.Fatal("NewServer", err)
} }
//me.state.SetDebug(false) //me.state.SetDebug(false)
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
// Unthreaded, but in background. // Unthreaded, but in background.
go state.Serve() go state.Serve()
......
...@@ -119,7 +119,7 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func()) ...@@ -119,7 +119,7 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
if err != nil { if err != nil {
t.Fatalf("TempDir failed: %v", err) t.Fatalf("TempDir failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return mountPoint, func() { return mountPoint, func() {
......
...@@ -3,7 +3,6 @@ package test ...@@ -3,7 +3,6 @@ package test
import ( import (
"bytes" "bytes"
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"sync" "sync"
"testing" "testing"
...@@ -14,8 +13,6 @@ import ( ...@@ -14,8 +13,6 @@ import (
"github.com/hanwen/go-fuse/raw" "github.com/hanwen/go-fuse/raw"
) )
var _ = log.Println
type cacheFs struct { type cacheFs struct {
pathfs.FileSystem pathfs.FileSystem
} }
...@@ -48,9 +45,9 @@ func setupCacheTest(t *testing.T) (string, *pathfs.PathNodeFs, func()) { ...@@ -48,9 +45,9 @@ func setupCacheTest(t *testing.T) (string, *pathfs.PathNodeFs, func()) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
conn.SetDebug(fuse.VerboseTest()) conn.SetDebug(VerboseTest())
pfs.SetDebug(fuse.VerboseTest()) pfs.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return dir, pfs, func() { return dir, pfs, func() {
...@@ -148,7 +145,7 @@ func TestNonseekable(t *testing.T) { ...@@ -148,7 +145,7 @@ func TestNonseekable(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed: %v", err) t.Fatalf("failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
defer state.Unmount() defer state.Unmount()
go state.Serve() go state.Serve()
...@@ -182,9 +179,9 @@ func TestGetAttrRace(t *testing.T) { ...@@ -182,9 +179,9 @@ func TestGetAttrRace(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
conn.SetDebug(fuse.VerboseTest()) conn.SetDebug(VerboseTest())
pfs.SetDebug(fuse.VerboseTest()) pfs.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
defer state.Unmount() defer state.Unmount()
......
...@@ -45,7 +45,7 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) { ...@@ -45,7 +45,7 @@ func defaultReadTest(t *testing.T) (root string, cleanup func()) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return dir, func() { return dir, func() {
......
...@@ -47,7 +47,7 @@ func TestDeleteNotify(t *testing.T) { ...@@ -47,7 +47,7 @@ func TestDeleteNotify(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
defer state.Unmount() defer state.Unmount()
......
...@@ -143,7 +143,7 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func( ...@@ -143,7 +143,7 @@ func setupFAttrTest(t *testing.T, fs pathfs.FileSystem) (dir string, clean func(
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
......
...@@ -84,14 +84,14 @@ func NewTestCase(t *testing.T) *testCase { ...@@ -84,14 +84,14 @@ func NewTestCase(t *testing.T) *testCase {
AttrTimeout: testTtl, AttrTimeout: testTtl,
NegativeTimeout: 0.0, NegativeTimeout: 0.0,
}) })
me.connector.SetDebug(fuse.VerboseTest()) me.connector.SetDebug(VerboseTest())
me.state, err = fuse.NewServer( me.state, err = fuse.NewServer(
me.connector.RawFS(), me.mnt, &fuse.MountOptions{SingleThreaded: true}) me.connector.RawFS(), me.mnt, &fuse.MountOptions{SingleThreaded: true})
if err != nil { if err != nil {
t.Fatal("NewServer:", err) t.Fatal("NewServer:", err)
} }
me.state.SetDebug(fuse.VerboseTest()) me.state.SetDebug(VerboseTest())
// Unthreaded, but in background. // Unthreaded, but in background.
go me.state.Serve() go me.state.Serve()
......
...@@ -91,7 +91,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest { ...@@ -91,7 +91,7 @@ func NewNotifyTest(t *testing.T) *NotifyTest {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
me.state.SetDebug(fuse.VerboseTest()) me.state.SetDebug(VerboseTest())
go me.state.Serve() go me.state.Serve()
return me return me
......
...@@ -148,7 +148,7 @@ func (me *OpenOut) string() string { ...@@ -148,7 +148,7 @@ func (me *OpenOut) string() string {
FlagString(FuseOpenFlagNames, int64(me.OpenFlags), "")) FlagString(FuseOpenFlagNames, int64(me.OpenFlags), ""))
} }
func (me *InitIn) string() string { func (me *InitIn) String() string {
return fmt.Sprintf("{%d.%d Ra 0x%x %s}", return fmt.Sprintf("{%d.%d Ra 0x%x %s}",
me.Major, me.Minor, me.MaxReadAhead, me.Major, me.Minor, me.MaxReadAhead,
FlagString(initFlagNames, int64(me.Flags), "")) FlagString(initFlagNames, int64(me.Flags), ""))
......
...@@ -61,8 +61,8 @@ func setup(t *testing.T) (workdir string, cleanup func()) { ...@@ -61,8 +61,8 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
conn.SetDebug(fuse.VerboseTest()) conn.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return wd, func() { return wd, func() {
...@@ -82,7 +82,6 @@ func TestDebug(t *testing.T) { ...@@ -82,7 +82,6 @@ func TestDebug(t *testing.T) {
if len(c) == 0 { if len(c) == 0 {
t.Fatal("No debug found.") t.Fatal("No debug found.")
} }
log.Println("Found version:", string(c))
} }
func TestVersion(t *testing.T) { func TestVersion(t *testing.T) {
......
...@@ -98,8 +98,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) { ...@@ -98,8 +98,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
conn.SetDebug(fuse.VerboseTest()) conn.SetDebug(VerboseTest())
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return wd, func() { return wd, func() {
...@@ -1161,7 +1161,7 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -1161,7 +1161,7 @@ func TestUnionFsDisappearing(t *testing.T) {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
defer state.Unmount() defer state.Unmount()
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
log.Println("TestUnionFsDisappearing2") log.Println("TestUnionFsDisappearing2")
......
package zipfs package zipfs
import ( import (
"flag"
"io/ioutil" "io/ioutil"
"log"
"os" "os"
"testing" "testing"
"time" "time"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs" "github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/fuse/pathfs" "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 const testTtl = 100 * time.Millisecond
...@@ -28,7 +31,7 @@ func setupMzfs(t *testing.T) (mountPoint string, cleanup func()) { ...@@ -28,7 +31,7 @@ func setupMzfs(t *testing.T) (mountPoint string, cleanup func()) {
if err != nil { if err != nil {
t.Fatalf("MountNodeFileSystem failed: %v", err) t.Fatalf("MountNodeFileSystem failed: %v", err)
} }
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return mountPoint, func() { return mountPoint, func() {
......
...@@ -29,7 +29,7 @@ func setupZipfs(t *testing.T) (mountPoint string, cleanup func()) { ...@@ -29,7 +29,7 @@ func setupZipfs(t *testing.T) (mountPoint string, cleanup func()) {
mountPoint, _ = ioutil.TempDir("", "") mountPoint, _ = ioutil.TempDir("", "")
state, _, err := nodefs.MountFileSystem(mountPoint, zfs, nil) state, _, err := nodefs.MountFileSystem(mountPoint, zfs, nil)
state.SetDebug(fuse.VerboseTest()) state.SetDebug(VerboseTest())
go state.Serve() go state.Serve()
return mountPoint, func() { 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