From 349b81fb5c64ec1734eb6ee148df25459ea48517 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 8 Mar 2018 15:43:59 +1300 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/syscall_linux_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go index 78d28792..ff7ad82b 100644 --- a/unix/syscall_linux_test.go +++ b/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)