]> Cypherpunks repositories - gostls13.git/commit
net, os, internal/poll: test for use of sendfile
authorDamien Neil <dneil@google.com>
Thu, 25 Apr 2024 18:53:45 +0000 (11:53 -0700)
committerDamien Neil <dneil@google.com>
Fri, 26 Apr 2024 18:12:56 +0000 (18:12 +0000)
commitb384ee7cebe1b386e324dcca2c93beb96ea31c9e
tree16913efe13aedcfc2c2ae37433241c6296865361
parent196916299da7568a2a2165246e5164637df03fb9
net, os, internal/poll: test for use of sendfile

The net package's sendfile tests exercise various paths where
we expect sendfile to be used, but don't verify that sendfile
was in fact used.

Add a hook to internal/poll.SendFile to let us verify that
sendfile was called when expected. Update os package tests
(which use their own hook mechanism) to use this hook as well.

For #66988

Change-Id: I7afb130dcfe0063d60c6ea0f8560cf8665ad5a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/581778
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
13 files changed:
src/internal/poll/sendfile.go [new file with mode: 0644]
src/internal/poll/sendfile_bsd.go
src/internal/poll/sendfile_linux.go
src/internal/poll/sendfile_solaris.go
src/internal/poll/sendfile_windows.go
src/net/sendfile_linux.go
src/net/sendfile_stub.go
src/net/sendfile_test.go
src/net/sendfile_unix_alt.go
src/net/sendfile_windows.go
src/os/export_linux_test.go
src/os/writeto_linux_test.go
src/os/zero_copy_linux.go