aboutsummaryrefslogtreecommitdiff
path: root/src/net/writev_test.go
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2016-10-29 18:37:49 +1100
committerAlex Brainman <alex.brainman@gmail.com>2016-11-02 06:30:48 +0000
commite22b5efb36e5977590d760c98db9f3fabaea7202 (patch)
treef07408e6b7893f207c55ab362f191c93eebcfa48 /src/net/writev_test.go
parentc57a443e8777de0f34444dd512fbcb099e7b3e29 (diff)
downloadgo-e22b5efb36e5977590d760c98db9f3fabaea7202.tar.xz
net: implement Buffers on windows
Updates #13451 Change-Id: I2c3c66d9532c16e616c476e2afe31b3ddc0a8d79 Reviewed-on: https://go-review.googlesource.com/32371 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/writev_test.go')
-rw-r--r--src/net/writev_test.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/net/writev_test.go b/src/net/writev_test.go
index 175bc38400..4d2fc39506 100644
--- a/src/net/writev_test.go
+++ b/src/net/writev_test.go
@@ -150,18 +150,27 @@ func testBuffer_writeTo(t *testing.T, chunks int, useCopy bool) {
}
var wantSum int
- var wantMinCalls int
switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd":
+ var wantMinCalls int
wantSum = want.Len()
v := chunks
for v > 0 {
wantMinCalls++
v -= 1024
}
- }
- if len(writeLog.log) < wantMinCalls {
- t.Errorf("write calls = %v < wanted min %v", len(writeLog.log), wantMinCalls)
+ if len(writeLog.log) < wantMinCalls {
+ t.Errorf("write calls = %v < wanted min %v", len(writeLog.log), wantMinCalls)
+ }
+ case "windows":
+ var wantCalls int
+ wantSum = want.Len()
+ if wantSum > 0 {
+ wantCalls = 1 // windows will always do 1 syscall, unless sending empty buffer
+ }
+ if len(writeLog.log) != wantCalls {
+ t.Errorf("write calls = %v; want %v", len(writeLog.log), wantCalls)
+ }
}
if gotSum != wantSum {
t.Errorf("writev call sum = %v; want %v", gotSum, wantSum)
@@ -171,6 +180,10 @@ func testBuffer_writeTo(t *testing.T, chunks int, useCopy bool) {
}
func TestWritevError(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skipf("skipping the test: windows does not have problem sending large chunks of data")
+ }
+
ln, err := newLocalListener("tcp")
if err != nil {
t.Fatal(err)