aboutsummaryrefslogtreecommitdiff
path: root/test/recover4.go
AgeCommit message (Collapse)Author
2023-10-19test: migrate remaining files to go:build syntaxDmitri Shuralyov
Most of the test cases in the test directory use the new go:build syntax already. Convert the rest. In general, try to place the build constraint line below the test directive comment in more places. For #41184. For #60268. Change-Id: I11c41a0642a8a26dc2eda1406da908645bbc005b Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/536236 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2021-11-12test/recover4.go: use mprotect to create a hole instead of munmapMichael Anthony Knyszek
Currently the recover4 test, which recovers from a panic created from a fault, generates a fault by creating a hole in a mapping. It does this via munmap. However, it's possible the runtime can create a new mapping that ends up in that hole, for example if the GC executes, causing the test to fail. In fact, this is the case now with a smaller minimum heap size. Modify the test to use mprotect, and clean up the code a little while we're here: define everything in terms of the length of original mapping, deduplicate some constants and expressions, and have the test recover properly even if recover() returns nil (right now it panics because it fails to type assert nil as error). Fixes #49381. Change-Id: If399eca564466e5e8aeb2dc6f86a246d0fce7b5d Reviewed-on: https://go-review.googlesource.com/c/go/+/363534 Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2018-01-10all: use Fatalf instead of Fatal if format is givenKunpei Sakai
Change-Id: I30e9b938bb19ed4e674c3ea4a1cd389b9c4f0b88 Reviewed-on: https://go-review.googlesource.com/86875 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02all: make copyright headers consistent with one space after periodEmmanuel Odeke
Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16test: move allocation before munmap in recover4Michael Hudson-Doyle
recover4 allocates 16 pages of memory via mmap, makes a 4 page hole in it with munmap, allocates another 16 pages of memory via normal allocation and then tries to copy from one to the other. For some reason on arm64 (but no other platform I have tested) the second allocation sometimes causes the runtime to ask the kernel for 4 additional pages of memory -- which the kernel satisfies by remapping the pages that were just unmapped! Moving the second allocation before the munmap fixes this behaviour, I can run recover4 tens of thousands of times without failure with this fix vs a failure rate of ~0.5% before. Fixes #12549 Change-Id: I490b895b606897e4f7f25b1b51f5d485a366fffb Reviewed-on: https://go-review.googlesource.com/14632 Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-17test: fix recover4 test on 64kb systemsDave Cheney
Fix recover4.go to work on 64kb systems. Change-Id: I211cb048de1268a8bbac77c6f3a1e0b8c8277594 Reviewed-on: https://go-review.googlesource.com/7673 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-17Revert "test: disable recover4 test to fix ppc64 builds"Dave Cheney
This reverts commit 1313e7982f44c24948e73c4795d9606265d36871. Change-Id: I96cc58baf71156fdfbf8fd61332744bcc3ea52e5 Reviewed-on: https://go-review.googlesource.com/7670 Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-17test: disable recover4 test to fix ppc64 buildsDave Cheney
Updates #10180 Temporarily disable this test on ppc64 systems as all our builders use 64k page size. We need a portable way to get the page size of the host so we can correctly size the mmap hole. Change-Id: Ibd36ebe2f54cf75a44667e2070c385f0daaca481 Reviewed-on: https://go-review.googlesource.com/7652 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-16test: add test that variables captured by deferred funcs are current on faultRuss Cox
This came up in private mail. It works today and I want to make sure it stays working. Change-Id: I13ebdc2dfadb3c72d7f179be89883137320c05d0 Reviewed-on: https://go-review.googlesource.com/7390 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Rob Pike <r@golang.org>