Bitcoin Core  24.99.0
P2P Digital Currency
Classes | Typedefs | Functions | Variables
checkqueue_tests.cpp File Reference
#include <checkqueue.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <util/system.h>
#include <util/time.h>
#include <boost/test/unit_test.hpp>
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <thread>
#include <unordered_set>
#include <utility>
#include <vector>
Include dependency graph for checkqueue_tests.cpp:

Go to the source code of this file.

Classes

struct  NoLockLoggingTestingSetup
 Identical to TestingSetup but excludes lock contention logging if DEBUG_LOCKCONTENTION is defined, as some of these tests are designed to be heavily contested to trigger race conditions or other issues. More...
 
struct  FakeCheck
 
struct  FakeCheckCheckCompletion
 
struct  FailingCheck
 
struct  UniqueCheck
 
struct  MemoryCheck
 
struct  FrozenCleanupCheck
 

Typedefs

typedef CCheckQueue< FakeCheckCheckCompletionCorrect_Queue
 
typedef CCheckQueue< FakeCheckStandard_Queue
 
typedef CCheckQueue< FailingCheckFailing_Queue
 
typedef CCheckQueue< UniqueCheckUnique_Queue
 
typedef CCheckQueue< MemoryCheckMemory_Queue
 
typedef CCheckQueue< FrozenCleanupCheckFrozenCleanup_Queue
 

Functions

static void Correct_Queue_range (std::vector< size_t > range)
 This test case checks that the CCheckQueue works properly with each specified size_t Checks pushed. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Correct_Zero)
 Test that 0 checks is correct. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Correct_One)
 Test that 1 check is correct. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Correct_Max)
 Test that MAX check is correct. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Correct_Random)
 Test that random numbers of checks are correct. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Catches_Failure)
 Test that failing checks are caught. More...
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Recovers_From_Failure)
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_UniqueCheck)
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_Memory)
 
 BOOST_AUTO_TEST_CASE (test_CheckQueue_FrozenCleanup)
 
 BOOST_AUTO_TEST_CASE (test_CheckQueueControl_Locks)
 Test that CCheckQueueControl is threadsafe. More...
 

Variables

static const unsigned int QUEUE_BATCH_SIZE = 128
 
static const int SCRIPT_CHECK_THREADS = 3
 

Typedef Documentation

◆ Correct_Queue

Definition at line 158 of file checkqueue_tests.cpp.

◆ Failing_Queue

Definition at line 160 of file checkqueue_tests.cpp.

◆ FrozenCleanup_Queue

Definition at line 163 of file checkqueue_tests.cpp.

◆ Memory_Queue

Definition at line 162 of file checkqueue_tests.cpp.

◆ Standard_Queue

Definition at line 159 of file checkqueue_tests.cpp.

◆ Unique_Queue

Definition at line 161 of file checkqueue_tests.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Catches_Failure  )

Test that failing checks are caught.

Definition at line 229 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Correct_Max  )

Test that MAX check is correct.

Definition at line 210 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Correct_One  )

Test that 1 check is correct.

Definition at line 202 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Correct_Random  )

Test that random numbers of checks are correct.

Definition at line 218 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Correct_Zero  )

Test that 0 checks is correct.

Definition at line 194 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_FrozenCleanup  )

Definition at line 343 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Memory  )

Definition at line 316 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_Recovers_From_Failure  )

Definition at line 257 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueue_UniqueCheck  )

Definition at line 281 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/10]

BOOST_AUTO_TEST_CASE ( test_CheckQueueControl_Locks  )

Test that CCheckQueueControl is threadsafe.

Definition at line 383 of file checkqueue_tests.cpp.

Here is the call graph for this function:

◆ Correct_Queue_range()

static void Correct_Queue_range ( std::vector< size_t >  range)
static

This test case checks that the CCheckQueue works properly with each specified size_t Checks pushed.

Definition at line 169 of file checkqueue_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ QUEUE_BATCH_SIZE

const unsigned int QUEUE_BATCH_SIZE = 128
static

Definition at line 37 of file checkqueue_tests.cpp.

◆ SCRIPT_CHECK_THREADS

const int SCRIPT_CHECK_THREADS = 3
static

Definition at line 38 of file checkqueue_tests.cpp.