Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Functions | Variables
fuzz.cpp File Reference
#include <test/fuzz/fuzz.h>
#include <netaddress.h>
#include <netbase.h>
#include <test/util/setup_common.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/sock.h>
#include <util/time.h>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <tuple>
#include <unistd.h>
#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)
 
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. More...
 
const std::function< std::string()> G_TEST_GET_FULL_NAME {}
 Retrieve the unit test name. More...
 
static std::vector< const char * > g_args
 A copy of the command line arguments that start with --. More...
 
const std::function< std::vector< const char * >)> G_TEST_COMMAND_LINE_ARGUMENTS
 Retrieve the command line arguments. More...
 
static std::string_view g_fuzz_target
 
static const TypeTestOneInputg_test_one_input {nullptr}
 

Function Documentation

◆ FuzzFrameworkRegisterTarget()

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

Definition at line 74 of file fuzz.cpp.

Here is the call graph for this function:

◆ FuzzTargets()

auto& FuzzTargets ( )

Definition at line 68 of file fuzz.cpp.

Here is the caller graph for this function:

◆ initialize()

void initialize ( )

Definition at line 83 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 185 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 177 of file fuzz.cpp.

◆ SetArgs()

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

Definition at line 49 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 47 of file fuzz.cpp.

◆ g_fuzz_target

std::string_view g_fuzz_target
static

Definition at line 80 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:47

Retrieve the command line arguments.

Definition at line 59 of file fuzz.cpp.

◆ G_TEST_GET_FULL_NAME

const std::function<std::string()> G_TEST_GET_FULL_NAME {}

Retrieve the unit test name.

Definition at line 38 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 36 of file fuzz.cpp.

◆ g_test_one_input

const TypeTestOneInput* g_test_one_input {nullptr}
static

Definition at line 81 of file fuzz.cpp.