summaryrefslogtreecommitdiff
path: root/libgo/go/net
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-10-02 15:07:14 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-02 15:07:14 +0000
commit4913fc07e0b3f1d574dc20f83ec819a26ab4346e (patch)
treea71fa364340b23c6320039a6aa0951d3decfb01f /libgo/go/net
parent0036218b1093a36a67d7c04834e5c0383eda6efa (diff)
downloadgcc-4913fc07e0b3f1d574dc20f83ec819a26ab4346e.tar.gz
net: don't fail test if splice fails because pipe2 is missing
This reportedly happens on CentOS 5.11. The real code will work fine; this test is assuming that the unexported slice function will handle the splice, but if pipe2 does not work then it doesn't. The relevant code in internal/poll/splice_linux.go says "Falling back to pipe is possible, but prior to 2.6.29 splice returns -EAGAIN instead of 0 when the connection is closed." Reviewed-on: https://go-review.googlesource.com/138838 From-SVN: r264793
Diffstat (limited to 'libgo/go/net')
-rw-r--r--libgo/go/net/splice_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libgo/go/net/splice_test.go b/libgo/go/net/splice_test.go
index 44a5c00ba87..40ed19b8fa8 100644
--- a/libgo/go/net/splice_test.go
+++ b/libgo/go/net/splice_test.go
@@ -11,7 +11,9 @@ import (
"fmt"
"io"
"io/ioutil"
+ "os"
"sync"
+ "syscall"
"testing"
)
@@ -225,6 +227,10 @@ func testSpliceReaderAtEOF(t *testing.T) {
serverUp.Close()
_, err, handled := splice(serverDown.(*TCPConn).fd, serverUp)
if !handled {
+ if serr, ok := err.(*os.SyscallError); ok && serr.Syscall == "pipe2" && serr.Err == syscall.ENOSYS {
+ t.Skip("pipe2 not supported")
+ }
+
t.Errorf("closed connection: got err = %v, handled = %t, want handled = true", err, handled)
}
lr := &io.LimitedReader{