From: Dmitri Shuralyov Date: Tue, 25 Jul 2023 17:58:37 +0000 (-0400) Subject: net: make mustHaveExternalNetwork work as usual on GOOS=linux X-Git-Tag: go1.22rc1~1509 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9b0361e549949a208aa6bbcdff25506a3f97d7a9;p=gostls13.git 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 Reviewed-by: Heschi Kreinick TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov --- 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 {