mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 03:33:27 -03:00
test: bench+fuzz - Implement G_TEST_GET_FULL_NAME
This commit is contained in:
parent
4ee1940e84
commit
dfef02f938
2 changed files with 4 additions and 3 deletions
|
@ -29,7 +29,8 @@ const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
|
|||
|
||||
const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};
|
||||
|
||||
const std::function<std::string()> G_TEST_GET_FULL_NAME{};
|
||||
static std::string g_bench_name;
|
||||
const std::function<std::string()> G_TEST_GET_FULL_NAME = []{ return g_bench_name; };
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -117,6 +118,7 @@ void BenchRunner::RunAll(const Args& args)
|
|||
bench.output(nullptr);
|
||||
}
|
||||
bench.name(name);
|
||||
g_bench_name = name;
|
||||
if (args.min_time > 0ms) {
|
||||
// convert to nanos before dividing to reduce rounding errors
|
||||
std::chrono::nanoseconds min_time_ns = args.min_time;
|
||||
|
|
|
@ -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`.
|
||||
|
@ -80,6 +78,7 @@ 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));
|
||||
|
|
Loading…
Add table
Reference in a new issue