Skip to content

Commit 3b38626

Browse files
committed
net: don't run IP stack required tests on IP stack unimplemented kernels
Fixes #10787. Change-Id: I35c96808a713dafb1f0fea301fa3f3528fe6a5bf Reviewed-on: https://go-review.googlesource.com/9948 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
1 parent 6f7961d commit 3b38626

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/net/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func printLeakedGoroutines() {
9797
if len(gss) == 0 {
9898
return
9999
}
100-
fmt.Fprintf(os.Stderr, "Leaked goroutines:\n")
100+
fmt.Fprintf(os.Stderr, "Running goroutines:\n")
101101
for _, gs := range gss {
102102
fmt.Fprintf(os.Stderr, "%v\n", gs)
103103
}
@@ -130,7 +130,7 @@ func printLeakedSockets() {
130130
if len(sos) == 0 {
131131
return
132132
}
133-
fmt.Fprintf(os.Stderr, "Leaked sockets:\n")
133+
fmt.Fprintf(os.Stderr, "Inflight sockets:\n")
134134
for s, so := range sos {
135135
fmt.Fprintf(os.Stderr, "%v: %v\n", s, so)
136136
}

src/net/platform_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import (
1414
// testableNetwork reports whether network is testable on the current
1515
// platform configuration.
1616
func testableNetwork(network string) bool {
17-
switch ss := strings.Split(network, ":"); ss[0] {
17+
ss := strings.Split(network, ":")
18+
switch ss[0] {
1819
case "ip+nopriv":
1920
switch runtime.GOOS {
2021
case "nacl":
@@ -46,6 +47,16 @@ func testableNetwork(network string) bool {
4647
return false
4748
}
4849
}
50+
switch ss[0] {
51+
case "tcp4", "udp4", "ip4":
52+
if !supportsIPv4 {
53+
return false
54+
}
55+
case "tcp6", "udp6", "ip6":
56+
if !supportsIPv6 {
57+
return false
58+
}
59+
}
4960
return true
5061
}
5162

0 commit comments

Comments
 (0)