mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
bench: add support for custom data directory
Expands the benchmark framework with the existing '-testdatadir' arg, enabling the ability to change the benchmark data directory. This is useful for running benchmarks on different storage devices, and not just under the OS /tmp/ directory.
This commit is contained in:
@@ -85,8 +85,7 @@ struct NetworkSetup
|
||||
};
|
||||
static NetworkSetup g_networksetup_instance;
|
||||
|
||||
/** Register test-only arguments */
|
||||
static void SetupUnitTestArgs(ArgsManager& argsman)
|
||||
void SetupCommonTestArgs(ArgsManager& argsman)
|
||||
{
|
||||
argsman.AddArg("-testdatadir", strprintf("Custom data directory (default: %s<random_string>)", fs::PathToString(fs::temp_directory_path() / TEST_DIR_PATH_ELEMENT / "")),
|
||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
|
||||
@@ -125,7 +124,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, TestOpts opts)
|
||||
gArgs.ClearPathCache();
|
||||
{
|
||||
SetupServerArgs(*m_node.args);
|
||||
SetupUnitTestArgs(*m_node.args);
|
||||
SetupCommonTestArgs(*m_node.args);
|
||||
std::string error;
|
||||
if (!m_node.args->ParseParameters(arguments.size(), arguments.data(), error)) {
|
||||
m_node.args->ClearArgs();
|
||||
|
||||
@@ -45,6 +45,9 @@ extern const std::function<std::string()> G_TEST_GET_FULL_NAME;
|
||||
|
||||
static constexpr CAmount CENT{1000000};
|
||||
|
||||
/** Register common test args. Shared across binaries that rely on the test framework. */
|
||||
void SetupCommonTestArgs(ArgsManager& argsman);
|
||||
|
||||
struct TestOpts {
|
||||
std::vector<const char*> extra_args{};
|
||||
bool coins_db_in_memory{true};
|
||||
|
||||
Reference in New Issue
Block a user