Commit afe646ca authored by Santhosh Kumar Tekuri's avatar Santhosh Kumar Tekuri Committed by Mikio Hara

nettest: mark test helper functions

Fixes golang/go#30295

Change-Id: Ib98fde1f2f0d166e199238de45ca95aa34164040
Reviewed-on: https://go-review.googlesource.com/c/162925
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMikio Hara <mikioh.public.networking@gmail.com>
parent 67f368f4
...@@ -41,6 +41,7 @@ func TestConn(t *testing.T, mp MakePipe) { ...@@ -41,6 +41,7 @@ func TestConn(t *testing.T, mp MakePipe) {
type connTester func(t *testing.T, c1, c2 net.Conn) type connTester func(t *testing.T, c1, c2 net.Conn)
func timeoutWrapper(t *testing.T, mp MakePipe, f connTester) { func timeoutWrapper(t *testing.T, mp MakePipe, f connTester) {
t.Helper()
c1, c2, stop, err := mp() c1, c2, stop, err := mp()
if err != nil { if err != nil {
t.Fatalf("unable to make pipe: %v", err) t.Fatalf("unable to make pipe: %v", err)
...@@ -390,6 +391,7 @@ func testConcurrentMethods(t *testing.T, c1, c2 net.Conn) { ...@@ -390,6 +391,7 @@ func testConcurrentMethods(t *testing.T, c1, c2 net.Conn) {
// checkForTimeoutError checks that the error satisfies the Error interface // checkForTimeoutError checks that the error satisfies the Error interface
// and that Timeout returns true. // and that Timeout returns true.
func checkForTimeoutError(t *testing.T, err error) { func checkForTimeoutError(t *testing.T, err error) {
t.Helper()
if nerr, ok := err.(net.Error); ok { if nerr, ok := err.(net.Error); ok {
if !nerr.Timeout() { if !nerr.Timeout() {
t.Errorf("err.Timeout() = false, want true") t.Errorf("err.Timeout() = false, want true")
...@@ -402,6 +404,7 @@ func checkForTimeoutError(t *testing.T, err error) { ...@@ -402,6 +404,7 @@ func checkForTimeoutError(t *testing.T, err error) {
// testRoundtrip writes something into c and reads it back. // testRoundtrip writes something into c and reads it back.
// It assumes that everything written into c is echoed back to itself. // It assumes that everything written into c is echoed back to itself.
func testRoundtrip(t *testing.T, c net.Conn) { func testRoundtrip(t *testing.T, c net.Conn) {
t.Helper()
if err := c.SetDeadline(neverTimeout); err != nil { if err := c.SetDeadline(neverTimeout); err != nil {
t.Errorf("roundtrip SetDeadline error: %v", err) t.Errorf("roundtrip SetDeadline error: %v", err)
} }
...@@ -423,6 +426,7 @@ func testRoundtrip(t *testing.T, c net.Conn) { ...@@ -423,6 +426,7 @@ func testRoundtrip(t *testing.T, c net.Conn) {
// It assumes that everything written into c is echoed back to itself. // It assumes that everything written into c is echoed back to itself.
// It assumes that 0xff is not currently on the wire or in the read buffer. // It assumes that 0xff is not currently on the wire or in the read buffer.
func resyncConn(t *testing.T, c net.Conn) { func resyncConn(t *testing.T, c net.Conn) {
t.Helper()
c.SetDeadline(neverTimeout) c.SetDeadline(neverTimeout)
errCh := make(chan error) errCh := make(chan error)
go func() { go 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