Skip to content

Commit cd1b9c1

Browse files
committed
runtime: disable pageAlloc tests on OpenBSD in short mode
This change disables pageAlloc tests on OpenBSD in short mode because pageAlloc holds relatively large virtual memory reservations and we make two during the pageAlloc tests. The runtime may also be carrying one such reservation making the virtual memory requirement for testing the Go runtime three times as much as just running a Go binary. This causes problems for folks who just want to build and test Go (all.bash) on OpenBSD but either don't have machines with at least 4ish GiB of RAM (per-process virtual memory limits are capped at some constant factor times the amount of physical memory) or their per-process virtual memory limits are low for other reasons. Fixes #36210. Change-Id: I8d89cfde448d4cd2fefff4ad6ffed90de63dd527 Reviewed-on: https://go-review.googlesource.com/c/go/+/212177 Run-TryBot: Michael Knyszek <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 075c20c commit cd1b9c1

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/runtime/mgcscavenge_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ func TestPallocDataFindScavengeCandidate(t *testing.T) {
272272

273273
// Tests end-to-end scavenging on a pageAlloc.
274274
func TestPageAllocScavenge(t *testing.T) {
275+
if GOOS == "openbsd" && testing.Short() {
276+
t.Skip("skipping because virtual memory is limited; see #36210")
277+
}
275278
type test struct {
276279
request, expect uintptr
277280
}

src/runtime/mpagealloc_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ func checkPageAlloc(t *testing.T, want, got *PageAlloc) {
4141
}
4242

4343
func TestPageAllocGrow(t *testing.T) {
44+
if GOOS == "openbsd" && testing.Short() {
45+
t.Skip("skipping because virtual memory is limited; see #36210")
46+
}
4447
type test struct {
4548
chunks []ChunkIdx
4649
inUse []AddrRange
@@ -216,6 +219,9 @@ func TestPageAllocGrow(t *testing.T) {
216219
}
217220

218221
func TestPageAllocAlloc(t *testing.T) {
222+
if GOOS == "openbsd" && testing.Short() {
223+
t.Skip("skipping because virtual memory is limited; see #36210")
224+
}
219225
type hit struct {
220226
npages, base, scav uintptr
221227
}
@@ -589,6 +595,9 @@ func TestPageAllocAlloc(t *testing.T) {
589595
}
590596

591597
func TestPageAllocExhaust(t *testing.T) {
598+
if GOOS == "openbsd" && testing.Short() {
599+
t.Skip("skipping because virtual memory is limited; see #36210")
600+
}
592601
for _, npages := range []uintptr{1, 2, 3, 4, 5, 8, 16, 64, 1024, 1025, 2048, 2049} {
593602
npages := npages
594603
t.Run(fmt.Sprintf("%d", npages), func(t *testing.T) {
@@ -638,6 +647,9 @@ func TestPageAllocExhaust(t *testing.T) {
638647
}
639648

640649
func TestPageAllocFree(t *testing.T) {
650+
if GOOS == "openbsd" && testing.Short() {
651+
t.Skip("skipping because virtual memory is limited; see #36210")
652+
}
641653
tests := map[string]struct {
642654
before map[ChunkIdx][]BitRange
643655
after map[ChunkIdx][]BitRange
@@ -867,6 +879,9 @@ func TestPageAllocFree(t *testing.T) {
867879
}
868880

869881
func TestPageAllocAllocAndFree(t *testing.T) {
882+
if GOOS == "openbsd" && testing.Short() {
883+
t.Skip("skipping because virtual memory is limited; see #36210")
884+
}
870885
type hit struct {
871886
alloc bool
872887
npages uintptr

src/runtime/mpagecache_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ func TestPageCacheAlloc(t *testing.T) {
180180
}
181181

182182
func TestPageCacheFlush(t *testing.T) {
183+
if GOOS == "openbsd" && testing.Short() {
184+
t.Skip("skipping because virtual memory is limited; see #36210")
185+
}
183186
bits64ToBitRanges := func(bits uint64, base uint) []BitRange {
184187
var ranges []BitRange
185188
start, size := uint(0), uint(0)
@@ -254,6 +257,9 @@ func TestPageCacheFlush(t *testing.T) {
254257
}
255258

256259
func TestPageAllocAllocToCache(t *testing.T) {
260+
if GOOS == "openbsd" && testing.Short() {
261+
t.Skip("skipping because virtual memory is limited; see #36210")
262+
}
257263
tests := map[string]struct {
258264
before map[ChunkIdx][]BitRange
259265
scav map[ChunkIdx][]BitRange

0 commit comments

Comments
 (0)