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."
Change-Id: If48407745c47c677f691d5c0156886eeca5bb9b0
Reviewed-on: https://go-review.googlesource.com/138838
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/libgo/go/net/splice_test.go b/libgo/go/net/splice_test.go
index 44a5c00..40ed19b 100644
--- a/libgo/go/net/splice_test.go
+++ b/libgo/go/net/splice_test.go
@@ -11,7 +11,9 @@
"fmt"
"io"
"io/ioutil"
+ "os"
"sync"
+ "syscall"
"testing"
)
@@ -225,6 +227,10 @@
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{