mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
Merge #19028: test: Set -logthreadnames in unit tests
99993489da
test: Set -logthreadnames in unit tests (MarcoFalke)fa4ea997b4
init: Setup scheduler in tests and init in exactly the same way (MarcoFalke) Pull request description: Generally the unit tests are single threaded, with the exception of the script check threads, the schedule, and optionally indexer threads. Like the functional tests, the thread name can serve additional debug information, so set `-logthreadnames` in unit tests. Can be tested with ``` ./src/test/test_bitcoin -l test_suite -t validation_tests/test_combiner_all -- DEBUG_LOG_OUT ACKs for top commit: laanwj: ACK99993489da
Tree-SHA512: 3bdbfc211da146da64b50b0826246aff5c611a84b69ab896a55b3c9d1adc92c5975da36ab92aee577df82e229c4326b477f4105bfdd1a5df4c9a0b018cf61602
This commit is contained in:
commit
e1b20e2285
3 changed files with 4 additions and 5 deletions
|
@ -1317,8 +1317,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
|
|||
node.scheduler = MakeUnique<CScheduler>();
|
||||
|
||||
// Start the lightweight task scheduler thread
|
||||
CScheduler::Function serviceLoop = [&node]{ node.scheduler->serviceQueue(); };
|
||||
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
|
||||
threadGroup.create_thread([&] { TraceThread("scheduler", [&] { node.scheduler->serviceQueue(); }); });
|
||||
|
||||
// Gather some entropy once per minute.
|
||||
node.scheduler->scheduleEvery([]{
|
||||
|
|
|
@ -75,11 +75,13 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
|
|||
"dummy",
|
||||
"-printtoconsole=0",
|
||||
"-logtimemicros",
|
||||
"-logthreadnames",
|
||||
"-debug",
|
||||
"-debugexclude=libevent",
|
||||
"-debugexclude=leveldb",
|
||||
},
|
||||
extra_args);
|
||||
util::ThreadRename("test");
|
||||
fs::create_directories(m_path_root);
|
||||
gArgs.ForceSetArg("-datadir", m_path_root.string());
|
||||
ClearDatadirCache();
|
||||
|
@ -130,7 +132,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
|||
|
||||
// We have to run a scheduler thread to prevent ActivateBestChain
|
||||
// from blocking due to queue overrun.
|
||||
threadGroup.create_thread([&]{ m_node.scheduler->serviceQueue(); });
|
||||
threadGroup.create_thread([&] { TraceThread("scheduler", [&] { m_node.scheduler->serviceQueue(); }); });
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler);
|
||||
|
||||
pblocktree.reset(new CBlockTreeDB(1 << 20, true));
|
||||
|
|
|
@ -53,8 +53,6 @@ std::set<std::string> RenameEnMasse(int num_threads)
|
|||
*/
|
||||
BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(util::ThreadGetInternalName(), "");
|
||||
|
||||
#if !defined(HAVE_THREAD_LOCAL)
|
||||
// This test doesn't apply to platforms where we don't have thread_local.
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue