Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
fuzz.cpp File Reference
#include <test/fuzz/fuzz.h>
#include <netaddress.h>
#include <netbase.h>
#include <test/fuzz/util/check_globals.h>
#include <test/util/coverage.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/sock.h>
#include <util/time.h>
#include <algorithm>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <random>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
Include dependency graph for fuzz.cpp:

Go to the source code of this file.

Classes

struct  FuzzTarget

Functions

static void SetArgs (int argc, char **argv)
auto & FuzzTargets ()
void FuzzFrameworkRegisterTarget (std::string_view name, TypeTestOneInput target, FuzzTargetOptions opts)
static void test_one_input (FuzzBufferType buffer)
static void initialize ()
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
int LLVMFuzzerInitialize (int *argc, char ***argv)

Variables

const std::function< void(const std::string &)> G_TEST_LOG_FUN {}
 This is connected to the logger.
static std::vector< const char * > g_args
 A copy of the command line arguments that start with --.
const std::function< std::vector< const char * >()> G_TEST_COMMAND_LINE_ARGUMENTS
 Retrieve the command line arguments.
static std::string_view g_fuzz_target
static const TypeTestOneInputg_test_one_input {nullptr}
const std::function< std::string()> G_TEST_GET_FULL_NAME
 Retrieve the unit test name.

Function Documentation

◆ FuzzFrameworkRegisterTarget()

void FuzzFrameworkRegisterTarget ( std::string_view name,
TypeTestOneInput target,
FuzzTargetOptions opts )

Definition at line 76 of file fuzz.cpp.

Here is the call graph for this function:

◆ FuzzTargets()

auto & FuzzTargets ( )

Definition at line 70 of file fuzz.cpp.

Here is the caller graph for this function:

◆ initialize()

void initialize ( )
static

Definition at line 95 of file fuzz.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LLVMFuzzerInitialize()

int LLVMFuzzerInitialize ( int * argc,
char *** argv )

Definition at line 221 of file fuzz.cpp.

Here is the call graph for this function:

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t * data,
size_t size )

Definition at line 214 of file fuzz.cpp.

Here is the call graph for this function:

◆ SetArgs()

void SetArgs ( int argc,
char ** argv )
static

Definition at line 51 of file fuzz.cpp.

Here is the caller graph for this function:

◆ test_one_input()

void test_one_input ( FuzzBufferType buffer)
static

Definition at line 85 of file fuzz.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ g_args

std::vector<const char*> g_args
static

A copy of the command line arguments that start with --.

First LLVMFuzzerInitialize() is called, which saves the arguments to g_args. Later, depending on the fuzz test, G_TEST_COMMAND_LINE_ARGUMENTS() may be called by BasicTestingSetup constructor to fetch those arguments and store them in BasicTestingSetup::m_node::args.

Definition at line 49 of file fuzz.cpp.

◆ g_fuzz_target

std::string_view g_fuzz_target
static

Definition at line 82 of file fuzz.cpp.

◆ G_TEST_COMMAND_LINE_ARGUMENTS

const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS
Initial value:
= []() {
return g_args;
}
static std::vector< const char * > g_args
A copy of the command line arguments that start with --.
Definition fuzz.cpp:49

Retrieve the command line arguments.

Definition at line 61 of file fuzz.cpp.

◆ G_TEST_GET_FULL_NAME

const std::function<std::string()> G_TEST_GET_FULL_NAME
Initial value:
{[]{
return std::string{g_fuzz_target};
}}
static std::string_view g_fuzz_target
Definition fuzz.cpp:82

Retrieve the unit test name.

Definition at line 91 of file fuzz.cpp.

◆ G_TEST_LOG_FUN

const std::function<void(const std::string&)> G_TEST_LOG_FUN {}

This is connected to the logger.

Can be used to redirect logs to any other log

Definition at line 40 of file fuzz.cpp.

◆ g_test_one_input

const TypeTestOneInput* g_test_one_input {nullptr}
static

Definition at line 83 of file fuzz.cpp.