net: mark condFatalf as a test helper

Fixes unintended consequence of CL 76393

Change-Id: I7e4644a0bc6a8b37eb41196687d9661f902ba183
Reviewed-on: https://go-review.googlesource.com/76890
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
Aman Gupta 2017-11-09 22:19:49 -08:00 committed by Mikio Hara
parent e9d2f1eb36
commit 2f62fe60d6
2 changed files with 8 additions and 7 deletions

View File

@ -149,12 +149,13 @@ func testableListenArgs(network, address, client string) bool {
return true
}
func condFatalf(t *testing.T, api string, format string, args ...interface{}) {
func condFatalf(t *testing.T, network string, format string, args ...interface{}) {
t.Helper()
// A few APIs like File and Read/WriteMsg{UDP,IP} are not
// fully implemented yet on Plan 9 and Windows.
switch runtime.GOOS {
case "windows":
if api == "file" {
if network == "file+net" {
t.Logf(format, args...)
return
}

View File

@ -54,7 +54,7 @@ func TestTCPListenerSpecificMethods(t *testing.T) {
}
if f, err := ln.File(); err != nil {
condFatalf(t, "file", "%v", err)
condFatalf(t, "file+net", "%v", err)
} else {
f.Close()
}
@ -139,14 +139,14 @@ func TestUDPConnSpecificMethods(t *testing.T) {
t.Fatal(err)
}
if _, _, err := c.WriteMsgUDP(wb, nil, c.LocalAddr().(*UDPAddr)); err != nil {
condFatalf(t, "udp", "%v", err)
condFatalf(t, c.LocalAddr().Network(), "%v", err)
}
if _, _, _, _, err := c.ReadMsgUDP(rb, nil); err != nil {
condFatalf(t, "udp", "%v", err)
condFatalf(t, c.LocalAddr().Network(), "%v", err)
}
if f, err := c.File(); err != nil {
condFatalf(t, "file", "%v", err)
condFatalf(t, "file+net", "%v", err)
} else {
f.Close()
}
@ -184,7 +184,7 @@ func TestIPConnSpecificMethods(t *testing.T) {
c.SetWriteBuffer(2048)
if f, err := c.File(); err != nil {
condFatalf(t, "file", "%v", err)
condFatalf(t, "file+net", "%v", err)
} else {
f.Close()
}