aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2016-05-13 12:13:00 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2016-05-21 00:23:53 +0000
commit82ec4cd79f117191d12fc14060c4b4b786feca5b (patch)
tree9850edbce57cb3b214a5121ad327af4df058ca0f /src
parentda5ac69bd4dce05443220c73c9eadb606b9777f8 (diff)
downloadgo-82ec4cd79f117191d12fc14060c4b4b786feca5b.tar.xz
net: don't crash DNS flood test on darwin
Also renames the test function to TestDNSFlood. Updates #15659. Change-Id: Ia562004c43bcc19c2fee9440321c27b591f85da5 Reviewed-on: https://go-review.googlesource.com/23077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/net/lookup_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go
index 7d18cbdced..e22d1fbf79 100644
--- a/src/net/lookup_test.go
+++ b/src/net/lookup_test.go
@@ -371,12 +371,23 @@ func TestReverseAddress(t *testing.T) {
}
}
-func TestLookupIPDeadline(t *testing.T) {
+func TestDNSFlood(t *testing.T) {
if !*testDNSFlood {
t.Skip("test disabled; use -dnsflood to enable")
}
- const N = 5000
+ var N = 5000
+ if runtime.GOOS == "darwin" {
+ // On Darwin this test consumes kernel threads much
+ // than other platforms for some reason.
+ // When we monitor the number of allocated Ms by
+ // observing on runtime.newm calls, we can see that it
+ // easily reaches the per process ceiling
+ // kern.num_threads when CGO_ENABLED=1 and
+ // GODEBUG=netdns=go.
+ N = 500
+ }
+
const timeout = 3 * time.Second
ctxHalfTimeout, cancel := context.WithTimeout(context.Background(), timeout/2)
defer cancel()