log.go ×7

Frontier kind: Joint frontier

unlabeled · c_e477c5cd44b8

1 test · 41 LOC · 1 file · introduces 1 test · 41 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges41 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
7 ranges41 lines · 1 file · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 41 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/tools/testrunner/log.go 41 introduced LOC · 7 ranges

Open complete file

18
19 // parseTestTimeouts parses the stdout of a test run and returns the stacktrace and names of tests that timed out.
20 > func parseTestTimeouts(stdout string) (stacktrace string, timedoutTests []string) { log.go
21 > lines := strings.Split(strings.ReplaceAll(stdout, "\r\n", "\n"), "\n")
22 > for i := 0; i < len(lines); i++ {
23 > line := lines[i]
24 > if strings.HasPrefix(line, "FAIL") {
25 > // ignore
26 > } else if strings.HasPrefix(line, "panic: test timed out after") {
27 > // parse names of tests that timed out
28 > for {
29 > i++
30 > line = strings.TrimSpace(lines[i])
31 > if strings.HasPrefix(line, "Test") {
32 > timedoutTests = append(timedoutTests, strings.Split(line, " ")[0])
33 > }
34 > if line == "" {
35 > break
36 }
37 }
38 > } else if len(timedoutTests) > 0 { log.go
39 > // collect stracktrace
40 > stacktrace += line + "\n"
41 > }
42 }
43
44 > stacktrace = fmt.Sprintf("%d timed out test(s):\n\t%v\n\n%v", log.go
45 > len(timedoutTests), strings.Join(timedoutTests, "\n\t"), testOnlyStacktrace(stacktrace))
46 > return
47 }
48
49 // testOnlyStacktrace removes all but the test stacktraces from the full stacktrace.
50 > func testOnlyStacktrace(stacktrace string) string { log.go
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 { log.go
57 return "failed to find a stacktrace"
58 }
59 > res = "abridged stacktrace:\n" log.go
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 log.go
74 }
75