Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | BasicTestingSetup::~BasicTestingSetup() { | ||||
LogInstance().DisconnectTestLogger(); | LogInstance().DisconnectTestLogger(); | ||||
fs::remove_all(m_path_root); | fs::remove_all(m_path_root); | ||||
ECC_Stop(); | ECC_Stop(); | ||||
} | } | ||||
TestingSetup::TestingSetup(const std::string &chainName) | TestingSetup::TestingSetup(const std::string &chainName) | ||||
: BasicTestingSetup(chainName) { | : BasicTestingSetup(chainName) { | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
g_rpc_node = &m_node; | |||||
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; | ||||
g_rpc_node = &m_node; | |||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | RegisterAllRPCCommands(config, rpcServer, tableRPC); | ||||
/** | /** | ||||
* RPC does not come out of the warmup state on its own. Normally, this is | * RPC does not come out of the warmup state on its own. Normally, this is | ||||
* handled in bitcoind's init path, but unit tests do not trigger this | * handled in bitcoind's init path, but unit tests do not trigger this | ||||
* codepath, so we call it explicitly as part of setup. | * codepath, so we call it explicitly as part of setup. | ||||
*/ | */ | ||||
std::string rpcWarmupStatus; | std::string rpcWarmupStatus; | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
TestingSetup::~TestingSetup() { | TestingSetup::~TestingSetup() { | ||||
if (m_node.scheduler) { | if (m_node.scheduler) { | ||||
m_node.scheduler->stop(); | m_node.scheduler->stop(); | ||||
} | } | ||||
threadGroup.interrupt_all(); | threadGroup.interrupt_all(); | ||||
threadGroup.join_all(); | threadGroup.join_all(); | ||||
GetMainSignals().FlushBackgroundCallbacks(); | GetMainSignals().FlushBackgroundCallbacks(); | ||||
GetMainSignals().UnregisterBackgroundSignalScheduler(); | GetMainSignals().UnregisterBackgroundSignalScheduler(); | ||||
g_rpc_node = nullptr; | |||||
m_node.connman.reset(); | m_node.connman.reset(); | ||||
m_node.banman.reset(); | m_node.banman.reset(); | ||||
m_node.mempool = nullptr; | m_node.mempool = nullptr; | ||||
m_node.scheduler.reset(); | m_node.scheduler.reset(); | ||||
UnloadBlockIndex(); | UnloadBlockIndex(); | ||||
g_chainstate.reset(); | g_chainstate.reset(); | ||||
pblocktree.reset(); | pblocktree.reset(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |