nettest: simplify iOS detection in TestableNetwork

Go 1.16 renamed the iOS port from darwin/arm64 to ios/arm64 and
darwin/arm64 was repurposed for the macOS ARM64 port (see
https://golang.org/doc/go1.16#darwin).

Now that Go 1.16 is the oldest supported release, the ios tag can be
used exclusively in TestableNetwork to detect iOS, increasing test
coverage for darwin/arm64.

For golang/go#45696

Change-Id: If607ff8847ed42160ef5e8260d2a8c21798a164a
Reviewed-on: https://go-review.googlesource.com/c/net/+/354809
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Tobias Klauser
2021-10-08 19:07:36 +02:00
committed by Tobias Klauser
parent 59d4e928ea
commit 3b03d30599

View File

@@ -95,13 +95,8 @@ func TestableNetwork(network string) bool {
// This is an internal network name for testing on the
// package net of the standard library.
switch runtime.GOOS {
case "android", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
case "android", "fuchsia", "hurd", "ios", "js", "nacl", "plan9", "windows":
return false
case "darwin", "ios":
// iOS doesn't support it.
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
return false
}
}
case "ip", "ip4", "ip6":
switch runtime.GOOS {
@@ -114,15 +109,10 @@ func TestableNetwork(network string) bool {
}
case "unix", "unixgram":
switch runtime.GOOS {
case "android", "fuchsia", "hurd", "js", "nacl", "plan9", "windows":
case "android", "fuchsia", "hurd", "ios", "js", "nacl", "plan9", "windows":
return false
case "aix":
return unixStrmDgramEnabled()
case "darwin", "ios":
// iOS does not support unix, unixgram.
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
return false
}
}
case "unixpacket":
switch runtime.GOOS {