aboutsummaryrefslogtreecommitdiff
path: root/src/bench/bench_bitcoin.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-04-15 11:25:03 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-04-15 11:28:25 -0400
commit78295e97b8d38ecf6628b5d8ce1efd3900a5c345 (patch)
tree1f9f1fd2fa8c227d5b5c94b85d4caaf54c468c77 /src/bench/bench_bitcoin.cpp
parent2209b3ba25dea2dc461b5652b8733f93aec39ebf (diff)
parentfaf400077d0144363c2dd24187431d958fb149a9 (diff)
downloadbitcoin-78295e97b8d38ecf6628b5d8ce1efd3900a5c345.tar.xz
Merge #15788: test: Unify testing setups for fuzz, bench, and unit tests
faf400077d scripted-diff: Bump copyright headers in test, bench (MarcoFalke) fa821904bf scripted-diff: Rename test_bitcoin to test/setup_common (MarcoFalke) fa8685d49e test: Use test_bitcoin setup in bench, Add test utils (MarcoFalke) 666696b673 test: Have segwit always active in (Basic)TestingSetup (MarcoFalke) Pull request description: Now that the fuzz tests can use the BasicTestingSetup [1], do the same for bench. Also move some duplicate code to a common "test/util" module. [1]: fuzz: Link BasicTestingSetup (shared with unit tests) #15504 ACKs for commit faf400: jonatack: ACK https://github.com/bitcoin/bitcoin/pull/15788/commits/faf400077d0144363c2dd24187431d958fb149a9 Tree-SHA512: 8ac5692e72cf50e460958f291643ae6b8bb04d5c1331ed50dce9eb4e9457e5a925144c532c42b360a26707e11eeece74aab27db8c76ab9a429b9dd7167e7cdc4
Diffstat (limited to 'src/bench/bench_bitcoin.cpp')
-rw-r--r--src/bench/bench_bitcoin.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp
index d67b2c5bc7..3cf0bf9530 100644
--- a/src/bench/bench_bitcoin.cpp
+++ b/src/bench/bench_bitcoin.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2018 The Bitcoin Core developers
+// Copyright (c) 2015-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -6,14 +6,11 @@
#include <crypto/sha256.h>
#include <key.h>
-#include <util/system.h>
#include <util/strencodings.h>
-#include <validation.h>
+#include <util/system.h>
#include <memory>
-const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
-
static const int64_t DEFAULT_BENCH_EVALUATIONS = 5;
static const char* DEFAULT_BENCH_FILTER = ".*";
static const char* DEFAULT_BENCH_SCALING = "1.0";
@@ -36,14 +33,6 @@ static void SetupBenchArgs()
gArgs.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), false, OptionsCategory::OPTIONS);
}
-static fs::path SetDataDir()
-{
- fs::path ret = fs::temp_directory_path() / "bench_bitcoin" / fs::unique_path();
- fs::create_directories(ret);
- gArgs.ForceSetArg("-datadir", ret.string());
- return ret;
-}
-
int main(int argc, char** argv)
{
SetupBenchArgs();
@@ -59,13 +48,6 @@ int main(int argc, char** argv)
return EXIT_SUCCESS;
}
- // Set the datadir after parsing the bench options
- const fs::path bench_datadir{SetDataDir()};
-
- SHA256AutoDetect();
- ECC_Start();
- SetupEnvironment();
-
int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS);
std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER);
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING);
@@ -88,9 +70,5 @@ int main(int argc, char** argv)
benchmark::BenchRunner::RunAll(*printer, evaluations, scaling_factor, regex_filter, is_list_only);
- fs::remove_all(bench_datadir);
-
- ECC_Stop();
-
return EXIT_SUCCESS;
}