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 1616#include < regex>
1717
1818const RegTestingSetup* g_testing_setup = nullptr ;
19+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
1920
2021void benchmark::ConsolePrinter::header ()
2122{
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
3737#endif
3838#endif
3939
40+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
41+
4042// This is all you need to run all the tests
4143int main (int argc, char *argv[])
4244{
Original file line number Diff line number Diff line change 44
55#include < test/fuzz/fuzz.h>
66
7+ #include < test/util/setup_common.h>
8+
79#include < cstdint>
810#include < unistd.h>
911#include < vector>
1012
13+ const std::function<void (const std::string&)> G_TEST_LOG_FUN{};
14+
1115static bool read_stdin (std::vector<uint8_t >& data)
1216{
1317 uint8_t buffer[1024 ];
Original file line number Diff line number Diff line change 22// Distributed under the MIT software license, see the accompanying
33// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
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+ */
58#define BOOST_TEST_MODULE Bitcoin Core Test Suite
69
710#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)
7171 SelectParams (chainName);
7272 SeedInsecureRand ();
7373 gArgs .ForceSetArg (" -printtoconsole" , " 0" );
74+ if (G_TEST_LOG_FUN) LogInstance ().PushBackCallback (G_TEST_LOG_FUN);
7475 InitLogging ();
7576 LogInstance ().StartLogging ();
7677 SHA256AutoDetect ();
Original file line number Diff line number Diff line change 1818
1919#include < boost/thread.hpp>
2020
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+
2124// Enable BOOST_CHECK_EQUAL for enum class types
2225template <typename T>
2326std::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
77# Intentional deadlock in tests
88deadlock:TestPotentialDeadLockDetected
99
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+
1018# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
1119race:src/qt/test/*
1220deadlock:src/qt/test/*
You can’t perform that action at this time.
0 commit comments