aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2023-07-25 13:58:37 -0400
committerGopher Robot <gobot@golang.org>2023-07-27 22:07:17 +0000
commit9b0361e549949a208aa6bbcdff25506a3f97d7a9 (patch)
tree720ac962c534b2f348f16a4f8ce1720dad5d74e8 /src/net
parent3bc28402fae2a1646e4d2756344b5eb34994d25f (diff)
downloadgo-9b0361e549949a208aa6bbcdff25506a3f97d7a9.tar.xz
net: make mustHaveExternalNetwork work as usual on GOOS=linux
I considered deleting mustHaveExternalNetwork in favor of just using the real testenv.MustHaveExternalNetwork. That certainly makes these tests that call it easier to understand. But that negatively affects some ports that don't have a longtest builder as it'd make the tests not run automatically on any builder at all. So, make a minimal change that applies only to GOOS=linux for now. If we make more progress on establishing -longtest builders for all ports, this intermediate layer helper will cease to have any benefit and can be deleted in favor of the one in testenv package. Change-Id: Iaea207d98e780db429ab49e6e227650a8b35b786 Reviewed-on: https://go-review.googlesource.com/c/go/+/513416 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/dial_test.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/net/dial_test.go b/src/net/dial_test.go
index ca9f0da3d3..784fb1d899 100644
--- a/src/net/dial_test.go
+++ b/src/net/dial_test.go
@@ -1052,13 +1052,20 @@ func TestDialerControlContext(t *testing.T) {
}
// mustHaveExternalNetwork is like testenv.MustHaveExternalNetwork
-// except that it won't skip testing on non-mobile builders.
+// except on non-Linux, non-mobile builders it permits the test to
+// run in -short mode.
func mustHaveExternalNetwork(t *testing.T) {
t.Helper()
+ definitelyHasLongtestBuilder := runtime.GOOS == "linux"
mobile := runtime.GOOS == "android" || runtime.GOOS == "ios"
- if testenv.Builder() == "" || mobile {
- testenv.MustHaveExternalNetwork(t)
+ if testenv.Builder() != "" && !definitelyHasLongtestBuilder && !mobile {
+ // On a non-Linux, non-mobile builder (e.g., freebsd-amd64-13_0).
+ //
+ // Don't skip testing because otherwise the test may never run on
+ // any builder if this port doesn't also have a -longtest builder.
+ return
}
+ testenv.MustHaveExternalNetwork(t)
}
type contextWithNonZeroDeadline struct {