Commit cca39ff3 authored by Mikio Hara's avatar Mikio Hara

net: don't show verbose information when -test.v=false

Updates #10845.

Change-Id: I4cec670c7db88c50a6e5619e611744e161d73b3c
Reviewed-on: https://go-review.googlesource.com/10131Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 2df1ccdb
...@@ -50,9 +50,9 @@ func TestMain(m *testing.M) { ...@@ -50,9 +50,9 @@ func TestMain(m *testing.M) {
st := m.Run() st := m.Run()
testHookUninstaller.Do(uninstallTestHooks) testHookUninstaller.Do(uninstallTestHooks)
if !testing.Short() { if testing.Verbose() {
printLeakedGoroutines() printRunningGoroutines()
printLeakedSockets() printInflightSockets()
printSocketStats() printSocketStats()
} }
forceCloseSockets() forceCloseSockets()
...@@ -98,8 +98,8 @@ func setupTestData() { ...@@ -98,8 +98,8 @@ func setupTestData() {
} }
} }
func printLeakedGoroutines() { func printRunningGoroutines() {
gss := leakedGoroutines() gss := runningGoroutines()
if len(gss) == 0 { if len(gss) == 0 {
return return
} }
...@@ -110,9 +110,8 @@ func printLeakedGoroutines() { ...@@ -110,9 +110,8 @@ func printLeakedGoroutines() {
fmt.Fprintf(os.Stderr, "\n") fmt.Fprintf(os.Stderr, "\n")
} }
// leakedGoroutines returns a list of remaining goroutines used in // runningGoroutines returns a list of remaining goroutines.
// test cases. func runningGoroutines() []string {
func leakedGoroutines() []string {
var gss []string var gss []string
b := make([]byte, 2<<20) b := make([]byte, 2<<20)
b = b[:runtime.Stack(b, true)] b = b[:runtime.Stack(b, true)]
...@@ -131,7 +130,7 @@ func leakedGoroutines() []string { ...@@ -131,7 +130,7 @@ func leakedGoroutines() []string {
return gss return gss
} }
func printLeakedSockets() { func printInflightSockets() {
sos := sw.Sockets() sos := sw.Sockets()
if len(sos) == 0 { if len(sos) == 0 {
return return
......
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