Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 720590342
  • Loading branch information
FuzzTest Team authored and copybara-github committed Jan 28, 2025
1 parent 76b60b8 commit 86ba987
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions fuzztest/internal/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@
namespace fuzztest {
namespace internal {

#if defined(FUZZTEST_COMPATIBILITY_MODE) && defined(FUZZTEST_USE_CENTIPEDE)
#error FuzzTest compatibility mode cannot work together with Centipede.
#endif
#if defined(FUZZTEST_COMPATIBILITY_MODE)
template <typename RegBase, typename Fixture, typename TargetFunction,
typename SeedProvider>
class FuzzTestFuzzerProvider : public FuzzTestExternalEngineAdaptor {
public:
using FuzzTestExternalEngineAdaptor::FuzzTestExternalEngineAdaptor;
};
#elif defined(FUZZTEST_USE_CENTIPEDE)
template <typename RegBase, typename Fixture, typename TargetFunction,
typename SeedProvider>
class FuzzTestFuzzerProvider : public CentipedeFuzzerAdaptor {
public:
using CentipedeFuzzerAdaptor::CentipedeFuzzerAdaptor;
};
#else
template <typename RegBase, typename Fixture, typename TargetFunction,
typename SeedProvider>
class FuzzTestFuzzerProvider : public FuzzTestFuzzerImpl {
public:
using FuzzTestFuzzerImpl::FuzzTestFuzzerImpl;
};
#endif

void RegisterImpl(BasicTestInfo test_info, FuzzTestFuzzerFactory factory);

void ForEachTest(absl::FunctionRef<void(FuzzTest&)> func);
Expand Down Expand Up @@ -70,16 +96,8 @@ struct RegistrationToken {
typename SeedProvider>
static FuzzTestFuzzerFactory GetFuzzTestFuzzerFactory(
Registration<Fixture, TargetFunction, RegBase, SeedProvider>&& reg) {
#if defined(FUZZTEST_COMPATIBILITY_MODE) && defined(FUZZTEST_USE_CENTIPEDE)
#error FuzzTest compatibility mode cannot work together with Centipede.
#endif
#if defined(FUZZTEST_COMPATIBILITY_MODE)
using FuzzerImpl = FuzzTestExternalEngineAdaptor;
#elif defined(FUZZTEST_USE_CENTIPEDE)
using FuzzerImpl = CentipedeFuzzerAdaptor;
#else
using FuzzerImpl = FuzzTestFuzzerImpl;
#endif
using FuzzerImpl =
FuzzTestFuzzerProvider<RegBase, Fixture, TargetFunction, SeedProvider>;

return [target_function = reg.target_function_, domain = reg.GetDomains(),
seeds = reg.seeds(), seed_provider = reg.seed_provider()](
Expand Down

0 comments on commit 86ba987

Please sign in to comment.