test

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnableRace = flag.Bool("racetarget", false, "Enables race detector on inferior process")

Fixtures is a map of fixtureKey{ Fixture.Name, buildFlags } to Fixture.

Functions

func AllowRecording

func AllowRecording(t testing.TB)

AllowRecording allows the calling test to be used with a recording of the fixture.

func FindFixturesDir

func FindFixturesDir() string

func MustHaveRecordingAllowed

func MustHaveRecordingAllowed(t testing.TB)

MustHaveRecordingAllowed skips this test if recording is not allowed

Not all the tests can be run with a recording:

  • some fixtures never terminate independently (loopprog, testnextnethttp) and can not be recorded
  • some tests assume they can interact with the target process (for example TestIssue419, or anything changing the value of a variable), which we can't do on with a recording
  • some tests assume that the Pid returned by the process is valid, but it won't be at replay time
  • some tests will start the fixture but not never execute a single instruction, for some reason rr doesn't like this and will print an error if it happens
  • many tests will assume that we can return from a runtime.Breakpoint, with a recording this is not possible because when the fixture ran it wasn't attached to a debugger and in those circumstances a runtime.Breakpoint leads directly to a crash

Some of the tests using runtime.Breakpoint (anything involving variable evaluation and TestWorkDir) have been adapted to work with a recording.

func MustSupportFunctionCalls

func MustSupportFunctionCalls(t *testing.T, testBackend string)

MustSupportFunctionCalls skips this test if function calls are unsupported on this backend/architecture pair.

func RunTestsWithFixtures

func RunTestsWithFixtures(m *testing.M) int

RunTestsWithFixtures will pre-compile test fixtures before running test methods. Test binaries are deleted before exiting.

func SafeRemoveAll

func SafeRemoveAll(dir string)

SafeRemoveAll removes dir and its contents but only as long as dir does not contain directories.

Types

type BuildFlags

type BuildFlags uint32
const (
	LinkStrip BuildFlags = 1 << iota
	EnableCGOOptimization
	EnableInlining
	EnableOptimization
	EnableDWZCompression
)

type Fixture

type Fixture struct {
	// Name is the short name of the fixture.
	Name string
	// Path is the absolute path to the test binary.
	Path string
	// Source is the absolute path of the test binary source.
	Source string
}

Fixture is a test binary.

func BuildFixture

func BuildFixture(name string, flags BuildFlags) Fixture

type FixtureKey

type FixtureKey struct {
	Name  string
	Flags BuildFlags
}

Jump to

Keyboard shortcuts

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