]> Cypherpunks repositories - gostls13.git/commitdiff
net: skip BenchmarkSendFile on Windows
authorAndy Pan <panjf2000@gmail.com>
Thu, 8 Feb 2024 02:15:53 +0000 (10:15 +0800)
committerGopher Robot <gobot@golang.org>
Sat, 10 Feb 2024 02:03:41 +0000 (02:03 +0000)
Follow up CL 543276

Change-Id: Ie02cf8a489a069bb0a3be1d8636e30d0658329c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562595
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

src/net/mockserver_test.go
src/net/sendfile_test.go

index d4bd16e4c681f572ecc64fd9631e2d4a6d52331b..f5ac32faddea01f0abecc7c7d1c091be665d2298 100644 (file)
@@ -12,6 +12,7 @@ import (
        "log"
        "os"
        "path/filepath"
+       "runtime"
        "strconv"
        "sync"
        "testing"
@@ -512,6 +513,7 @@ func packetTransceiver(c PacketConn, wb []byte, dst Addr, ch chan<- error) {
 
 func spawnTestSocketPair(t testing.TB, net string) (client, server Conn) {
        t.Helper()
+
        ln := newLocalListener(t, net)
        defer ln.Close()
        var cerr, serr error
@@ -538,6 +540,14 @@ func spawnTestSocketPair(t testing.TB, net string) (client, server Conn) {
 }
 
 func startTestSocketPeer(t testing.TB, conn Conn, op string, chunkSize, totalSize int) (func(t testing.TB), error) {
+       t.Helper()
+
+       if runtime.GOOS == "windows" {
+               // TODO(panjf2000): Windows has not yet implemented FileConn,
+               //              remove this when it's implemented in https://go.dev/issues/9503.
+               t.Fatalf("startTestSocketPeer is not supported on %s", runtime.GOOS)
+       }
+
        f, err := conn.(interface{ File() (*os.File, error) }).File()
        if err != nil {
                return nil, err
index c3d5e714bde1a09a478723ca51b00bf992c6acb3..8fadb47c153374e3060d96d3e945fd183c5aab17 100644 (file)
@@ -449,6 +449,12 @@ func BenchmarkSendfileZeroBytes(b *testing.B) {
 }
 
 func BenchmarkSendFile(b *testing.B) {
+       if runtime.GOOS == "windows" {
+               // TODO(panjf2000): Windows has not yet implemented FileConn,
+               //              remove this when it's implemented in https://go.dev/issues/9503.
+               b.Skipf("skipping on %s", runtime.GOOS)
+       }
+
        b.Run("file-to-tcp", func(b *testing.B) { benchmarkSendFile(b, "tcp") })
        b.Run("file-to-unix", func(b *testing.B) { benchmarkSendFile(b, "unix") })
 }