aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/ehooks_test.go
AgeCommit message (Collapse)Author
2025-07-11runtime: gofmt after CL 643897 and CL 662455Tobias Klauser
Change-Id: I3103325ebe29509c00b129a317b5708aece575a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/687715 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2025-05-19runtime: pass through -asan/-msan/-race to testprog testsMichael Pratt
The tests using testprog / testprogcgo are currently not covered on the asan/msan/race builders because they don't build testprog with the sanitizer flag. Explicitly pass the flag if the test itself is built with the sanitizer. There were a few tests that explicitly passed -race (even on non-race builders). These tests will now only run on race builders. For #71395. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15,gotip-linux-amd64-race Change-Id: I6a6a636ce8271246316a80d426c0e4e2f6ab99c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/643897 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2024-05-24internal/runtime/exithook: make safe for concurrent os.ExitRuss Cox
Real programs can call os.Exit concurrently from multiple goroutines. Make internal/runtime/exithook not crash in that case. The throw on panic also now runs in the deferred context, so that we will see the full stack trace that led to the panic. That should give us more visibility into the flaky failures on bugs #55167 and #56197 as well. Fixes #67631. Change-Id: Iefdf71b3a3b52a793ca88d89a9c270eb50ece094 Reviewed-on: https://go-review.googlesource.com/c/go/+/588235 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-23runtime: update TestExitHooks error stringsCherry Mui
The error strings were changed in CL 586259 and no longer include "internal error". Update the strings in the test. Should fix the longtest builders. Change-Id: If227d4b79a8bf5e52a32c3b2eceb086241f079aa Reviewed-on: https://go-review.googlesource.com/c/go/+/587757 Auto-Submit: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-10-04runtime: change exit hooks test to use RaceDetectorSupportedThan McIntosh
Use internal/syssup.RaceDetectorSupported in the exit hooks tests as a better way to tell if the race detector is available. Change-Id: I8f43f93319f68b9910f2eea88fc375f7ef3bb2e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/438476 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27runtime: add cgo guard for exit hooks testThan McIntosh
Add an additional guard to ensure that we don't try to run the "-race" variant of the exit hooks test when CGO is explicitly turned off via CGO_ENABLED=0 (this fixes a failure on the no-cgo builder caused by CL 354790). Change-Id: I9dc7fbd71962e9a098916da69d9119a753f27116 Reviewed-on: https://go-review.googlesource.com/c/go/+/434935 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26runtime: add an exit hook facilityThan McIntosh
Add a new API (not public/exported) for registering a function with the runtime that should be called when program execution terminates, to be used in the new code coverage re-implementation. The API looks like func addExitHook(f func(), runOnNonZeroExit bool) The first argument is the function to be run, second argument controls whether the function is invoked even if there is a call to os.Exit with a non-zero status. Exit hooks are run in reverse order of registration, e.g. the first hook to be registered will be the last to run. Exit hook functions are not allowed to panic or to make calls to os.Exit. Updates #51430. Change-Id: I906f8c5184b7c1666f05a62cfc7833bf1a4300c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/354790 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>