Documentation ¶
Overview ¶
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
Index ¶
- func Deadline(t Testing) (time.Time, bool)
- func ExitIfSmallMachine()
- func Go1Point() int
- func NeedsGo1Point(t Testing, x int)
- func NeedsGoBuild(t Testing)
- func NeedsGoPackages(t Testing)
- func NeedsGoPackagesEnv(t Testing, env []string)
- func NeedsTool(t Testing, tool string)
- func SkipAfterGo1Point(t Testing, x int)
- func WriteImportcfg(t testing.TB, dstPath string, additionalPackageFiles map[string]string)
- type Testing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deadline ¶ added in v0.1.9
Deadline returns the deadline of t, if known, using the Deadline method added in Go 1.15.
func ExitIfSmallMachine ¶
func ExitIfSmallMachine()
ExitIfSmallMachine emits a helpful diagnostic and calls os.Exit(0) if the current machine is a builder known to have scarce resources.
It should be called from within a TestMain function.
func NeedsGo1Point ¶
NeedsGo1Point skips t if the Go version used to run the test is older than 1.x.
func NeedsGoBuild ¶
func NeedsGoBuild(t Testing)
NeedsGoBuild skips t if the current system can't build programs with “go build” and then run them with os.StartProcess or exec.Command. Android doesn't have the userspace go build needs to run, and js/wasm doesn't support running subprocesses.
func NeedsGoPackages ¶
func NeedsGoPackages(t Testing)
NeedsGoPackages skips t if the go/packages driver (or 'go' tool) implied by the current process environment is not present in the path.
func NeedsGoPackagesEnv ¶
NeedsGoPackagesEnv skips t if the go/packages driver (or 'go' tool) implied by env is not present in the path.
func NeedsTool ¶
NeedsTool skips t if the named tool is not present in the path. As a special case, "cgo" means "go" is present and can compile cgo programs.
func SkipAfterGo1Point ¶
SkipAfterGo1Point skips t if the Go version used to run the test is newer than 1.x.
func WriteImportcfg ¶ added in v0.3.0
WriteImportcfg writes an importcfg file used by the compiler or linker to dstPath containing entries for the packages in std and cmd in addition to the package to package file mappings in additionalPackageFiles.