github.com/go-darwin/sys@v0.0.0-20220510002607-68fd01f054ca/runtime_test.go (about)

     1  // Copyright 2012 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package sys_test
     6  
     7  import (
     8  	"flag"
     9  	"runtime/debug"
    10  
    11  	"github.com/go-darwin/sys"
    12  )
    13  
    14  var flagQuick = flag.Bool("quick", false, "skip slow tests, for second run in all.bash")
    15  
    16  func init() {
    17  	// We're testing the runtime, so make tracebacks show things
    18  	// in the runtime. This only raises the level, so it won't
    19  	// override GOTRACEBACK=crash from the user.
    20  	SetTracebackEnv("system")
    21  }
    22  
    23  var traceback_cache uint32 = 2 << sys.TracebackShift
    24  var traceback_env uint32
    25  
    26  // SetTracebackEnv is like runtime/debug.SetTraceback, but it raises
    27  // the "environment" traceback level, so later calls to
    28  // debug.SetTraceback (e.g., from testing timeouts) can't lower it.
    29  func SetTracebackEnv(level string) {
    30  	debug.SetTraceback(level)
    31  	traceback_env = traceback_cache
    32  }