mirror of
https://github.com/golang/go
synced 2024-11-20 04:54:44 -07:00
net: report Accept error during TestVariousDeadlines1Proc test
R=golang-dev CC=golang-dev https://golang.org/cl/6868057
This commit is contained in:
parent
dfe2979801
commit
0420eb3b65
@ -410,16 +410,7 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
|
|||||||
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs))
|
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs))
|
||||||
ln := newLocalListener(t)
|
ln := newLocalListener(t)
|
||||||
defer ln.Close()
|
defer ln.Close()
|
||||||
donec := make(chan struct{})
|
acceptc := make(chan error, 1)
|
||||||
defer close(donec)
|
|
||||||
|
|
||||||
testsDone := func() bool {
|
|
||||||
select {
|
|
||||||
case <-donec:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// The server, with no timeouts of its own, sending bytes to clients
|
// The server, with no timeouts of its own, sending bytes to clients
|
||||||
// as fast as it can.
|
// as fast as it can.
|
||||||
@ -428,9 +419,7 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
|
|||||||
for {
|
for {
|
||||||
c, err := ln.Accept()
|
c, err := ln.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !testsDone() {
|
acceptc <- err
|
||||||
t.Fatalf("Accept: %v", err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
@ -504,6 +493,8 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
|
|||||||
select {
|
select {
|
||||||
case res := <-servec:
|
case res := <-servec:
|
||||||
t.Logf("for %v: server in %v wrote %d, %v", name, res.d, res.n, res.err)
|
t.Logf("for %v: server in %v wrote %d, %v", name, res.d, res.n, res.err)
|
||||||
|
case err := <-acceptc:
|
||||||
|
t.Fatalf("for %v: server Accept = %v", name, err)
|
||||||
case <-time.After(tooLong):
|
case <-time.After(tooLong):
|
||||||
t.Fatalf("for %v, timeout waiting for server to finish writing", name)
|
t.Fatalf("for %v, timeout waiting for server to finish writing", name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user