mirror of
https://github.com/golang/go
synced 2024-11-26 21:11:57 -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))
|
||||
ln := newLocalListener(t)
|
||||
defer ln.Close()
|
||||
donec := make(chan struct{})
|
||||
defer close(donec)
|
||||
|
||||
testsDone := func() bool {
|
||||
select {
|
||||
case <-donec:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
acceptc := make(chan error, 1)
|
||||
|
||||
// The server, with no timeouts of its own, sending bytes to clients
|
||||
// as fast as it can.
|
||||
@ -428,9 +419,7 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
|
||||
for {
|
||||
c, err := ln.Accept()
|
||||
if err != nil {
|
||||
if !testsDone() {
|
||||
t.Fatalf("Accept: %v", err)
|
||||
}
|
||||
acceptc <- err
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
@ -504,6 +493,8 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
|
||||
select {
|
||||
case res := <-servec:
|
||||
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):
|
||||
t.Fatalf("for %v, timeout waiting for server to finish writing", name)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user