Documentation
¶
Overview ¶
Package gobuildrunner runs a package's tests from a binary it builds itself, once, instead of invoking `go test` for every mutant.
This is the capability ditto did not have. It knew a command string and ran it, so every mutant paid the fixed cost of starting `go test` — measured at 750-950 ms regardless of what the suite does, and 84% of a run. Compiling once only helps when the compiled thing stops changing between mutants, which is what internal/schemata is for; the two are useless apart.
Index ¶
Constants ¶
const Selected = "DITTO_MUTANT"
Selected is the environment variable a gated file reads to know which mutant it is being asked for. Zero, or absent, selects none.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoBuildRunner ¶
type GoBuildRunner struct {
// contains filtered or unexported fields
}
GoBuildRunner builds the tests of one package and then runs that binary.
One package, because `go test -c` compiles one package's tests. That is the shape of the case this is for: a change staged in one package, run while the code is still being written.
func New ¶
func New(packagePath string) *GoBuildRunner
func (*GoBuildRunner) Built ¶
func (r *GoBuildRunner) Built() bool
Built reports whether there is a binary to run. A package that does not compile leaves this false, and the caller falls back rather than being killed by a build it shares with every other mutant.
func (*GoBuildRunner) Compilations ¶
func (r *GoBuildRunner) Compilations() int
Compilations and Runs are exact counters, which is what the performance of this is allowed to be judged on. Wall clock varies by more than half on a working machine; these do not vary at all.
func (*GoBuildRunner) Runs ¶
func (r *GoBuildRunner) Runs() int
func (*GoBuildRunner) Select ¶
func (r *GoBuildRunner) Select(mutant int)
Select is which mutant the next run asks the binary for.
func (*GoBuildRunner) Test ¶
func (r *GoBuildRunner) Test(repository ditto.TemporaryRepository) result.Result[string]
func (*GoBuildRunner) Toolchain ¶
func (r *GoBuildRunner) Toolchain() string
Toolchain is the absolute path of the `go` binary this runner builds with, or empty when none could be found.