Commit c804efb5 authored by Russ Cox's avatar Russ Cox

net: fix TestDialTimeout on windows builder

I don't know what's out there, but something
is answering to 127.0.71.111:80 on our builder,
so use a different port.

Also insert a check that the dial fails, which
would have diagnosed this problem.

Fixes #3016.

R=golang-dev, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/5754062
parent 152a1aa6
......@@ -6,6 +6,7 @@ package net
import (
"flag"
"fmt"
"regexp"
"runtime"
"testing"
......@@ -44,13 +45,22 @@ func TestDialTimeout(t *testing.T) {
errc <- err
}()
}
case "darwin":
case "darwin", "windows":
// At least OS X 10.7 seems to accept any number of
// connections, ignoring listen's backlog, so resort
// to connecting to a hopefully-dead 127/8 address.
// Same for windows.
//
// Use a bogus port (44444) instead of 80, because
// on our 386 builder, this Dial succeeds, connecting
// to an IIS web server somewhere. The data center
// or VM or firewall must be stealing the TCP connection.
go func() {
_, err := DialTimeout("tcp", "127.0.71.111:80", 200*time.Millisecond)
c, err := DialTimeout("tcp", "127.0.71.111:44444", 200*time.Millisecond)
if err == nil {
err = fmt.Errorf("unexpected: connected to %s!", c.RemoteAddr())
c.Close()
}
errc <- err
}()
default:
......
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