MCPcopy Create free account
hub / github.com/temporalio/temporal / testOnlyStacktrace

Function testOnlyStacktrace

tools/testrunner/log.go:50–74  ·  view source on GitHub ↗

testOnlyStacktrace removes all but the test stacktraces from the full stacktrace.

(stacktrace string)

Source from the content-addressed store, hash-verified

48
49// testOnlyStacktrace removes all but the test stacktraces from the full stacktrace.
50func testOnlyStacktrace(stacktrace string) string {
51 var res string
52 snap, _, err := stack.ScanSnapshot(strings.NewReader(stacktrace), io.Discard, stack.DefaultOpts())
53 if err != nil && err != io.EOF {
54 return fmt.Sprintf("failed to parse stacktrace: %v", err)
55 }
56 if snap == nil {
57 return "failed to find a stacktrace"
58 }
59 res = "abridged stacktrace:\n"
60 for _, goroutine := range snap.Goroutines {
61 shouldPrint := slices.ContainsFunc(goroutine.Stack.Calls, func(call stack.Call) bool {
62 return strings.HasSuffix(call.RemoteSrcPath, "_test.go")
63 })
64 if shouldPrint {
65 res += fmt.Sprintf("\tgoroutine %d [%v]:\n", goroutine.ID, goroutine.State)
66 for _, call := range goroutine.Stack.Calls {
67 file := call.RemoteSrcPath
68 res += fmt.Sprintf("\t\t%s:%d\n", file, call.Line)
69 }
70 res += "\n"
71 }
72 }
73 return res
74}
75
76// alert captures a prominent issue detected from stdout/stderr of test runs.
77type alert struct {

Callers 1

parseTestTimeoutsFunction · 0.85

Calls 1

NewReaderMethod · 0.65

Tested by

no test coverage detected