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>
This commit is contained in:
Michael Hudson-Doyle
2018-03-08 15:43:59 +13:00
committed by Brad Fitzpatrick
parent dd2ff4accc
commit 349b81fb5c

View File

@@ -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)