Skip to content

Commit

Permalink
fuzz: Implement G_TEST_GET_FULL_NAME
Browse files Browse the repository at this point in the history
When BasicTestingSetup is used in fuzz-tests it will now create test directories containing the fuzz target names. Example:
/tmp/test_common bitcoin/tx_package_eval/153d7906294f7d0606a7/

This is already implemented for bench and unit tests.
  • Loading branch information
hodlinator committed Nov 20, 2024
1 parent f34fe08 commit 92d3d69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/fuzz/fuzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ __AFL_FUZZ_INIT();

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

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

/**
* A copy of the command line arguments that start with `--`.
* First `LLVMFuzzerInitialize()` is called, which saves the arguments to `g_args`.
Expand Down Expand Up @@ -80,6 +78,9 @@ void FuzzFrameworkRegisterTarget(std::string_view name, TypeTestOneInput target,
static std::string_view g_fuzz_target;
static const TypeTestOneInput* g_test_one_input{nullptr};

const std::function<std::string()> G_TEST_GET_FULL_NAME{[]{
return std::string{g_fuzz_target};
}};

#if defined(__clang__) && defined(__linux__)
extern "C" void __llvm_profile_reset_counters(void) __attribute__((weak));
Expand Down

0 comments on commit 92d3d69

Please sign in to comment.