Skip to content

Commit

Permalink
runtime: disable pageAlloc tests on OpenBSD in short mode
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mknyszek committed Dec 26, 2019
1 parent 075c20c commit cd1b9c1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/mgcscavenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ func TestPallocDataFindScavengeCandidate(t *testing.T) {

// Tests end-to-end scavenging on a pageAlloc.
func TestPageAllocScavenge(t *testing.T) {
if GOOS == "openbsd" && testing.Short() {
t.Skip("skipping because virtual memory is limited; see #36210")
}
type test struct {
request, expect uintptr
}
Expand Down
15 changes: 15 additions & 0 deletions src/runtime/mpagealloc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func checkPageAlloc(t *testing.T, want, got *PageAlloc) {
}

func TestPageAllocGrow(t *testing.T) {
if GOOS == "openbsd" && testing.Short() {
t.Skip("skipping because virtual memory is limited; see #36210")
}
type test struct {
chunks []ChunkIdx
inUse []AddrRange
Expand Down Expand Up @@ -216,6 +219,9 @@ func TestPageAllocGrow(t *testing.T) {
}

func TestPageAllocAlloc(t *testing.T) {
if GOOS == "openbsd" && testing.Short() {
t.Skip("skipping because virtual memory is limited; see #36210")
}
type hit struct {
npages, base, scav uintptr
}
Expand Down Expand Up @@ -589,6 +595,9 @@ func TestPageAllocAlloc(t *testing.T) {
}

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

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

func TestPageAllocAllocAndFree(t *testing.T) {
if GOOS == "openbsd" && testing.Short() {
t.Skip("skipping because virtual memory is limited; see #36210")
}
type hit struct {
alloc bool
npages uintptr
Expand Down
6 changes: 6 additions & 0 deletions src/runtime/mpagecache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ func TestPageCacheAlloc(t *testing.T) {
}

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

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

0 comments on commit cd1b9c1

Please sign in to comment.