gotestsum
gotestsum copied to clipboard
Support running tests using RR
It would be amazing if gotestsum supported running tests using rr. I've hacked something together to use with --raw-command
but it's ugly. I am imagining something like gotestsum --engine rr
(with the default being --engine go
).
- Update gotestsum to process packages separately
- Detect if the caller passed a specific package, or something ending in
/...
- In the latter case, turn that into a list of packages
- I used
go list -f '{{if .TestGoFiles}}{{.ImportPath}}{{end}}' $1
to list only the packages containing test files
- Detect if the caller passed a specific package, or something ending in
- Run the test with rr
- Add
-exec 'rr record -o $TRACE'
to thego test
invocation - This will tell go to execute the test binary using rr
- The trace location should be derived from the package path
- Overriding the output location makes it far easier to determine which trace belongs to which package
- Otherwise the trace for
pkg/foo/bar
will be written to~/.local/share/rr/bar.test-0
- Add