buildtooltest

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package buildtooltest contains code for testing buildtool.

Index

Constants

View Source
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.

View Source
const CanonicalGolangVersion = "1.14.17"

CanonicalGolangVersion is the canonical Go version used in tests.

View Source
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

func CompareArgv(expected, got []string) error

CompareArgv compares the expected argv with the one we've got and returns an explanatory error if they do not match.

func CompareEnv

func CompareEnv(expected, got []string) error

CompareEnv compares the expected environment with the one we've got and returns an explanatory error if they do not match.

Types

type DependenciesCallCounter

type DependenciesCallCounter struct {
	Counter    map[string]int
	HasPsiphon bool
	OS         string
}

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

type SimpleCommandCollector struct {
	Commands []*execabs.Cmd
}

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

func (*SimpleCommandCollector) CmdRun

func (cc *SimpleCommandCollector) CmdRun(c *execabs.Cmd) error

CmdRun implements shellx.Dependencies

func (*SimpleCommandCollector) LookPath

func (cc *SimpleCommandCollector) LookPath(file string) (string, error)

LookPath implements shellx.Dependencies

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL