test: Log to debug.log in all tests
This commit is contained in:
parent
fa4a04a5a9
commit
fabc57e07d
5 changed files with 19 additions and 1 deletions
|
@ -75,6 +75,14 @@ bool BCLog::Logger::StartLogging()
|
|||
return true;
|
||||
}
|
||||
|
||||
void BCLog::Logger::DisconnectTestLogger()
|
||||
{
|
||||
std::lock_guard<std::mutex> scoped_lock(m_cs);
|
||||
m_buffering = true;
|
||||
if (m_fileout != nullptr) fclose(m_fileout);
|
||||
m_fileout = nullptr;
|
||||
}
|
||||
|
||||
void BCLog::Logger::EnableCategory(BCLog::LogFlags flag)
|
||||
{
|
||||
m_categories |= flag;
|
||||
|
|
|
@ -100,6 +100,8 @@ namespace BCLog {
|
|||
|
||||
/** Start logging (and flush all buffered messages) */
|
||||
bool StartLogging();
|
||||
/** Only for testing */
|
||||
void DisconnectTestLogger();
|
||||
|
||||
void ShrinkDebugFile();
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ void AppTests::appTests()
|
|||
#endif
|
||||
|
||||
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
|
||||
LogInstance().DisconnectTestLogger();
|
||||
|
||||
m_app.parameterSetup();
|
||||
m_app.createOptionsModel(true /* reset settings */);
|
||||
QScopedPointer<const NetworkStyle> style(
|
||||
|
|
|
@ -35,6 +35,7 @@ void RPCNestedTests::rpcNestedTests()
|
|||
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
|
||||
//mempool.setSanityCheck(1.0);
|
||||
|
||||
LogInstance().DisconnectTestLogger(); // Already started by the common test setup, so stop it to avoid interference
|
||||
TestingSetup test;
|
||||
|
||||
if (RPCIsInWarmup(nullptr)) SetRPCWarmupFinished();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <consensus/params.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <init.h>
|
||||
#include <miner.h>
|
||||
#include <net_processing.h>
|
||||
#include <noui.h>
|
||||
|
@ -37,6 +38,10 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
|
|||
fs::create_directories(m_path_root);
|
||||
gArgs.ForceSetArg("-datadir", m_path_root.string());
|
||||
ClearDatadirCache();
|
||||
SelectParams(chainName);
|
||||
gArgs.ForceSetArg("-printtoconsole", "0");
|
||||
InitLogging();
|
||||
LogInstance().StartLogging();
|
||||
SHA256AutoDetect();
|
||||
ECC_Start();
|
||||
SetupEnvironment();
|
||||
|
@ -44,7 +49,6 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
|
|||
InitSignatureCache();
|
||||
InitScriptExecutionCache();
|
||||
fCheckBlockIndex = true;
|
||||
SelectParams(chainName);
|
||||
static bool noui_connected = false;
|
||||
if (!noui_connected) {
|
||||
noui_connect();
|
||||
|
@ -54,6 +58,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
|
|||
|
||||
BasicTestingSetup::~BasicTestingSetup()
|
||||
{
|
||||
LogInstance().DisconnectTestLogger();
|
||||
fs::remove_all(m_path_root);
|
||||
ECC_Stop();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue