aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-04-05 11:42:37 -0700
committerIan Lance Taylor <iant@golang.org>2019-10-21 14:07:34 +0000
commitb653c878b1ad8d1b4f8d7b04201d0cb0a4156ead (patch)
tree3f4189ae0a4f5c61ae8fc0badf402d2016533289 /src/runtime/runtime_test.go
parent6917b3c839af615e22ef479b23983d186e578bd6 (diff)
downloadgo-b653c878b1ad8d1b4f8d7b04201d0cb0a4156ead.tar.gz
go-b653c878b1ad8d1b4f8d7b04201d0cb0a4156ead.zip
runtime: change read and write to return negative errno value
The internal read and write functions used to return -1 on error; change them to return a negative errno value instead. This will be used by later CLs in this series. For most targets this is a simplification, although for ones that call into libc it is a complication. Updates #27707 Change-Id: Id02bf9487f03e7e88e4f2b85e899e986738697ad Reviewed-on: https://go-review.googlesource.com/c/go/+/171823 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/runtime_test.go')
-rw-r--r--src/runtime/runtime_test.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go
index ab7a03b2d1..26ae77456a 100644
--- a/src/runtime/runtime_test.go
+++ b/src/runtime/runtime_test.go
@@ -290,32 +290,6 @@ func TestTrailingZero(t *testing.T) {
}
}
-func TestBadOpen(t *testing.T) {
- if GOOS == "windows" || GOOS == "js" {
- t.Skip("skipping OS that doesn't have open/read/write/close")
- }
- // make sure we get the correct error code if open fails. Same for
- // read/write/close on the resulting -1 fd. See issue 10052.
- nonfile := []byte("/notreallyafile")
- fd := Open(&nonfile[0], 0, 0)
- if fd != -1 {
- t.Errorf("open(\"%s\")=%d, want -1", string(nonfile), fd)
- }
- var buf [32]byte
- r := Read(-1, unsafe.Pointer(&buf[0]), int32(len(buf)))
- if r != -1 {
- t.Errorf("read()=%d, want -1", r)
- }
- w := Write(^uintptr(0), unsafe.Pointer(&buf[0]), int32(len(buf)))
- if w != -1 {
- t.Errorf("write()=%d, want -1", w)
- }
- c := Close(-1)
- if c != -1 {
- t.Errorf("close()=%d, want -1", c)
- }
-}
-
func TestAppendGrowth(t *testing.T) {
var x []int64
check := func(want int) {