diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
commit | 758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch) | |
tree | 6d6b34f8c678862fe9b56c945a7b63f68502c245 /src/pkg/net/timeout_test.go | |
parent | 3e45412327a2654a77944249962b3652e6142299 (diff) | |
download | golang-758ff64c69e34965f8af5b2d6ffd65e8d7ab2150.tar.gz |
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'src/pkg/net/timeout_test.go')
-rw-r--r-- | src/pkg/net/timeout_test.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index 092781685..09a257dc8 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -8,14 +8,9 @@ import ( "os" "testing" "time" - "runtime" ) func testTimeout(t *testing.T, network, addr string, readFrom bool) { - // Timeouts are not implemented on windows. - if runtime.GOOS == "windows" { - return - } fd, err := Dial(network, "", addr) if err != nil { t.Errorf("dial %s %s failed: %v", network, addr, err) @@ -51,8 +46,12 @@ func TestTimeoutUDP(t *testing.T) { } func TestTimeoutTCP(t *testing.T) { - // 74.125.19.99 is www.google.com. - // could use dns, but dns depends on - // timeouts and this is the timeout test. - testTimeout(t, "tcp", "74.125.19.99:80", false) + // set up a listener that won't talk back + listening := make(chan string) + done := make(chan int) + go runServe(t, "tcp", "127.0.0.1:0", listening, done) + addr := <-listening + + testTimeout(t, "tcp", addr, false) + <-done } |