Documentation
¶
Overview ¶
Package buildtooltest contains code for testing buildtool.
Index ¶
- Constants
- func CheckManyCommands(cmd []*execabs.Cmd, tee []ExecExpectations) error
- func CheckSingleCommand(cmd *execabs.Cmd, tee ExecExpectations) error
- func CompareArgv(expected, got []string) error
- func CompareEnv(expected, got []string) error
- type DependenciesCallCounter
- func (cc *DependenciesCallCounter) AbsoluteCurDir() string
- func (cc *DependenciesCallCounter) AndroidNDKCheck(androidHome string) string
- func (cc *DependenciesCallCounter) AndroidSDKCheck() string
- func (cc *DependenciesCallCounter) GOOS() string
- func (cc *DependenciesCallCounter) GOPATH() string
- func (cc *DependenciesCallCounter) GolangCheck()
- func (cc *DependenciesCallCounter) LinuxReadGOVERSION(filename string) []byte
- func (cc *DependenciesCallCounter) LinuxWriteDockerfile(filename string, content []byte, mode fs.FileMode)
- func (cc *DependenciesCallCounter) MustChdir(dirname string) func()
- func (cc *DependenciesCallCounter) PsiphonFilesExist() bool
- func (cc *DependenciesCallCounter) PsiphonMaybeCopyConfigFiles()
- func (cc *DependenciesCallCounter) VerifySHA256(expectedSHA256 string, tarball string)
- func (cc *DependenciesCallCounter) WindowsMingwCheck()
- func (*DependenciesCallCounter) XCRun(args ...string) string
- type ExecExpectations
- type SimpleCommandCollector
Constants ¶
const ( TagAbsoluteCurDir = "absoluteCurDir" TagAndroidNDKCheck = "androidNDK" TagAndroidSDKCheck = "androidSDK" TagGOPATH = "GOPATH" TagGolangCheck = "golangCheck" TagLinuxReadGOVERSION = "linuxReadGOVERSION" TagLinuxWriteDockerfile = "linuxWriteDockerfile" TagMustChdir = "mustChdir" TagPsiphonFilesExist = "psiphonFilesExist" TagPsiphonMaybeCopyConfigFiles = "maybeCopyPsiphonFiles" TagVerifySHA256 = "verifySHA256" TagWindowsMingwCheck = "windowsMingwCheck" TagGOOS = "GOOS" )
Constants describing the dependent functions we can call when building.
const CanonicalGolangVersion = "1.14.17"
CanonicalGolangVersion is the canonical Go version used in tests.
const CanonicalNDKVersion = "25.1.7654321"
CanonicalNDKVersion is the canonical NDK version used in tests.
Variables ¶
This section is empty.
Functions ¶
func CheckManyCommands ¶
func CheckManyCommands(cmd []*execabs.Cmd, tee []ExecExpectations) error
CheckManyCommands applies CheckSingleCommand for each command by comparing it with the matching expectation.
func CheckSingleCommand ¶
func CheckSingleCommand(cmd *execabs.Cmd, tee ExecExpectations) error
CheckSingleCommand checks whether the given command contains an argv and environ variables matching the expectations we had.
func CompareArgv ¶
CompareArgv compares the expected argv with the one we've got and returns an explanatory error if they do not match.
func CompareEnv ¶
CompareEnv compares the expected environment with the one we've got and returns an explanatory error if they do not match.
Types ¶
type DependenciesCallCounter ¶
DependenciesCallCounter allows to counter how many times the build dependencies have been called in a run.
func (*DependenciesCallCounter) AbsoluteCurDir ¶
func (cc *DependenciesCallCounter) AbsoluteCurDir() string
AbsoluteCurDir implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) AndroidNDKCheck ¶
func (cc *DependenciesCallCounter) AndroidNDKCheck(androidHome string) string
AndroidNDKCheck implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) AndroidSDKCheck ¶
func (cc *DependenciesCallCounter) AndroidSDKCheck() string
AndroidSDKCheck implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) GOOS ¶ added in v0.25.0
func (cc *DependenciesCallCounter) GOOS() string
GOOS implements buildtool.Dependencies
func (*DependenciesCallCounter) GOPATH ¶
func (cc *DependenciesCallCounter) GOPATH() string
GOPATH implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) GolangCheck ¶
func (cc *DependenciesCallCounter) GolangCheck()
golangCheck implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) LinuxReadGOVERSION ¶
func (cc *DependenciesCallCounter) LinuxReadGOVERSION(filename string) []byte
linuxReadGOVERSION implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) LinuxWriteDockerfile ¶
func (cc *DependenciesCallCounter) LinuxWriteDockerfile( filename string, content []byte, mode fs.FileMode)
linuxWriteDockerfile implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) MustChdir ¶
func (cc *DependenciesCallCounter) MustChdir(dirname string) func()
MustChdir implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) PsiphonFilesExist ¶
func (cc *DependenciesCallCounter) PsiphonFilesExist() bool
psiphonFilesExist implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) PsiphonMaybeCopyConfigFiles ¶
func (cc *DependenciesCallCounter) PsiphonMaybeCopyConfigFiles()
psiphonMaybeCopyConfigFiles implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) VerifySHA256 ¶
func (cc *DependenciesCallCounter) VerifySHA256(expectedSHA256 string, tarball string)
VerifySHA256 implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) WindowsMingwCheck ¶
func (cc *DependenciesCallCounter) WindowsMingwCheck()
windowsMingwCheck implements buildtoolmodel.Dependencies
func (*DependenciesCallCounter) XCRun ¶ added in v0.27.0
func (*DependenciesCallCounter) XCRun(args ...string) string
XCRun implements buildtoolmodel.Dependencies.
type ExecExpectations ¶
type ExecExpectations struct { // Env contains the environment variables we would expect to see. Env []string // Argv contains the Argv we would expect to see. The first // argument is matched as a suffix, to account for various // utable paths (e.g., /bin and /usr/bin). All the other // arguments are matched exactly. Argv []string }
ExecExpectations describes what we would expect to see when building in terms of executed subcommands.
type SimpleCommandCollector ¶
SimpleCommandCollector implements shellx.Dependencies and tracks all the commands that have been run.
func (*SimpleCommandCollector) CmdOutput ¶
func (cc *SimpleCommandCollector) CmdOutput(c *execabs.Cmd) ([]byte, error)
CmdOutput implements shellx.Dependencies