gotestyourself / gotestyourself/gotestsum

panic when converting "go test -bench" output

Open
#413 10 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
2.7k
Forks
171
PR merge metrics
No merged PRs in 30d

Description

In Kubernetes, we run `go test -json` and then invoke gotestsum to convert to JUnit.

In one particular job which only runs benchmarks, gotestsum panics. This can be reproduce with this stripped down result file (all output excluded):
```console
$ cat >/tmp/junit.stdout < 357: case pkg.cached:
358: buf.WriteString(" (cached)")
359: case event.Elapsed != 0:
360: d := elapsedDuration(event.Elapsed)
361: buf.WriteString(fmt.Sprintf(" (%s)", d))
362: }
(dlv) bt
0 0x0000000000440d24 in runtime.fatalpanic
at /nvme/gopath/go-1.22.3/src/runtime/panic.go:1217
1 0x000000000043fd1d in runtime.gopanic
at /nvme/gopath/go-1.22.3/src/runtime/panic.go:779
2 0x000000000043efbe in runtime.panicmem
at /nvme/gopath/go-1.22.3/src/runtime/panic.go:261
3 0x0000000000458da5 in runtime.sigpanic
at /nvme/gopath/go-1.22.3/src/runtime/signal_unix.go:881
4 0x0000000000655180 in gotest.tools/gotestsum/testjson.packageLine
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/format.go:357
5 0x0000000000655078 in gotest.tools/gotestsum/testjson.shortFormatPackageEvent.func1
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/format.go:330
6 0x0000000000654c9a in gotest.tools/gotestsum/testjson.shortFormatPackageEvent
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/format.go:347
7 0x000000000065373e in gotest.tools/gotestsum/testjson.pkgNameFormat.func1
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/format.go:240
8 0x0000000000655c95 in gotest.tools/gotestsum/testjson.eventFormatterFunc.Format
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/format.go:413
9 0x000000000066a295 in gotest.tools/gotestsum/cmd.(*eventHandler).Event
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/cmd/handler.go:48
10 0x000000000064edf5 in gotest.tools/gotestsum/testjson.ScanTestOutput
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/testjson/execution.go:730
11 0x000000000066ed65 in gotest.tools/gotestsum/cmd.run
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/cmd/main.go:284
12 0x000000000066ccf4 in gotest.tools/gotestsum/cmd.Run
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/cmd/main.go:42
13 0x00000000007deddc in main.route
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/main.go:37
14 0x00000000007de8cc in main.main
at /nvme/gopath/pkg/mod/gotest.tools/gotestsum@v1.12.0/main.go:14
15 0x0000000000443092 in runtime.main
at /nvme/gopath/go-1.22.3/src/runtime/proc.go:271
16 0x00000000004765e1 in runtime.goexit
at /nvme/gopath/go-1.22.3/src/runtime/asm_amd64.s:1695
(dlv) p event
gotest.tools/gotestsum/testjson.TestEvent {
Time: time.Time(0001-01-01T00:00:00Z){
wall: 0,
ext: 0,
loc: *time.Location nil,},
Action: "fail",
Package: "",
Test: "",
Elapsed: -1,
Output: "",
raw: []uint8 len: 0, cap: 0, nil,
RunID: 0,}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.