Skip to content

Commit 86e78c1

Browse files
nixprimegvisor-bot
authored andcommitted
Internal change.
PiperOrigin-RevId: 840021943
1 parent 17e4b24 commit 86e78c1

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

pkg/gomaxprocs/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ go_test(
3232
size = "small",
3333
srcs = ["gomaxprocs_test.go"],
3434
library = ":gomaxprocs",
35+
deps = [
36+
"//pkg/sync",
37+
],
3538
)

pkg/gomaxprocs/gomaxprocs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"runtime"
3030

3131
"gvisor.dev/gvisor/pkg/log"
32+
"gvisor.dev/gvisor/pkg/sync"
3233
)
3334

3435
var (
@@ -56,6 +57,11 @@ func SetBase(n int) {
5657
// with negative n to remove temporary GOMAXPROCS when they are no longer
5758
// needed.
5859
func Add(n int) {
60+
if sync.RaceEnabled {
61+
// FIXME: b/465516110
62+
log.Infof("Race detection enabled: skipping temporary GOMAXPROCS adjustment")
63+
return
64+
}
5965
mu.Lock()
6066
defer mu.Unlock()
6167
t := temp + n

pkg/gomaxprocs/gomaxprocs_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ package gomaxprocs
1717
import (
1818
"runtime"
1919
"testing"
20+
21+
"gvisor.dev/gvisor/pkg/sync"
2022
)
2123

2224
// reset cancels the effect of all previous calls to SetBase and Add and sets
@@ -30,6 +32,11 @@ func reset(n int) {
3032
}
3133

3234
func TestBasic(t *testing.T) {
35+
if sync.RaceEnabled {
36+
// FIXME: b/465516110
37+
t.Skipf("Race detection enabled: skipping test")
38+
}
39+
3340
init := runtime.GOMAXPROCS(0)
3441
defer reset(init)
3542

@@ -61,6 +68,11 @@ func TestBasic(t *testing.T) {
6168
}
6269

6370
func TestAddIgnoredUntilSetBase(t *testing.T) {
71+
if sync.RaceEnabled {
72+
// FIXME: b/465516110
73+
t.Skipf("Race detection enabled: skipping test")
74+
}
75+
6476
init := runtime.GOMAXPROCS(0)
6577
defer reset(init)
6678

0 commit comments

Comments
 (0)