Skip to content

Commit a187890

Browse files
panjf2000gopherbot
authored andcommitted
net: skip BenchmarkSendFile on Windows
Follow up CL 543276 Change-Id: Ie02cf8a489a069bb0a3be1d8636e30d0658329c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/562595 Reviewed-by: Bryan Mills <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 20f4b6d commit a187890

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/net/mockserver_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"log"
1313
"os"
1414
"path/filepath"
15+
"runtime"
1516
"strconv"
1617
"sync"
1718
"testing"
@@ -512,6 +513,7 @@ func packetTransceiver(c PacketConn, wb []byte, dst Addr, ch chan<- error) {
512513

513514
func spawnTestSocketPair(t testing.TB, net string) (client, server Conn) {
514515
t.Helper()
516+
515517
ln := newLocalListener(t, net)
516518
defer ln.Close()
517519
var cerr, serr error
@@ -538,6 +540,14 @@ func spawnTestSocketPair(t testing.TB, net string) (client, server Conn) {
538540
}
539541

540542
func startTestSocketPeer(t testing.TB, conn Conn, op string, chunkSize, totalSize int) (func(t testing.TB), error) {
543+
t.Helper()
544+
545+
if runtime.GOOS == "windows" {
546+
// TODO(panjf2000): Windows has not yet implemented FileConn,
547+
// remove this when it's implemented in https://go.dev/issues/9503.
548+
t.Fatalf("startTestSocketPeer is not supported on %s", runtime.GOOS)
549+
}
550+
541551
f, err := conn.(interface{ File() (*os.File, error) }).File()
542552
if err != nil {
543553
return nil, err

src/net/sendfile_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ func BenchmarkSendfileZeroBytes(b *testing.B) {
449449
}
450450

451451
func BenchmarkSendFile(b *testing.B) {
452+
if runtime.GOOS == "windows" {
453+
// TODO(panjf2000): Windows has not yet implemented FileConn,
454+
// remove this when it's implemented in https://go.dev/issues/9503.
455+
b.Skipf("skipping on %s", runtime.GOOS)
456+
}
457+
452458
b.Run("file-to-tcp", func(b *testing.B) { benchmarkSendFile(b, "tcp") })
453459
b.Run("file-to-unix", func(b *testing.B) { benchmarkSendFile(b, "unix") })
454460
}

0 commit comments

Comments
 (0)