summaryrefslogtreecommitdiffhomepage
path: root/pkg/usermem/usermem_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/usermem/usermem_test.go')
-rw-r--r--pkg/usermem/usermem_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/usermem/usermem_test.go b/pkg/usermem/usermem_test.go
index 597770ca7..a5e2fe69e 100644
--- a/pkg/usermem/usermem_test.go
+++ b/pkg/usermem/usermem_test.go
@@ -25,7 +25,6 @@ import (
"gvisor.dev/gvisor/pkg/errors/linuxerr"
"gvisor.dev/gvisor/pkg/hostarch"
"gvisor.dev/gvisor/pkg/safemem"
- "gvisor.dev/gvisor/pkg/syserror"
)
// newContext returns a context.Context that we can use in these tests (we
@@ -52,7 +51,7 @@ func TestBytesIOCopyOutSuccess(t *testing.T) {
func TestBytesIOCopyOutFailure(t *testing.T) {
b := newBytesIOString("ABC")
n, err := b.CopyOut(newContext(), 1, []byte("foo"), IOOpts{})
- if wantN, wantErr := 2, syserror.EFAULT; n != wantN || err != wantErr {
+ if wantN, wantErr := 2, linuxerr.EFAULT; n != wantN || err != wantErr {
t.Errorf("CopyOut: got (%v, %v), wanted (%v, %v)", n, err, wantN, wantErr)
}
if got, want := b.Bytes, []byte("Afo"); !bytes.Equal(got, want) {
@@ -76,7 +75,7 @@ func TestBytesIOCopyInFailure(t *testing.T) {
b := newBytesIOString("Afo")
var dst [3]byte
n, err := b.CopyIn(newContext(), 1, dst[:], IOOpts{})
- if wantN, wantErr := 2, syserror.EFAULT; n != wantN || err != wantErr {
+ if wantN, wantErr := 2, linuxerr.EFAULT; n != wantN || err != wantErr {
t.Errorf("CopyIn: got (%v, %v), wanted (%v, %v)", n, err, wantN, wantErr)
}
if got, want := dst[:], []byte("fo\x00"); !bytes.Equal(got, want) {
@@ -98,7 +97,7 @@ func TestBytesIOZeroOutSuccess(t *testing.T) {
func TestBytesIOZeroOutFailure(t *testing.T) {
b := newBytesIOString("ABC")
n, err := b.ZeroOut(newContext(), 1, 3, IOOpts{})
- if wantN, wantErr := int64(2), syserror.EFAULT; n != wantN || err != wantErr {
+ if wantN, wantErr := int64(2), linuxerr.EFAULT; n != wantN || err != wantErr {
t.Errorf("ZeroOut: got (%v, %v), wanted (%v, %v)", n, err, wantN, wantErr)
}
if got, want := b.Bytes, []byte("A\x00\x00"); !bytes.Equal(got, want) {
@@ -126,7 +125,7 @@ func TestBytesIOCopyOutFromFailure(t *testing.T) {
{Start: 1, End: 4},
{Start: 4, End: 7},
}), safemem.FromIOReader{bytes.NewBufferString("foobar")}, IOOpts{})
- if wantN, wantErr := int64(4), syserror.EFAULT; n != wantN || err != wantErr {
+ if wantN, wantErr := int64(4), linuxerr.EFAULT; n != wantN || err != wantErr {
t.Errorf("CopyOutFrom: got (%v, %v), wanted (%v, %v)", n, err, wantN, wantErr)
}
if got, want := b.Bytes, []byte("Afoob"); !bytes.Equal(got, want) {
@@ -156,7 +155,7 @@ func TestBytesIOCopyInToFailure(t *testing.T) {
{Start: 1, End: 4},
{Start: 4, End: 7},
}), safemem.FromIOWriter{&dst}, IOOpts{})
- if wantN, wantErr := int64(4), syserror.EFAULT; n != wantN || err != wantErr {
+ if wantN, wantErr := int64(4), linuxerr.EFAULT; n != wantN || err != wantErr {
t.Errorf("CopyOutFrom: got (%v, %v), wanted (%v, %v)", n, err, wantN, wantErr)
}
if got, want := dst.Bytes(), []byte("foob"); !bytes.Equal(got, want) {
@@ -207,7 +206,7 @@ func TestCopyStringInVeryLong(t *testing.T) {
func TestCopyStringInNoTerminatingZeroByte(t *testing.T) {
want := strings.Repeat("A", copyStringIncrement-1)
got, err := CopyStringIn(newContext(), newBytesIOString(want), 0, 2*copyStringIncrement, IOOpts{})
- if wantErr := syserror.EFAULT; got != want || err != wantErr {
+ if wantErr := linuxerr.EFAULT; got != want || err != wantErr {
t.Errorf("CopyStringIn: got (%q, %v), wanted (%q, %v)", got, err, want, wantErr)
}
}