Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show All 19 Lines | |||||
#include "rpc/server.h" | #include "rpc/server.h" | ||||
#include "script/scriptcache.h" | #include "script/scriptcache.h" | ||||
#include "script/sigcache.h" | #include "script/sigcache.h" | ||||
#include "txdb.h" | #include "txdb.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "test/testutil.h" | |||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <condition_variable> | #include <condition_variable> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <functional> | #include <functional> | ||||
#include <list> | #include <list> | ||||
#include <memory> | #include <memory> | ||||
#include <thread> | #include <thread> | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName) | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
const CChainParams &chainparams = config.GetChainParams(); | const CChainParams &chainparams = config.GetChainParams(); | ||||
// Ideally we'd move all the RPC tests to the functional testing framework | // Ideally we'd move all the RPC tests to the functional testing framework | ||||
// instead of unit tests, but for now we need these here. | // instead of unit tests, but for now we need these here. | ||||
RPCServer rpcServer; | RPCServer rpcServer; | ||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | RegisterAllRPCCommands(config, rpcServer, tableRPC); | ||||
ClearDatadirCache(); | ClearDatadirCache(); | ||||
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", | pathTemp = fs::temp_directory_path() / | ||||
(unsigned long)GetTime(), | strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), | ||||
(int)(InsecureRandRange(100000))); | (int)(InsecureRandRange(100000))); | ||||
fs::create_directories(pathTemp); | fs::create_directories(pathTemp); | ||||
gArgs.ForceSetArg("-datadir", pathTemp.string()); | gArgs.ForceSetArg("-datadir", pathTemp.string()); | ||||
// Note that because we don't bother running a scheduler thread here, | // Note that because we don't bother running a scheduler thread here, | ||||
// callbacks via CValidationInterface are unreliable, but that's OK, | // callbacks via CValidationInterface are unreliable, but that's OK, | ||||
// our unit tests aren't testing multiple parts of the code at once. | // our unit tests aren't testing multiple parts of the code at once. | ||||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler); | GetMainSignals().RegisterBackgroundSignalScheduler(scheduler); | ||||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |