Permalink
Browse files

mtp: set debug on all device tests.

  • Loading branch information...
hanwen committed Feb 17, 2013
1 parent faa5148 commit 2a829e482bd40495db656f42e22dfaed0e3494be
Showing with 11 additions and 5 deletions.
  1. +11 −5 mtp/device_test.go
View
@@ -13,19 +13,25 @@ import (
"time"
)
// 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 setDebug(dev *Device) {
dev.DataDebug = VerboseTest()
dev.MTPDebug = VerboseTest()
dev.USBDebug = VerboseTest()
}
func TestAndroid(t *testing.T) {
dev, err := SelectDevice("")
if err != nil {
t.Fatal(err)
}
defer dev.Close()
setDebug(dev)
info := DeviceInfo{}
err = dev.GetDeviceInfo(&info)
@@ -181,10 +187,8 @@ func TestDeviceProperties(t *testing.T) {
t.Fatal(err)
}
defer dev.Close()
dev.DataDebug = VerboseTest()
dev.MTPDebug = VerboseTest()
dev.USBDebug = VerboseTest()
setDebug(dev)
err = dev.Configure()
if err != nil {
t.Fatal("Configure failed:", err)
@@ -272,6 +276,7 @@ func TestDeviceInfo(t *testing.T) {
t.Fatal(err)
}
defer dev.Close()
setDebug(dev)
i, _ := dev.ID()
t.Log("device:", i)
@@ -290,6 +295,7 @@ func TestDeviceStorage(t *testing.T) {
t.Fatal(err)
}
defer dev.Close()
setDebug(dev)
i, _ := dev.ID()
t.Log("device:", i)

0 comments on commit 2a829e4

Please sign in to comment.