From 92d3d691f097ead8e5ae571eb9bf691133a6aa49 Mon Sep 17 00:00:00 2001 From: Hodlinator <172445034+hodlinator@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:13:01 +0200 Subject: [PATCH] fuzz: Implement G_TEST_GET_FULL_NAME 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. --- src/test/fuzz/fuzz.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 6cd1f70feb443..3c81e0f3fe8aa 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -35,8 +35,6 @@ __AFL_FUZZ_INIT(); const std::function G_TEST_LOG_FUN{}; -const std::function 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`. @@ -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 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));