Documentation
¶
Index ¶
- Variables
- func AnyFailed(rs []Result) bool
- func CorpusFiles(t *T, ws *Workspace, sub string) []string
- func ParseOutput(stdout string) (FinalStats, []TickStats)
- func Register(t Test)
- func RequireBinary(t *T, name string)
- func RequireBun(t *T)
- func RequireCargo(t *T)
- func RequireClang19(t *T)
- func RequireCrossfuzzBinary(t *T)
- func RequireGo(t *T)
- func RequireGradle(t *T)
- func RequireJSHarness(t *T)
- func RequireJava(t *T)
- func RequireJavaHarness(t *T)
- func RequirePythonVenv(t *T)
- func RequireRustHarness(t *T)
- type FinalStats
- type Finding
- type Outcome
- type Result
- type RunResult
- func Analyze(t *T, ws *Workspace, args ...string) RunResult
- func Build(t *T, ws *Workspace, args ...string) RunResult
- func Reduce(t *T, ws *Workspace, args ...string) RunResult
- func Run(t *T, ws *Workspace, args ...string) RunResult
- func RunWithTimeout(t *T, ws *Workspace, wall time.Duration, args ...string) RunResult
- type Runner
- type T
- func (t *T) Cleanup(f func())
- func (t *T) Error(args ...any)
- func (t *T) Errorf(format string, args ...any)
- func (t *T) Fatal(args ...any)
- func (t *T) Fatalf(format string, args ...any)
- func (t *T) Helper()
- func (t *T) Log(args ...any)
- func (t *T) Logf(format string, args ...any)
- func (t *T) Name() string
- func (t *T) Parallel()
- func (t *T) Skip(args ...any)
- func (t *T) Skipf(format string, args ...any)
- func (t *T) TempDir() string
- type Test
- type TickStats
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var DefaultSeed int64 = 1
DefaultSeed is the --seed value injected into every `crossfuzz run` invocation made through this framework, unless the caller passes their own --seed. Defaults to 1 so cross-run comparisons in tests are reproducible; the e2e binary's --seed flag overrides it.
Functions ¶
func CorpusFiles ¶
CorpusFiles returns the list of corpus entry filenames under <ws.Dir>/<sub>. Returns an empty slice if the directory does not exist.
func ParseOutput ¶
func ParseOutput(stdout string) (FinalStats, []TickStats)
ParseOutput extracts every stats tick and the final summary line from captured stdout. Both may be absent (returns zero values).
func Register ¶
func Register(t Test)
Register adds a test to the global registry. Called from package init().
func RequireBinary ¶
RequireBinary skips the test if `name` is not found on PATH.
func RequireBun ¶
func RequireBun(t *T)
func RequireCargo ¶
func RequireCargo(t *T)
func RequireClang19 ¶
func RequireClang19(t *T)
func RequireCrossfuzzBinary ¶
func RequireCrossfuzzBinary(t *T)
RequireCrossfuzzBinary skips if bin/crossfuzz does not exist.
func RequireGradle ¶
func RequireGradle(t *T)
func RequireJSHarness ¶
func RequireJSHarness(t *T)
RequireJSHarness skips if the JS harness's node_modules is missing.
func RequireJava ¶
func RequireJava(t *T)
func RequireJavaHarness ¶
func RequireJavaHarness(t *T)
RequireJavaHarness skips if harness/java/build/libs/crossfuzz.jar is missing.
func RequirePythonVenv ¶
func RequirePythonVenv(t *T)
RequirePythonVenv skips if harness/python/.venv/bin/python3 is missing.
func RequireRustHarness ¶
func RequireRustHarness(t *T)
RequireRustHarness skips if the rust harness rlib is missing.
Types ¶
type FinalStats ¶
type FinalStats struct {
Found bool // true if the "Campaign finished" line was present
Execs int
Rejected int
Corpus int
Findings int
Crashes int
Timeouts int
}
FinalStats is parsed from the "Campaign finished. ..." line printed at shutdown. It is the authoritative end-of-run summary.
type Finding ¶
Finding is one entry under findings/. Hash is the directory name; Kind is "divergence" (no prefix), "crash", or "timeout".
type Result ¶
type Result struct {
Test Test
Outcome Outcome
Reason string // skip reason or fail message
Logs []string // collected via t.Logf
Duration time.Duration
}
Result captures everything observable about one test execution.
type RunResult ¶
type RunResult struct {
ExitCode int
Stdout string
Stderr string
Stats FinalStats
Ticks []TickStats
}
RunResult is the captured outcome of one bin/crossfuzz invocation.
type Runner ¶
type Runner struct {
Tests []Test
Parallel int // max concurrent tests; 1 = strictly serial
Verbose bool // stream per-test logs as they finish
FailFast bool // stop dispatching after the first failure
StopOnPanic bool // treat panic as fatal to the whole run
// Flaky, if > 0, rerun each failed/panicked test up to this many extra
// times after the first pass. A test that passes any retry is reported
// as Flaky (not Failed) so the user knows to investigate it as
// instability rather than a real regression.
Flaky int
Out io.Writer // progress + summary output
NowFunc func() time.Time
}
Runner orchestrates execution of a slice of tests.
type T ¶
type T struct {
// contains filtered or unexported fields
}
T is the per-test context handed to every test function. It mimics enough of *testing.T's surface (Errorf, Fatalf, Skipf, Logf, Cleanup, TempDir, Helper, Parallel) that the existing helpers ported from go test compile with minimal changes, but it is otherwise independent of the testing package — see orchestrator.go for the runner.
func (*T) Cleanup ¶
func (t *T) Cleanup(f func())
Cleanup registers a function to run after the test, in LIFO order.
func (*T) Helper ¶
func (t *T) Helper()
Helper is a no-op kept for API compatibility — we don't track caller depth.
func (*T) Logf ¶
Logf records a log line; the orchestrator prints them in verbose mode and always after a failure.
func (*T) Parallel ¶
func (t *T) Parallel()
Parallel is a no-op. The orchestrator manages parallelism; tests do not opt in individually.
type Test ¶
type Test struct {
// Name is the dotted identifier shown in output (e.g. "cli.MaxMemory").
Name string
// Tags are short labels used by the -tag filter (e.g. "harness", "parallel",
// "comparer", "go").
Tags []string
// Func is the test body.
Func func(t *T)
}
Test is one registered e2e case.
type TickStats ¶
type TickStats struct {
Execs int
ExecsPerSec float64
Rejected int
Duplicates int
Corpus int
Coverage int // total coverage edges across all targets
Findings int
Crashes int
Timeouts int
TargetEdges map[string]int // populated only when --debug-edge is set
}
TickStats is one line of the live stats ticker (printed every ~3s).
type Workspace ¶
Workspace is an isolated tmpdir for one e2e test. It holds a copy of a fixture and a rendered crossfuzz.toml. Removed automatically on test cleanup (via T.TempDir's cleanup).
func NewWorkspace ¶
NewWorkspace creates a tmpdir, copies the named fixture into it, and renders every *.tmpl file with default vars. Fixtures are resolved first from e2e/fixtures/<name>, then from e2e/<name>.
func (*Workspace) RenderConfig ¶
RenderConfig walks the workspace, rendering every *.tmpl file with the given vars and writing the result to the same path with the .tmpl suffix removed. {{.RepoRoot}} is always available. Re-callable from tests to vary inputs.