]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use at least "system" traceback level for runtime tests
authorAustin Clements <austin@google.com>
Thu, 14 Jan 2016 21:43:40 +0000 (16:43 -0500)
committerAustin Clements <austin@google.com>
Fri, 15 Jan 2016 02:22:46 +0000 (02:22 +0000)
While the default behavior of eliding runtime frames from tracebacks
usually makes sense, this is not the case when you're trying to test
the runtime itself. Fix this by forcing the traceback level to at
least "system" in the runtime tests.

This will specifically help with debugging issue #13645, which has
proven remarkably resistant to reproduction outside of the build
dashboard itself.

Change-Id: I2a8356ba6c3c5badba8bb3330fc527357ec0d296
Reviewed-on: https://go-review.googlesource.com/18648
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
src/runtime/export_test.go
src/runtime/runtime_test.go

index 6a4eae607a499102241b34b9dfac98bc4e46f3be..5400c1d14eaae2d0fe30396357a616aa36572bff 100644 (file)
@@ -163,3 +163,11 @@ var TestingAssertE2I2GC = &testingAssertE2I2GC
 var TestingAssertE2T2GC = &testingAssertE2T2GC
 
 var ForceGCPeriod = &forcegcperiod
+
+// SetTracebackEnv is like runtime/debug.SetTraceback, but it raises
+// the "environment" traceback level, so later calls to
+// debug.SetTraceback (e.g., from testing timeouts) can't lower it.
+func SetTracebackEnv(level string) {
+       setTraceback(level)
+       traceback_env = traceback_cache
+}
index 75fc9bcb844150c47695fa263e094250f0d38a99..664c1180c427a831740e6efab266e05e662a3ee8 100644 (file)
@@ -12,6 +12,13 @@ import (
        "unsafe"
 )
 
+func init() {
+       // We're testing the runtime, so make tracebacks show things
+       // in the runtime. This only raises the level, so it won't
+       // override GOTRACEBACK=crash from the user.
+       SetTracebackEnv("system")
+}
+
 var errf error
 
 func errfn() error {