File tree Expand file tree Collapse file tree 5 files changed +19
-1
lines changed Expand file tree Collapse file tree 5 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ bool BCLog::Logger::StartLogging()
75
75
return true ;
76
76
}
77
77
78
+ void BCLog::Logger::DisconnectTestLogger ()
79
+ {
80
+ std::lock_guard<std::mutex> scoped_lock (m_cs);
81
+ m_buffering = true ;
82
+ if (m_fileout != nullptr ) fclose (m_fileout);
83
+ m_fileout = nullptr ;
84
+ }
85
+
78
86
void BCLog::Logger::EnableCategory (BCLog::LogFlags flag)
79
87
{
80
88
m_categories |= flag;
Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ namespace BCLog {
100
100
101
101
/* * Start logging (and flush all buffered messages) */
102
102
bool StartLogging ();
103
+ /* * Only for testing */
104
+ void DisconnectTestLogger ();
103
105
104
106
void ShrinkDebugFile ();
105
107
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ void AppTests::appTests()
64
64
#endif
65
65
66
66
ECC_Stop (); // Already started by the common test setup, so stop it to avoid interference
67
+ LogInstance ().DisconnectTestLogger ();
68
+
67
69
m_app.parameterSetup ();
68
70
m_app.createOptionsModel (true /* reset settings */ );
69
71
QScopedPointer<const NetworkStyle> style (
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ void RPCNestedTests::rpcNestedTests()
35
35
tableRPC.appendCommand (" rpcNestedTest" , &vRPCCommands[0 ]);
36
36
// mempool.setSanityCheck(1.0);
37
37
38
+ LogInstance ().DisconnectTestLogger (); // Already started by the common test setup, so stop it to avoid interference
38
39
TestingSetup test;
39
40
40
41
if (RPCIsInWarmup (nullptr )) SetRPCWarmupFinished ();
Original file line number Diff line number Diff line change 10
10
#include < consensus/params.h>
11
11
#include < consensus/validation.h>
12
12
#include < crypto/sha256.h>
13
+ #include < init.h>
13
14
#include < miner.h>
14
15
#include < net_processing.h>
15
16
#include < noui.h>
@@ -37,14 +38,17 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
37
38
fs::create_directories (m_path_root);
38
39
gArgs .ForceSetArg (" -datadir" , m_path_root.string ());
39
40
ClearDatadirCache ();
41
+ SelectParams (chainName);
42
+ gArgs .ForceSetArg (" -printtoconsole" , " 0" );
43
+ InitLogging ();
44
+ LogInstance ().StartLogging ();
40
45
SHA256AutoDetect ();
41
46
ECC_Start ();
42
47
SetupEnvironment ();
43
48
SetupNetworking ();
44
49
InitSignatureCache ();
45
50
InitScriptExecutionCache ();
46
51
fCheckBlockIndex = true ;
47
- SelectParams (chainName);
48
52
static bool noui_connected = false ;
49
53
if (!noui_connected) {
50
54
noui_connect ();
@@ -54,6 +58,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
54
58
55
59
BasicTestingSetup::~BasicTestingSetup ()
56
60
{
61
+ LogInstance ().DisconnectTestLogger ();
57
62
fs::remove_all (m_path_root);
58
63
ECC_Stop ();
59
64
}
You can’t perform that action at this time.
0 commit comments