aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/z_last_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/net/z_last_test.go')
-rw-r--r--libgo/go/net/z_last_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/libgo/go/net/z_last_test.go b/libgo/go/net/z_last_test.go
new file mode 100644
index 0000000..bb00f11
--- /dev/null
+++ b/libgo/go/net/z_last_test.go
@@ -0,0 +1,34 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package net
+
+import (
+ "fmt"
+ "testing"
+)
+
+func TestDNSThreadLimit(t *testing.T) {
+ if testing.Short() || !*testExternal {
+ t.Skip("skipping test to avoid external network")
+ }
+
+ const N = 10000
+ c := make(chan int, N)
+ for i := 0; i < N; i++ {
+ go func(i int) {
+ LookupIP(fmt.Sprintf("%d.net-test.golang.org", i))
+ c <- 1
+ }(i)
+ }
+ // Don't bother waiting for the stragglers; stop at 0.9 N.
+ for i := 0; i < N*9/10; i++ {
+ if i%100 == 0 {
+ //println("TestDNSThreadLimit:", i)
+ }
+ <-c
+ }
+
+ // If we're still here, it worked.
+}