github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_bsd_test.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build darwin dragonfly freebsd openbsd 6 7 package unix_test 8 9 import ( 10 "runtime" 11 "testing" 12 13 "golang.org/x/sys/unix" 14 ) 15 16 const MNT_WAIT = 1 17 18 func TestGetfsstat(t *testing.T) { 19 n, err := unix.Getfsstat(nil, MNT_WAIT) 20 if err != nil { 21 t.Fatal(err) 22 } 23 24 data := make([]unix.Statfs_t, n) 25 n, err = unix.Getfsstat(data, MNT_WAIT) 26 if err != nil { 27 t.Fatal(err) 28 } 29 30 empty := unix.Statfs_t{} 31 for _, stat := range data { 32 if stat == empty { 33 t.Fatal("an empty Statfs_t struct was returned") 34 } 35 } 36 } 37 38 func TestSysctlRaw(t *testing.T) { 39 if runtime.GOOS == "openbsd" { 40 t.Skip("kern.proc.pid does not exist on OpenBSD") 41 } 42 43 _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid()) 44 if err != nil { 45 t.Fatal(err) 46 } 47 }