mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
Merge #18472: test: Remove unsafe BOOST_TEST_MESSAGE
fa3cc0bfc4
test: Remove unsafe BOOST_TEST_MESSAGE (MarcoFalke) Pull request description: Fixes #17987 Can be tested with ``` ./src/test/test_bitcoin -l test_suite -- DEBUG_LOG_OUT ACKs for top commit: fjahr: tested ACKfa3cc0bfc4
mzumsande: Tested ACKfa3cc0bfc4
Tree-SHA512: f63b110d77882cd7c0d7574ff6c9c948db8febb3400ecdac45164746b587b0fa223463041801271b3959267ddc1d9a4a67ba76939e242e7dd2f92a2834a400a0
This commit is contained in:
commit
72ef366564
3 changed files with 12 additions and 16 deletions
|
@ -1011,7 +1011,7 @@ endif
|
||||||
|
|
||||||
%.cpp.test: %.cpp
|
%.cpp.test: %.cpp
|
||||||
@echo Running tests: `cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1` from $<
|
@echo Running tests: `cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1` from $<
|
||||||
$(AM_V_at)$(TEST_BINARY) --catch_system_errors=no -l test_suite -t "`cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1`" > $<.log 2>&1 || (cat $<.log && false)
|
$(AM_V_at)$(TEST_BINARY) --catch_system_errors=no -l test_suite -t "`cat $< | grep -E "(BOOST_FIXTURE_TEST_SUITE\\(|BOOST_AUTO_TEST_SUITE\\()" | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1`" -- DEBUG_LOG_OUT > $<.log 2>&1 || (cat $<.log && false)
|
||||||
|
|
||||||
%.json.h: %.json
|
%.json.h: %.json
|
||||||
@$(MKDIR_P) $(@D)
|
@$(MKDIR_P) $(@D)
|
||||||
|
|
|
@ -11,12 +11,16 @@
|
||||||
|
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
|
|
||||||
/** Redirect debug log to boost log */
|
#include <iostream>
|
||||||
|
|
||||||
|
/** Redirect debug log to unit_test.log files */
|
||||||
const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) {
|
const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) {
|
||||||
if (s.back() == '\n') {
|
static const bool should_log{std::any_of(
|
||||||
// boost will insert the new line
|
&boost::unit_test::framework::master_test_suite().argv[1],
|
||||||
BOOST_TEST_MESSAGE(s.substr(0, s.size() - 1));
|
&boost::unit_test::framework::master_test_suite().argv[boost::unit_test::framework::master_test_suite().argc],
|
||||||
} else {
|
[](const char* arg) {
|
||||||
BOOST_TEST_MESSAGE(s);
|
return std::string{"DEBUG_LOG_OUT"} == arg;
|
||||||
}
|
})};
|
||||||
|
if (!should_log) return;
|
||||||
|
std::cout << s;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,14 +7,6 @@ deadlock:WalletBatch
|
||||||
# Intentional deadlock in tests
|
# Intentional deadlock in tests
|
||||||
deadlock:TestPotentialDeadLockDetected
|
deadlock:TestPotentialDeadLockDetected
|
||||||
|
|
||||||
# Race due to unprotected calls to thread-unsafe BOOST_TEST_MESSAGE from different threads:
|
|
||||||
# * G_TEST_LOG_FUN in the index thread
|
|
||||||
# * boost test case invoker (entering a test case) in the main thread
|
|
||||||
# TODO: get rid of BOOST_ macros, see also https://github.com/bitcoin/bitcoin/issues/8670
|
|
||||||
race:blockfilter_index_initial_sync_invoker
|
|
||||||
race:txindex_initial_sync_invoker
|
|
||||||
race:validation_block_tests::TestSubscriber
|
|
||||||
|
|
||||||
# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
|
# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
|
||||||
race:src/qt/test/*
|
race:src/qt/test/*
|
||||||
deadlock:src/qt/test/*
|
deadlock:src/qt/test/*
|
||||||
|
|
Loading…
Reference in a new issue