Bitcoin Core 30.99.0
P2P Digital Currency
Classes | Macros | Functions | Variables
threadpool_tests.cpp File Reference
#include <common/system.h>
#include <logging.h>
#include <random.h>
#include <util/string.h>
#include <util/threadpool.h>
#include <util/time.h>
#include <boost/test/unit_test.hpp>
Include dependency graph for threadpool_tests.cpp:

Go to the source code of this file.

Classes

struct  ThreadPoolFixture
 

Macros

#define WAIT_FOR(futures)
 

Functions

std::vector< std::future< void > > BlockWorkers (ThreadPool &threadPool, const std::shared_future< void > &blocker_future, int num_of_threads_to_block)
 
 BOOST_AUTO_TEST_CASE (submit_task_before_start_fails)
 
 BOOST_AUTO_TEST_CASE (submit_tasks_complete_successfully)
 
 BOOST_AUTO_TEST_CASE (single_available_worker_executes_all_tasks)
 
 BOOST_AUTO_TEST_CASE (wait_for_task_to_finish)
 
 BOOST_AUTO_TEST_CASE (get_result_from_completed_task)
 
 BOOST_AUTO_TEST_CASE (task_exception_propagates_to_future)
 
 BOOST_AUTO_TEST_CASE (process_tasks_manually_when_workers_busy)
 
 BOOST_AUTO_TEST_CASE (recursive_task_submission)
 
 BOOST_AUTO_TEST_CASE (task_submitted_while_busy_completes)
 
 BOOST_AUTO_TEST_CASE (congestion_more_workers_than_cores)
 
 BOOST_AUTO_TEST_CASE (interrupt_blocks_new_submissions)
 

Variables

int NUM_WORKERS_DEFAULT = 0
 
constexpr char POOL_NAME [] = "test"
 
constexpr auto WAIT_TIMEOUT = 120s
 

Macro Definition Documentation

◆ WAIT_FOR

#define WAIT_FOR (   futures)
Value:
do { \
for (const auto& f : futures) { \
BOOST_REQUIRE(f.wait_for(WAIT_TIMEOUT) == std::future_status::ready); \
} \
} while (0)
constexpr auto WAIT_TIMEOUT

Definition at line 40 of file threadpool_tests.cpp.

Function Documentation

◆ BlockWorkers()

std::vector< std::future< void > > BlockWorkers ( ThreadPool threadPool,
const std::shared_future< void > &  blocker_future,
int  num_of_threads_to_block 
)

Definition at line 49 of file threadpool_tests.cpp.

Here is the caller graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/11]

BOOST_AUTO_TEST_CASE ( congestion_more_workers_than_cores  )

Definition at line 272 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/11]

BOOST_AUTO_TEST_CASE ( get_result_from_completed_task  )

Definition at line 150 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/11]

BOOST_AUTO_TEST_CASE ( interrupt_blocks_new_submissions  )

Definition at line 293 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/11]

BOOST_AUTO_TEST_CASE ( process_tasks_manually_when_workers_busy  )

Definition at line 187 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/11]

BOOST_AUTO_TEST_CASE ( recursive_task_submission  )

Definition at line 219 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/11]

BOOST_AUTO_TEST_CASE ( single_available_worker_executes_all_tasks  )

Definition at line 108 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/11]

BOOST_AUTO_TEST_CASE ( submit_task_before_start_fails  )

Definition at line 73 of file threadpool_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [8/11]

BOOST_AUTO_TEST_CASE ( submit_tasks_complete_successfully  )

Definition at line 83 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/11]

BOOST_AUTO_TEST_CASE ( task_exception_propagates_to_future  )

Definition at line 163 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/11]

BOOST_AUTO_TEST_CASE ( task_submitted_while_busy_completes  )

Definition at line 236 of file threadpool_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/11]

BOOST_AUTO_TEST_CASE ( wait_for_task_to_finish  )

Definition at line 136 of file threadpool_tests.cpp.

Here is the call graph for this function:

Variable Documentation

◆ NUM_WORKERS_DEFAULT

int NUM_WORKERS_DEFAULT = 0

Definition at line 15 of file threadpool_tests.cpp.

◆ POOL_NAME

constexpr char POOL_NAME[] = "test"
constexpr

Definition at line 16 of file threadpool_tests.cpp.

◆ WAIT_TIMEOUT

constexpr auto WAIT_TIMEOUT = 120s
constexpr

Definition at line 17 of file threadpool_tests.cpp.