cpu: skip percpu percent test if windows. Windows can only get one CPU info currently.
This commit is contained in:
parent
ae3b0a48f4
commit
ec2b509dda
|
@ -62,14 +62,16 @@ func TestCpuInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func testCPUPercent(t *testing.T, percpu bool) {
|
||||
numcpu := runtime.NumCPU()
|
||||
if runtime.GOOS != "windows" {
|
||||
v, err := CPUPercent(time.Millisecond, percpu)
|
||||
if err != nil {
|
||||
t.Errorf("error %v", err)
|
||||
}
|
||||
numcpu := runtime.NumCPU()
|
||||
if (percpu && len(v) != numcpu) || (!percpu && len(v) != 1) {
|
||||
t.Fatalf("wrong number of entries from CPUPercent: %v", v)
|
||||
}
|
||||
}
|
||||
for i := 0; i < 100; i++ {
|
||||
duration := time.Duration(10) * time.Microsecond
|
||||
v, err := CPUPercent(duration, percpu)
|
||||
|
|
Loading…
Reference in New Issue