mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 7d14e35f3f into merged_master (Bitcoin PR #17342)
This commit is contained in:
commit
3f2190d870
5 changed files with 40 additions and 30 deletions
|
|
@ -5,7 +5,6 @@
|
|||
#include <util/memory.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
#include <checkqueue.h>
|
||||
|
|
@ -19,11 +18,10 @@
|
|||
|
||||
#include <unordered_set>
|
||||
|
||||
// BasicTestingSetup not sufficient because nScriptCheckThreads is not set
|
||||
// otherwise.
|
||||
BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, TestingSetup)
|
||||
|
||||
static const unsigned int QUEUE_BATCH_SIZE = 128;
|
||||
static const int SCRIPT_CHECK_THREADS = 3;
|
||||
|
||||
struct FakeCheck {
|
||||
bool operator()()
|
||||
|
|
@ -149,7 +147,7 @@ static void Correct_Queue_range(std::vector<size_t> range)
|
|||
{
|
||||
auto small_queue = MakeUnique<Correct_Queue>(QUEUE_BATCH_SIZE);
|
||||
boost::thread_group tg;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{small_queue->Thread();});
|
||||
}
|
||||
// Make vChecks here to save on malloc (this test can be slow...)
|
||||
|
|
@ -217,7 +215,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure)
|
|||
auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
|
||||
|
||||
boost::thread_group tg;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{fail_queue->Thread();});
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +247,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure)
|
|||
{
|
||||
auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
|
||||
boost::thread_group tg;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{fail_queue->Thread();});
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +277,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck)
|
|||
{
|
||||
auto queue = MakeUnique<Unique_Queue>(QUEUE_BATCH_SIZE);
|
||||
boost::thread_group tg;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{queue->Thread();});
|
||||
|
||||
}
|
||||
|
|
@ -316,7 +314,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory)
|
|||
{
|
||||
auto queue = MakeUnique<Memory_Queue>(QUEUE_BATCH_SIZE);
|
||||
boost::thread_group tg;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{queue->Thread();});
|
||||
}
|
||||
for (size_t i = 0; i < 1000; ++i) {
|
||||
|
|
@ -348,7 +346,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
|
|||
auto queue = MakeUnique<FrozenCleanup_Queue>(QUEUE_BATCH_SIZE);
|
||||
boost::thread_group tg;
|
||||
bool fails = false;
|
||||
for (auto x = 0; x < nScriptCheckThreads; ++x) {
|
||||
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
|
||||
tg.create_thread([&]{queue->Thread();});
|
||||
}
|
||||
std::thread t0([&]() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue