浏览代码

unix: skip SchedAffinity test on single CPU system

Because you can't bind a thread to the second CPU if it's not there.

Change-Id: I2af4e66667711dc9a3aa23fee073a70cdc5fdd4d
Reviewed-on: https://go-review.googlesource.com/99355
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Michael Hudson-Doyle 7 年之前
父节点
当前提交
349b81fb5c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      unix/syscall_linux_test.go

+ 4 - 0
unix/syscall_linux_test.go

@@ -292,6 +292,10 @@ func TestSchedSetaffinity(t *testing.T) {
 		t.Errorf("CpuClr: didn't clear CPU %d in set: %v", cpu, newMask)
 	}
 
+	if runtime.NumCPU() < 2 {
+		t.Skip("skipping setaffinity tests on single CPU system")
+	}
+
 	err = unix.SchedSetaffinity(0, &newMask)
 	if err != nil {
 		t.Fatalf("SchedSetaffinity: %v", err)