Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is a collection of coverage profiles obtained from calling an external program.
We use this in conjunction with the Report function to get coverage data from a copy of tmux-fastcopy spawned by tmux.
Roughly, the ingtegration test uses the usual TestMain hijacking method to allow control of the binary spawned by tmux. When running in coverage mode,
- the test sets up a bucket to place coverage data in, and communicates the path to this bucket to the spawned binary with an environment variable
- the spanwed binary, if this environment variable is set, generates a coverage report into this directory using coverage.Report
- afterwards, the test uses Bucket.Finalize to merge coverage data from the spawned binary back into the current process
This is inspired by go-internal/testscript1, but instead of replaying the full test machinery, we just invoke or modify a couple private functions/variables in the testing packge to make this work.
func NewBucket ¶
NewBucket builds a new coverage bucket with the given coverage mode. Returns a no-op bucket if we're not running with coverage.
This should only be called from inside a test, or *after* flag.Parse in TestMain.