aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/crash_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-09-01 12:52:48 -0700
committerGopher Robot <gobot@golang.org>2023-09-05 22:43:54 +0000
commitcffdfe8d2cabbe874bceaeed1eba92cc567be6db (patch)
treed4b602cb3c84c6a49f5fe898d1ee9e79b272717b /src/runtime/crash_test.go
parenta8191789153dcc76abb6a4d3cd4e56e2d68c2430 (diff)
downloadgo-cffdfe8d2cabbe874bceaeed1eba92cc567be6db.tar.xz
runtime: don't let the tests leave core files behind
Also add a check that we didn't leave any core files behind. Change-Id: I30444ef43ad1a8cc1cacd3b75280f2128e104939 Reviewed-on: https://go-review.googlesource.com/c/go/+/525175 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/crash_test.go')
-rw-r--r--src/runtime/crash_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index 5eccf86e1a..df75658750 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -24,10 +24,21 @@ import (
var toRemove []string
func TestMain(m *testing.M) {
+ _, coreErrBefore := os.Stat("core")
+
status := m.Run()
for _, file := range toRemove {
os.RemoveAll(file)
}
+
+ _, coreErrAfter := os.Stat("core")
+ if coreErrBefore != nil && coreErrAfter == nil {
+ fmt.Fprintln(os.Stderr, "runtime.test: some test left a core file behind")
+ if status == 0 {
+ status = 1
+ }
+ }
+
os.Exit(status)
}