class RunnerTest

Defined at line 38 of file ../../src/sys/fuzzing/common/runner-unittest.h

Just as |Runner| is the base class for specific runner implementations, this class contains

generic runner unit tests that can be used as the basis for the specific implementations' unit

tests.

To use these tests for, e.g. a "DerivedRunner" class and a "DerivedRunnerTest" test fixture,

include code like the following:

#define RUNNER_TYPE DerivedRunner

#define RUNNER_TEST DerivedRunnerTest

#include "src/sys/fuzzing/controller/runner-unittest.inc"

#undef RUNNER_TEST

#undef RUNNER_TYPE

Protected Methods

void SetUp ()

Test fixtures.

Defined at line 25 of file ../../src/sys/fuzzing/common/runner-unittest.cc

const RunnerPtr & runner ()
std::vector<std::string> GetParameters ()

Gets or sets the arguments supplied a component manifest, e.g. the engine's. The exact manifest

represented depends on the runner.

void SetParameters (std::vector<std::string> parameters)
void Configure (const OptionsPtr & options)

Adds test-related |options| (e.g. PRNG seed) and configures the |runner|.

Defined at line 30 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void SetCoverage (const Input & input, Coverage coverage)

Tests may set fake coverage to be "produced" during calls to |RunOne| with the given |input|.

Defined at line 39 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void SetFuzzResultHandler (FuzzResultHandler handler)

Defined at line 43 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void SetLeak (bool has_leak)

Tests may indicate if all inputs will simulate leaking memory.

Defined at line 45 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void SetCoverage (const std::string & hex, Coverage coverage)

These methods correspond to those above, but with a given |hex| string representing the input.

Additionally, the |hex| strings may contain "x" as a wildcard. A hex string from an input

matches a wildcarded string if they are the same length and every character matches or is "x".

In the cases of multiple matches, the longest non-wildcarded prefix wins.

void SetFuzzResult (const std::string & hex, FuzzResult fuzz_result)
void SetLeak (const std::string & hex, bool has_leak)
Promise<Input> RunOne ()

Fakes the interactions needed with the runner to perform a single fuzzing run.

Defined at line 47 of file ../../src/sys/fuzzing/common/runner-unittest.cc

Promise<Input> RunOne (FuzzResult result)

Like |RunOne()|, but the given parameters overrides any values set by the corresponding

|Set...| methods.

Defined at line 59 of file ../../src/sys/fuzzing/common/runner-unittest.cc

Promise<Input> RunOne (Coverage coverage)

Defined at line 53 of file ../../src/sys/fuzzing/common/runner-unittest.cc

Promise<Input> RunOne (bool leak)

Defined at line 65 of file ../../src/sys/fuzzing/common/runner-unittest.cc

ZxResult<Artifact> RunUntil (ZxPromise<Artifact> promise)

Fakes the interactions needed with the runner to perform a sequence of fuzzing runs until the

given |promise| completes.

Defined at line 98 of file ../../src/sys/fuzzing/common/runner-unittest.cc

ZxResult<> RunUntil (ZxPromise<> promise)

Defined at line 104 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void RunUntil (Promise<> promise)

Defined at line 110 of file ../../src/sys/fuzzing/common/runner-unittest.cc

ZxPromise<Input> GetTestInput ()

Returns the test input for the next run. This must not be called unless |HasTestInput| returns

true.

ZxPromise<> SetFeedback (Coverage coverage, FuzzResult result, bool leak)

Sets the feedback for the next run.

const OptionsPtr & options ()

Defined at line 46 of file ../../src/sys/fuzzing/common/runner-unittest.h

void TearDown ()

Defined at line 138 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void InitializeCorpus ()

Unit tests.

Defined at line 151 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void InitializeDictionary ()

Defined at line 189 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void TryOneNoError ()

Defined at line 395 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void TryOneWithError ()

Defined at line 406 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void TryOneWithLeak ()

Defined at line 417 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MinimizeNoError ()

Simulate no error on the original input.

Defined at line 434 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MinimizeEmpty ()

Empty input should exit immediately.

Defined at line 443 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MinimizeOneByte ()

1-byte input should exit immediately.

Defined at line 465 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MinimizeReduceByTwo ()

Defined at line 486 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MinimizeNewError ()

Defined at line 514 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void CleanseNoReplacement ()

Defined at line 541 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void CleanseAlreadyClean ()

Defined at line 559 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void CleanseTwoBytes ()

Defined at line 571 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void FuzzUntilError ()

Defined at line 227 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void FuzzUntilRuns ()

Defined at line 305 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void FuzzUntilTime ()

Defined at line 378 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void MergeSeedError ()

Defined at line 605 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void Merge (bool keeps_errors)

The |Merge| unit test has an extra parameters, |keeps_errors|, which indicates whether the

runner includes error-causing inputs in the final corpus. Because of this parameter, this test

is not included in runner-unittest.inc and should be added directly, e.g.:

TEST_F(DerivedRunnerTest, Merge) {

MergeSeedError(/* keep_errors= */ true);

}

Defined at line 629 of file ../../src/sys/fuzzing/common/runner-unittest.cc

void Stop ()

Defined at line 709 of file ../../src/sys/fuzzing/common/runner-unittest.cc