c3a0854e31
This introduces an abstraction for constructing and running "go test" commands. Currently, dist test is basically a shell script written in Go syntax: it mostly just invokes lots of subprocesses, almost all of which are "go test" invocations, and it constructs those command lines directly from strings all over the place. This CL raises the level of abstraction of invoking go test. The current level of abstraction is not serving us very well: it's conveniently terse, but the actual logic for constructing a command line is typically so spread out that it's difficult to predict what command will actually run. For example, the `gotest` function constructs the basic command, but many tests want to override at least some of these flags, so flattenCmdLine has logic specific to `go test` for eliminating duplicate flags that `go test` itself would reject. At the same time, the logic for constructing many common flags is conditional, leading to a bevy of helpers for constructing flags like `-short` and `-timeout` and `-run` that are scattered throughout test.go and very easy to forget to call. This CL centralizes and flattens all of this knowledge into a new `goTest` type. This type gives dist a single, unified point where we can change anything about how it invokes "go test". There's currently some "unnecessary" abstraction in the implementation of the goTest type to separate "build" and "run" flags. This will become important later when we convert host tests and to do separate build and run steps. The following CLs will convert dist test to use this type rather than directly constructing "go test" command lines. Finally, we'll strip out the scattered helper logic for building command lines. For #37486. Change-Id: I9f1633fe6c0921696419ce8127ed2ca7b7a4e01b Reviewed-on: https://go-review.googlesource.com/c/go/+/448802 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.