shared

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLinesToFileAtBreakPoint

func AddLinesToFileAtBreakPoint(t *testing.T, filePath string, linesToAdd []string, breakPoint string, addAfterBreakpoint bool)

AddLinesToFileAtBreakPoint adds the given lines before or after the breakpoint to the file at the given path.

func AppendLines

func AppendLines(t *testing.T, filePath string, linesToAdd []string)

func CopyTestdataDir

func CopyTestdataDir(t *testing.T, name string) string

CopyTestdataDir copies the "testdata" folder in the current working directory to a temporary directory called "cifuzz-<name>-testdata" and returns the path.

func CopyTestdataDirForE2E added in v0.23.0

func CopyTestdataDirForE2E(t *testing.T, name string) string

Used for e2e tests CopyTestdataDirForE2E copies a named folder from the samples directory to a temporary directory called "cifuzz-<name>-testdata" and returns the path.

func FilterForInstructions added in v0.20.0

func FilterForInstructions(lines []string) []string

func GetFindings

func GetFindings(t *testing.T, cifuzz string, dir string) []*finding.Finding

func InstallCIFuzzInTemp

func InstallCIFuzzInTemp(t *testing.T) string

InstallCIFuzzInTemp creates an installation builder and extracts it into a temporary directory. The caller should clean up the returned directory.

func ModifyFuzzTestToCallFunction

func ModifyFuzzTestToCallFunction(t *testing.T, fuzzTestPath string)

func TerminateOnSignal added in v0.11.0

func TerminateOnSignal(t *testing.T, cmd *executil.Cmd)

func TestAdditionalJazzerParameters added in v0.27.0

func TestAdditionalJazzerParameters(t *testing.T, cifuzz, dir string)

func TestBundleGradle added in v0.12.0

func TestBundleGradle(t *testing.T, lang string, dir string, cifuzz string, args ...string)

func TestBundleLibFuzzer added in v0.12.0

func TestBundleLibFuzzer(t *testing.T, dir string, cifuzz string, cifuzzEnv []string, args ...string)

func TestBundleMaven added in v0.12.0

func TestBundleMaven(t *testing.T, dir string, cifuzz string, args ...string)

func TestRemoteRun

func TestRemoteRun(t *testing.T, dir string, cifuzz string, args ...string)

func TestRemoteRunWithAdditionalArgs added in v0.22.0

func TestRemoteRunWithAdditionalArgs(t *testing.T, dir string, cifuzz string, expectedErrorExp *regexp.Regexp, args ...string)

func TestRunBundle added in v0.12.0

func TestRunBundle(t *testing.T, dir string, cifuzz string, bundlePath string, cifuzzEnv []string, args ...string) (*archive.Metadata, string)

func TestRunNotAuthenticated added in v0.25.0

func TestRunNotAuthenticated(t *testing.T, dir string, cifuzz string, args ...string)

func TestRunWithUpload added in v0.17.0

func TestRunWithUpload(t *testing.T, dir string, cifuzz string, args ...string)

Types

type CIFuzzRunner

type CIFuzzRunner struct {
	CIFuzzPath      string
	DefaultWorkDir  string
	DefaultFuzzTest string
}

func (*CIFuzzRunner) Command

func (r *CIFuzzRunner) Command(t *testing.T, command string, opts *CommandOptions) []string

Command runs "cifuzz <command> <args>" and returns stderr output as lines.

func (*CIFuzzRunner) CommandOutput added in v0.26.0

func (r *CIFuzzRunner) CommandOutput(t *testing.T, command string, opts *CommandOptions) (string, string)

CommandOutput runs "cifuzz <command> <args>" and returns stderr and output.

func (*CIFuzzRunner) CommandWithFilterForInstructions added in v0.20.0

func (r *CIFuzzRunner) CommandWithFilterForInstructions(t *testing.T, command string, opts *CommandOptions) []string

CommandWithFilterForInstructions runs "cifuzz <command> <args>" and returns any indented lines which the command prints to stderr (which we expect to be lines which should be added to some source or config file).

func (*CIFuzzRunner) Run

func (r *CIFuzzRunner) Run(t *testing.T, opts *RunOptions)

type CommandOptions

type CommandOptions struct {
	WorkDir string
	Env     []string
	Args    []string
}

type RunOptions

type RunOptions struct {
	FuzzTest string
	WorkDir  string
	Env      []string
	Args     []string

	ExpectedOutputs              []*regexp.Regexp
	UnexpectedOutput             *regexp.Regexp
	TerminateAfterExpectedOutput bool
	ExpectError                  bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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