package testenv
Import Path
internal/testenv (on golang.org and go.dev)
Dependency Relation
imports 11 packages, and imported by 0 packages
Involved Source Files
Package testenv provides information about what functionality
is available in different testing environments run by the Go team.
It is an internal package because these details are specific
to the Go team's test setup (on build.golang.org) and not
fundamental to tests in general.
testenv_notwin.go
Package-Level Functions (total 26)
Builder reports the name of the builder running this test
(for example, "linux-amd64" or "windows-386-gce").
If the test is not running on the build infrastructure,
Builder returns the empty string.
CanInternalLink reports whether the current system can link programs with
internal linking.
(This is the opposite of cmd/internal/sys.MustLinkExternal. Keep them in sync.)
CleanCmdEnv will fill cmd.Env with the environment, excluding certain
variables that could modify the behavior of the Go tools such as
GODEBUG and GOTRACEBACK.
CPUIsSlow reports whether the CPU running the test is suspected to be slow.
GoTool reports the path to the Go tool.
GoToolPath reports the path to the Go tool.
It is a convenience wrapper around GoTool.
If the tool is unavailable GoToolPath calls t.Skip.
If the tool should be available and isn't, GoToolPath calls t.Fatal.
HasCGO reports whether the current system can use cgo.
HasExec reports whether the current system can start new processes
using os.StartProcess or (more commonly) exec.Command.
HasExternalNetwork reports whether the current system can use
external (non-localhost) networks.
HasGoBuild reports whether the current system can build programs with ``go build''
and then run them with os.StartProcess or exec.Command.
HasGoRun reports whether the current system can run programs with ``go run.''
HasLink reports whether the current system can use os.Link.
HasSrc reports whether the entire source tree is available under GOROOT.
HasSymlink reports whether the current system can use os.Symlink.
MustHaveCGO calls t.Skip if cgo is not available.
MustHaveExec checks that the current system can start new processes
using os.StartProcess or (more commonly) exec.Command.
If not, MustHaveExec calls t.Skip with an explanation.
MustHaveExecPath checks that the current system can start the named executable
using os.StartProcess or (more commonly) exec.Command.
If not, MustHaveExecPath calls t.Skip with an explanation.
MustHaveExternalNetwork checks that the current system can use
external (non-localhost) networks.
If not, MustHaveExternalNetwork calls t.Skip with an explanation.
MustHaveGoBuild checks that the current system can build programs with ``go build''
and then run them with os.StartProcess or exec.Command.
If not, MustHaveGoBuild calls t.Skip with an explanation.
MustHaveGoRun checks that the current system can run programs with ``go run.''
If not, MustHaveGoRun calls t.Skip with an explanation.
MustHaveLink reports whether the current system can use os.Link.
If not, MustHaveLink calls t.Skip with an explanation.
MustHaveSymlink reports whether the current system can use os.Symlink.
If not, MustHaveSymlink calls t.Skip with an explanation.
MustInternalLink checks that the current system can link programs with internal
linking.
If not, MustInternalLink calls t.Skip with an explanation.
func SkipFlakyNet(t testing.TB)
SkipIfShortAndSlow skips t if -short is set and the CPU running the test is
suspected to be slow.
(This is useful for CPU-intensive tests that otherwise complete quickly.)
![]() |
The pages are generated with Golds v0.2.5. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |