mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
Move TestUtimesNanoAt to syscall_unix_test.go. All BSDs and solaris/illumos provide UtimesNanoAt. The implementations on linux and darwin are already the same and the type conversions of Timespec members on aix should no longer be necessary since CL 177838. Change-Id: If0d03a92b3167da08191b6e98888eec92f27c3c9 Reviewed-on: https://go-review.googlesource.com/c/sys/+/213398 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
35 lines
812 B
Go
35 lines
812 B
Go
// Copyright 2018 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.
|
|
|
|
package unix_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// stringsFromByteSlice converts a sequence of attributes to a []string.
|
|
// On Darwin, each entry is a NULL-terminated string.
|
|
func stringsFromByteSlice(buf []byte) []string {
|
|
var result []string
|
|
off := 0
|
|
for i, b := range buf {
|
|
if b == 0 {
|
|
result = append(result, string(buf[off:i]))
|
|
off = i + 1
|
|
}
|
|
}
|
|
return result
|
|
}
|
|
|
|
func TestSysctlClockinfo(t *testing.T) {
|
|
ci, err := unix.SysctlClockinfo("kern.clockrate")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Logf("tick = %v, tickadj = %v, hz = %v, profhz = %v, stathz = %v",
|
|
ci.Tick, ci.Tickadj, ci.Hz, ci.Profhz, ci.Stathz)
|
|
}
|