]> Cypherpunks.ru repositories - gostls13.git/commitdiff
os: checking for testable network before creating local listener
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 27 Feb 2023 04:23:03 +0000 (11:23 +0700)
committerGopher Robot <gobot@golang.org>
Mon, 27 Feb 2023 11:56:55 +0000 (11:56 +0000)
Fixes #58745

Change-Id: Id6666477b2c25f081d6f86047cea12bf8b3cb679
Reviewed-on: https://go-review.googlesource.com/c/go/+/471495
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Andy Pan <panjf2000@gmail.com>
src/os/readfrom_linux_test.go

index 3909c2f02e29c25f4ed7469a750d30a331cf529d..c4990713409c577b576543d357cb1f9b0c4c2be1 100644 (file)
@@ -13,6 +13,7 @@ import (
        "os"
        . "os"
        "path/filepath"
+       "runtime"
        "strconv"
        "strings"
        "syscall"
@@ -701,6 +702,9 @@ func testGetPollFromReader(t *testing.T, proto string) {
 
 func createSocketPair(t *testing.T, proto string) (client, server net.Conn) {
        t.Helper()
+       if !nettest.TestableNetwork(proto) {
+               t.Skipf("%s does not support %q", runtime.GOOS, proto)
+       }
 
        ln, err := nettest.NewLocalListener(proto)
        if err != nil {