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,13 +62,15 @@ func TestCpuInfo(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCPUPercent(t *testing.T, percpu bool) {
|
func testCPUPercent(t *testing.T, percpu bool) {
|
||||||
v, err := CPUPercent(time.Millisecond, percpu)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("error %v", err)
|
|
||||||
}
|
|
||||||
numcpu := runtime.NumCPU()
|
numcpu := runtime.NumCPU()
|
||||||
if (percpu && len(v) != numcpu) || (!percpu && len(v) != 1) {
|
if runtime.GOOS != "windows" {
|
||||||
t.Fatalf("wrong number of entries from CPUPercent: %v", v)
|
v, err := CPUPercent(time.Millisecond, percpu)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("error %v", err)
|
||||||
|
}
|
||||||
|
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++ {
|
for i := 0; i < 100; i++ {
|
||||||
duration := time.Duration(10) * time.Microsecond
|
duration := time.Duration(10) * time.Microsecond
|
||||||
|
|
Loading…
Reference in New Issue