aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc_test.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2022-11-01 10:00:25 -0400
committerAustin Clements <austin@google.com>2022-11-01 17:06:23 +0000
commite72da1c15dc273b39dcb5dd87c56d5713dbc1b37 (patch)
tree137db1644062074d677721da4d1655d2964a010e /src/runtime/malloc_test.go
parent61ae0a37a8c96e2b1745594e477244100f1a7046 (diff)
downloadgo-e72da1c15dc273b39dcb5dd87c56d5713dbc1b37.tar.xz
runtime: skip TestArenaCollision on failed reservation
If TestArenaCollision cannot reserve the address range it expects to reserve, it currently fails somewhat mysteriously. Detect this case and skip the test. This could lead to test rot if we wind up always skipping this test, but it's not clear that there's a better answer. If the test does fail, we now also log what it thinks it reserved so the failure message is more useful in debugging any issues. Fixes #49415 Fixes #54597 Change-Id: I05cf27258c1c0a7a3ac8d147f36bf8890820d59b Reviewed-on: https://go-review.googlesource.com/c/go/+/446877 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/malloc_test.go')
-rw-r--r--src/runtime/malloc_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/runtime/malloc_test.go b/src/runtime/malloc_test.go
index cc2007604d..a13f382172 100644
--- a/src/runtime/malloc_test.go
+++ b/src/runtime/malloc_test.go
@@ -294,7 +294,11 @@ func TestArenaCollision(t *testing.T) {
for i := 0; i < 5; i++ {
// Reserve memory at the next hint so it can't be used
// for the heap.
- start, end := MapNextArenaHint()
+ start, end, ok := MapNextArenaHint()
+ if !ok {
+ t.Skipf("failed to reserve memory at next arena hint [%#x, %#x)", start, end)
+ }
+ t.Logf("reserved [%#x, %#x)", start, end)
disallowed = append(disallowed, [2]uintptr{start, end})
// Allocate until the runtime tries to use the hint we
// just mapped over.