mirror of
https://github.com/golang/go.git
synced 2025-10-28 15:24:13 +00:00
syscall: fix solaris build
Solaris does not define syscall.{Mmap,Munmap}. Move the Mmap test to a new file and exclude solaris as discussed.
LGTM=aram
R=aram, mikioh.mikioh, iant
CC=golang-codereviews
https://golang.org/cl/68720043
This commit is contained in:
parent
391002a82b
commit
f9b384f554
2 changed files with 23 additions and 11 deletions
22
src/pkg/syscall/mmap_unix_test.go
Normal file
22
src/pkg/syscall/mmap_unix_test.go
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
|
package syscall_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build freebsd dragonfly darwin linux netbsd openbsd solaris
|
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package syscall_test
|
package syscall_test
|
||||||
|
|
||||||
|
|
@ -77,16 +77,6 @@ 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.
|
// TestPassFD tests passing a file descriptor over a Unix socket.
|
||||||
//
|
//
|
||||||
// This test involved both a parent and child process. The parent
|
// This test involved both a parent and child process. The parent
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue