File tree Expand file tree Collapse file tree 7 files changed +34
-0
lines changed
test/sanitizer_suppressions Expand file tree Collapse file tree 7 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 16
16
#include < regex>
17
17
18
18
const RegTestingSetup* g_testing_setup = nullptr ;
19
+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
19
20
20
21
void benchmark::ConsolePrinter::header ()
21
22
{
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
37
37
#endif
38
38
#endif
39
39
40
+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
41
+
40
42
// This is all you need to run all the tests
41
43
int main (int argc, char *argv[])
42
44
{
Original file line number Diff line number Diff line change 4
4
5
5
#include < test/fuzz/fuzz.h>
6
6
7
+ #include < test/util/setup_common.h>
8
+
7
9
#include < cstdint>
8
10
#include < unistd.h>
9
11
#include < vector>
10
12
13
+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
14
+
11
15
static bool read_stdin (std::vector<uint8_t >& data)
12
16
{
13
17
uint8_t buffer[1024 ];
Original file line number Diff line number Diff line change 2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
5
+ /* *
6
+ * See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/link_references/link_boost_test_module_macro.html
7
+ */
5
8
#define BOOST_TEST_MODULE Bitcoin Core Test Suite
6
9
7
10
#include < boost/test/unit_test.hpp>
11
+
12
+ #include < test/util/setup_common.h>
13
+
14
+ /* * Redirect debug log to boost log */
15
+ const std::function<void (const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) {
16
+ if (s.back () == ' \n ' ) {
17
+ // boost will insert the new line
18
+ BOOST_TEST_MESSAGE (s.substr (0 , s.size () - 1 ));
19
+ } else {
20
+ BOOST_TEST_MESSAGE (s);
21
+ }
22
+ };
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
71
71
SelectParams (chainName);
72
72
SeedInsecureRand ();
73
73
gArgs .ForceSetArg (" -printtoconsole" , " 0" );
74
+ if (G_TEST_LOG_FUN) LogInstance ().PushBackCallback (G_TEST_LOG_FUN);
74
75
InitLogging ();
75
76
LogInstance ().StartLogging ();
76
77
SHA256AutoDetect ();
Original file line number Diff line number Diff line change 18
18
19
19
#include < boost/thread.hpp>
20
20
21
+ /* * This is connected to the logger. Can be used to redirect logs to any other log */
22
+ extern const std::function<void (const std::string&)> G_TEST_LOG_FUN;
23
+
21
24
// Enable BOOST_CHECK_EQUAL for enum class types
22
25
template <typename T>
23
26
std::ostream& operator <<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ deadlock:WalletBatch
7
7
# Intentional deadlock in tests
8
8
deadlock:TestPotentialDeadLockDetected
9
9
10
+ # Race due to unprotected calls to thread-unsafe BOOST_TEST_MESSAGE from different threads:
11
+ # * G_TEST_LOG_FUN in the index thread
12
+ # * boost test case invoker (entering a test case) in the main thread
13
+ # TODO: get rid of BOOST_ macros, see also https://github.com/bitcoin/bitcoin/issues/8670
14
+ race:blockfilter_index_initial_sync_invoker
15
+ race:txindex_initial_sync_invoker
16
+ race:validation_block_tests::TestSubscriber
17
+
10
18
# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
11
19
race:src/qt/test/*
12
20
deadlock:src/qt/test/*
You can’t perform that action at this time.
0 commit comments