Commit cad36b13 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Only print debug if testing with -v.

parent ca4265a2
......@@ -38,9 +38,9 @@ func setupCacheTest() (string, *PathNodeFs, func()) {
pfs := NewPathNodeFs(fs, nil)
state, conn, err := MountNodeFileSystem(dir+"/mnt", pfs, nil)
CheckSuccess(err)
state.Debug = true
conn.Debug = true
pfs.Debug = true
state.Debug = VerboseTest()
conn.Debug = VerboseTest()
pfs.Debug = VerboseTest()
go state.Loop()
return dir, pfs, func() {
......@@ -123,7 +123,7 @@ func TestNonseekable(t *testing.T) {
defer os.RemoveAll(dir)
state, _, err := MountPathFileSystem(dir, fs, nil)
CheckSuccess(err)
state.Debug = true
state.Debug = VerboseTest()
defer state.Unmount()
go state.Loop()
......
......@@ -126,7 +126,7 @@ func setupFAttrTest(fs FileSystem) (dir string, clean func()) {
CheckSuccess(err)
state, _, err := MountPathFileSystem(dir, fs, nil)
CheckSuccess(err)
state.Debug = true
state.Debug = VerboseTest()
go state.Loop()
......
......@@ -82,12 +82,11 @@ func NewTestCase(t *testing.T) *testCase {
rfs = me.connector
rfs = NewLockingRawFileSystem(rfs)
me.connector.Debug = true
me.connector.Debug = VerboseTest()
me.state = NewMountState(rfs)
me.state.Mount(me.mnt, nil)
//me.state.Debug = false
me.state.Debug = true
me.state.Debug = VerboseTest()
// Unthreaded, but in background.
go me.state.Loop()
......
......@@ -24,12 +24,12 @@ func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
AttrTimeout: testTtl,
NegativeTimeout: 0.0,
})
connector.Debug = true
connector.Debug = VerboseTest()
state := NewMountState(connector)
state.Mount(mnt, nil)
//me.state.Debug = false
state.Debug = true
state.Debug = VerboseTest()
// Unthreaded, but in background.
go state.Loop()
......
......@@ -3,10 +3,11 @@
package fuse
import (
"os"
"flag"
"fmt"
"log"
"math"
"os"
"reflect"
"strings"
"syscall"
......@@ -153,3 +154,8 @@ func CurrentOwner() *Owner {
Gid: uint32(os.Getgid()),
}
}
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
......@@ -56,7 +56,7 @@ func NewNotifyTest() *NotifyTest {
me.pathfs = NewPathNodeFs(me.fs, nil)
me.state, me.connector, err = MountNodeFileSystem(me.dir, me.pathfs, opts)
CheckSuccess(err)
me.state.Debug = true
me.state.Debug = VerboseTest()
go me.state.Loop()
return me
......
......@@ -98,7 +98,7 @@ func TestXAttrRead(t *testing.T) {
state, _, err := MountPathFileSystem(mountPoint, xfs, nil)
CheckSuccess(err)
state.Debug = true
state.Debug = VerboseTest()
defer state.Unmount()
go state.Loop()
......
......@@ -44,8 +44,8 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, conn, err := fuse.MountPathFileSystem(wd+"/mount", fs, &testAOpts.FileSystemOptions)
CheckSuccess(err)
state.Debug = true
conn.Debug = true
state.Debug = fuse.VerboseTest()
conn.Debug = fuse.VerboseTest()
go state.Loop()
return wd, func() {
......
......@@ -58,8 +58,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
&fuse.PathNodeFsOptions{ClientInodes: true})
state, conn, err := fuse.MountNodeFileSystem(wd+"/mount", pathfs, opts)
CheckSuccess(err)
conn.Debug = true
state.Debug = true
conn.Debug = fuse.VerboseTest()
state.Debug = fuse.VerboseTest()
go state.Loop()
return wd, func() {
......@@ -871,7 +871,7 @@ func TestDisappearing(t *testing.T) {
state, _, err := fuse.MountPathFileSystem(wd+"/mount", ufs, opts)
CheckSuccess(err)
defer state.Unmount()
state.Debug = true
state.Debug = fuse.VerboseTest()
go state.Loop()
log.Println("TestDisappearing2")
......
......@@ -22,7 +22,7 @@ func setupMzfs() (mountPoint string, cleanup func()) {
NegativeTimeout: 0.0,
})
CheckSuccess(err)
state.Debug = true
state.Debug = fuse.VerboseTest()
go state.Loop()
return mountPoint, func() {
......
......@@ -25,7 +25,7 @@ func setupZipfs() (mountPoint string, cleanup func()) {
mountPoint, _ = ioutil.TempDir("", "")
state, _, err := fuse.MountNodeFileSystem(mountPoint, zfs, nil)
state.Debug = true
state.Debug = fuse.VerboseTest()
go state.Loop()
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