cmdutils

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BundleFlags = []string{
	"branch",
	"build-command",
	"build-jobs",
	"commit",
	"dict",
	"docker-image",
	"engine-arg",
	"env",
	"seed-corpus",
	"timeout",
}
View Source
var ErrSilent = WrapSilentError(stdErrors.New("SilentError"))

Functions

func AddAdditionalFilesFlag added in v0.23.0

func AddAdditionalFilesFlag(cmd *cobra.Command) func()

func AddBranchFlag added in v0.5.0

func AddBranchFlag(cmd *cobra.Command) func()

func AddBuildCommandFlag added in v0.5.0

func AddBuildCommandFlag(cmd *cobra.Command) func()

func AddBuildJobsFlag added in v0.5.0

func AddBuildJobsFlag(cmd *cobra.Command) func()

func AddBuildOnlyFlag added in v0.12.0

func AddBuildOnlyFlag(cmd *cobra.Command) func()

func AddCleanCommandFlag added in v0.20.0

func AddCleanCommandFlag(cmd *cobra.Command) func()

func AddCommitFlag added in v0.5.0

func AddCommitFlag(cmd *cobra.Command) func()

func AddDictFlag added in v0.5.0

func AddDictFlag(cmd *cobra.Command) func()

func AddDockerImageFlag added in v0.5.0

func AddDockerImageFlag(cmd *cobra.Command) func()

func AddEngineArgFlag added in v0.5.0

func AddEngineArgFlag(cmd *cobra.Command) func()

func AddEnvFlag added in v0.5.0

func AddEnvFlag(cmd *cobra.Command) func()

func AddFlags added in v0.5.0

func AddFlags(cmd *cobra.Command, funcs ...func(cmd *cobra.Command) func()) (bindFlags func())

AddFlags executes the specified Add*Flag functions and returns a function which binds all those flags to viper

func AddInteractiveFlag added in v0.6.0

func AddInteractiveFlag(cmd *cobra.Command) func()

func AddPresetFlag added in v0.12.0

func AddPresetFlag(cmd *cobra.Command) func()

func AddPrintJSONFlag added in v0.5.0

func AddPrintJSONFlag(cmd *cobra.Command) func()

func AddProjectDirFlag added in v0.5.0

func AddProjectDirFlag(cmd *cobra.Command) func()

func AddProjectFlag added in v0.13.0

func AddProjectFlag(cmd *cobra.Command) func()

func AddResolveSourceFileFlag added in v0.15.0

func AddResolveSourceFileFlag(cmd *cobra.Command) func()

func AddSeedCorpusFlag added in v0.5.0

func AddSeedCorpusFlag(cmd *cobra.Command) func()

func AddServerFlag added in v0.13.0

func AddServerFlag(cmd *cobra.Command) func()

func AddTimeoutFlag added in v0.5.0

func AddTimeoutFlag(cmd *cobra.Command) func()

func AddUseSandboxFlag added in v0.5.0

func AddUseSandboxFlag(cmd *cobra.Command) func()

func BuildOutputToFile added in v0.18.0

func BuildOutputToFile(projectDir string, fuzzTestNames []string) (io.Writer, error)

func Chdir

func Chdir() error

func ConstructJVMFuzzTestIdentifier added in v0.19.0

func ConstructJVMFuzzTestIdentifier(path, testDir string) (string, error)

ConstructJVMFuzzTestIdentifier constructs a fully qualified class name for a given fuzz test file from the directory the file is in and the file name.

func DisableConfigCheck

func DisableConfigCheck(cmd *cobra.Command)

func EvaluateBazelTargetPatterns added in v0.5.0

func EvaluateBazelTargetPatterns(patterns []string) ([]string, error)

func ExecuteCommand

func ExecuteCommand(t *testing.T, cmd *cobra.Command, in io.Reader, args ...string) (string, error)

func GetMsgPathToBuildLog added in v0.18.0

func GetMsgPathToBuildLog() string

func GetTargetMethodsFromJVMFuzzTestFile added in v0.22.0

func GetTargetMethodsFromJVMFuzzTestFile(path string) ([]string, error)

GetTargetMethodsFromJVMFuzzTestFile returns a list of target methods from a given fuzz test file.

func JazzerGeneratedCorpus added in v0.15.0

func JazzerGeneratedCorpus(targetClass string, projectDir string) string

func JazzerSeedCorpus added in v0.15.0

func JazzerSeedCorpus(targetClass string, projectDir string) string

func ListJVMFuzzTests added in v0.19.0

func ListJVMFuzzTests(projectDir string) ([]string, error)

ListJVMFuzzTests returns a list of all fuzz tests in the project. The returned list contains the fully qualified class name of the fuzz test.

func ListJVMFuzzTestsWithFilter added in v0.19.0

func ListJVMFuzzTestsWithFilter(projectDir string, prefixFilter string) ([]string, error)

ListJVMFuzzTestsWithFilter returns a list of all fuzz tests in the project. The returned list contains the fully qualified class name of the fuzz test. to filter files based on the fqcn you can use the prefix filter parameter

func MarkFlagsRequired

func MarkFlagsRequired(cmd *cobra.Command, flags ...string)

func NeedsConfig

func NeedsConfig(cmd *cobra.Command) bool

func PrintBuildLogOnStdout added in v0.18.0

func PrintBuildLogOnStdout() error

PrintBuildLogOnStdout reads the build log file and prints it on stdout.

func ShouldLogBuildToFile added in v0.18.0

func ShouldLogBuildToFile() bool

func ValidateSeedCorpusDirs

func ValidateSeedCorpusDirs(seedCorpusDirs []string) ([]string, error)

ValidateSeedCorpusDirs checks if the seed dirs exist and can be accessed and ensures that the paths are absolute

func ViperMustBindPFlag

func ViperMustBindPFlag(key string, flag *pflag.Flag)

func WrapCouldBeSandboxError

func WrapCouldBeSandboxError(err error) error

WrapCouldBeSandboxError wraps an existing error into a CouldBeSandboxError to hint on disabling the sandbox when the error is handled.

func WrapExecError

func WrapExecError(err error, cmd *exec.Cmd) error

WrapExecError wraps an existing error into an ExecError to include information about the exec.Cmd which failed in the error message.

func WrapIncorrectUsageError

func WrapIncorrectUsageError(err error) error

WrapIncorrectUsageError wraps an existing error into a IncorrectUsageError to have the usage message printed when the error is handled.

func WrapSilentError

func WrapSilentError(err error) error

WrapSilentError wraps an existing error into a SilentError to avoid having the error message printed when the error is handled.

Types

type CouldBeSandboxError

type CouldBeSandboxError struct {
	// contains filtered or unexported fields
}

CouldBeSandboxError indicates that the error might have been caused by the sandbox restricting access. When a CouldBeSandboxError is handled, a message should be printed which suggests to disable the sandbox if its not needed.

func (CouldBeSandboxError) Error

func (e CouldBeSandboxError) Error() string

func (CouldBeSandboxError) Unwrap

func (e CouldBeSandboxError) Unwrap() error

type ExecError

type ExecError struct {
	// contains filtered or unexported fields
}

ExecError includes information about the exec.Cmd which failed in the error message.

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) Format

func (e *ExecError) Format(s fmt.State, verb rune)

func (*ExecError) Unwrap

func (e *ExecError) Unwrap() error

type IncorrectUsageError

type IncorrectUsageError struct {
	// contains filtered or unexported fields
}

IncorrectUsageError indicates that the command wasn't used correctly, for example because required arguments are missing. When an IncorrectUsageError is handled, the usage message should be printed.

func (IncorrectUsageError) Error

func (e IncorrectUsageError) Error() string

func (IncorrectUsageError) Unwrap

func (e IncorrectUsageError) Unwrap() error

type SignalError

type SignalError struct {
	Signal syscall.Signal
}

func NewSignalError

func NewSignalError(signal syscall.Signal) *SignalError

func (SignalError) Error

func (e SignalError) Error() string

type SilentError

type SilentError struct {
	// contains filtered or unexported fields
}

SilentError indicates that the error message should not be printed when the error is handled.

func (SilentError) Error

func (e SilentError) Error() string

func (SilentError) Unwrap

func (e SilentError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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