diff options
Diffstat (limited to 'src/runtime/runtime_linux_test.go')
-rw-r--r-- | src/runtime/runtime_linux_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/runtime_linux_test.go b/src/runtime/runtime_linux_test.go index 5344ed2051..58c797f1dd 100644 --- a/src/runtime/runtime_linux_test.go +++ b/src/runtime/runtime_linux_test.go @@ -8,6 +8,7 @@ import ( . "runtime" "syscall" "testing" + "unsafe" ) var pid, tid int @@ -27,3 +28,15 @@ func TestLockOSThread(t *testing.T) { t.Fatalf("pid=%d but tid=%d", pid, tid) } } + +// Test that error values are negative. Use address 1 (a misaligned +// pointer) to get -EINVAL. +func TestMincoreErrorSign(t *testing.T) { + var dst byte + v := Mincore(unsafe.Pointer(uintptr(1)), 1, &dst) + + const EINVAL = 0x16 + if v != -EINVAL { + t.Errorf("mincore = %v, want %v", v, -EINVAL) + } +} |