Revert r215321.
[official-gcc.git] / libgo / go / net / z_last_test.go
blob4f6a54a560acab2f44c446983fbbe0702029b7cd
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package net
7 import (
8 "flag"
9 "fmt"
10 "testing"
13 var testDNSFlood = flag.Bool("dnsflood", false, "whether to test dns query flooding")
15 func TestDNSThreadLimit(t *testing.T) {
16 if !*testDNSFlood {
17 t.Skip("test disabled; use -dnsflood to enable")
20 const N = 10000
21 c := make(chan int, N)
22 for i := 0; i < N; i++ {
23 go func(i int) {
24 LookupIP(fmt.Sprintf("%d.net-test.golang.org", i))
25 c <- 1
26 }(i)
28 // Don't bother waiting for the stragglers; stop at 0.9 N.
29 for i := 0; i < N*9/10; i++ {
30 if i%100 == 0 {
31 //println("TestDNSThreadLimit:", i)
33 <-c
36 // If we're still here, it worked.