var overcommit … // requireOvercommit skips t if the kernel does not allow overcommit. func requireOvercommit(t *testing.T) { … } var env … // goEnv returns the output of $(go env) as a map. func goEnv(key string) (string, error) { … } // replaceEnv sets the key environment variable to value in cmd. func replaceEnv(cmd *exec.Cmd, key, value string) { … } // appendExperimentEnv appends comma-separated experiments to GOEXPERIMENT. func appendExperimentEnv(cmd *exec.Cmd, experiments []string) { … } // mustRun executes t and fails cmd with a well-formatted message if it fails. func mustRun(t *testing.T, cmd *exec.Cmd) { … } // cc returns a cmd that executes `$(go env CC) $(go env GOGCCFLAGS) $args`. func cc(args ...string) (*exec.Cmd, error) { … } type version … var compiler … // compilerVersion detects the version of $(go env CC). // // It returns a non-nil error if the compiler matches a known version schema but // the version could not be parsed, or if $(go env CC) could not be determined. func compilerVersion() (version, error) { … } // compilerSupportsLocation reports whether the compiler should be // able to provide file/line information in backtraces. func compilerSupportsLocation() bool { … } // inLUCIBuild returns true if we're currently executing in a LUCI build. func inLUCIBuild() bool { … } // compilerRequiredTsanVersion reports whether the compiler is the version required by Tsan. // Only restrictions for ppc64le are known; otherwise return true. func compilerRequiredTsanVersion(goos, goarch string) bool { … } // compilerRequiredAsanVersion reports whether the compiler is the version required by Asan. func compilerRequiredAsanVersion(goos, goarch string) bool { … } type compilerCheck … type config … var configs … // configure returns the configuration for the given sanitizer. func configure(sanitizer string) *config { … } // goCmd returns a Cmd that executes "go $subcommand $args" with appropriate // additional flags and environment. func (c *config) goCmd(subcommand string, args ...string) *exec.Cmd { … } // goCmdWithExperiments returns a Cmd that executes // "GOEXPERIMENT=$experiments go $subcommand $args" with appropriate // additional flags and CGO-related environment variables. func (c *config) goCmdWithExperiments(subcommand string, args []string, experiments []string) *exec.Cmd { … } // skipIfCSanitizerBroken skips t if the C compiler does not produce working // binaries as configured. func (c *config) skipIfCSanitizerBroken(t *testing.T) { … } var cMain … var cLibFuzzerInput … func (c *config) checkCSanitizer() (skip bool, err error) { … } // skipIfRuntimeIncompatible skips t if the Go runtime is suspected not to work // with cgo as configured. func (c *config) skipIfRuntimeIncompatible(t *testing.T) { … } func (c *config) checkRuntime() (skip bool, err error) { … } // srcPath returns the path to the given file relative to this test's source tree. func srcPath(path string) string { … } type tempDir … func (d *tempDir) RemoveAll(t *testing.T) { … } func (d *tempDir) Base() string { … } func (d *tempDir) Join(name string) string { … } func newTempDir(t *testing.T) *tempDir { … } // hangProneCmd returns an exec.Cmd for a command that is likely to hang. // // If one of these tests hangs, the caller is likely to kill the test process // using SIGINT, which will be sent to all of the processes in the test's group. // Unfortunately, TSAN in particular is prone to dropping signals, so the SIGINT // may terminate the test binary but leave the subprocess running. hangProneCmd // configures subprocess to receive SIGKILL instead to ensure that it won't // leak. func hangProneCmd(name string, arg ...string) *exec.Cmd { … }