mirror of
https://github.com/golang/go.git
synced 2025-10-29 15:54:14 +00:00
syscall: add mmap test
This CL adds a test that calls Mmap and Munmap through Syscall9 as the canary that detects assembly fragment breakage. For now there is no package test that uses Syscall9 in the standard library across all Unix-like systems. Note that the package runtime owns its assembly fragments, so this canary never works for runtime breakage. LGTM=iant, bradfitz R=iant, minux.ma, bradfitz CC=golang-codereviews https://golang.org/cl/61520049
This commit is contained in:
parent
ec0c9f270e
commit
b05f3de56f
1 changed files with 10 additions and 0 deletions
|
|
@ -77,6 +77,16 @@ func TestFcntlFlock(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestMmap(t *testing.T) {
|
||||
b, err := syscall.Mmap(-1, 0, syscall.Getpagesize(), syscall.PROT_NONE, syscall.MAP_ANON|syscall.MAP_PRIVATE)
|
||||
if err != nil {
|
||||
t.Fatalf("Mmap: %v", err)
|
||||
}
|
||||
if err := syscall.Munmap(b); err != nil {
|
||||
t.Fatalf("Munmap: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestPassFD tests passing a file descriptor over a Unix socket.
|
||||
//
|
||||
// This test involved both a parent and child process. The parent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue