|
5 | 5 | #include <util/memory.h>
|
6 | 6 | #include <util/system.h>
|
7 | 7 | #include <util/time.h>
|
8 |
| -#include <validation.h> |
9 | 8 |
|
10 | 9 | #include <test/setup_common.h>
|
11 | 10 | #include <checkqueue.h>
|
|
19 | 18 |
|
20 | 19 | #include <unordered_set>
|
21 | 20 |
|
22 |
| -// BasicTestingSetup not sufficient because nScriptCheckThreads is not set |
23 |
| -// otherwise. |
24 | 21 | BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, TestingSetup)
|
25 | 22 |
|
26 | 23 | static const unsigned int QUEUE_BATCH_SIZE = 128;
|
| 24 | +static const int SCRIPT_CHECK_THREADS = 3; |
27 | 25 |
|
28 | 26 | struct FakeCheck {
|
29 | 27 | bool operator()()
|
@@ -149,7 +147,7 @@ static void Correct_Queue_range(std::vector<size_t> range)
|
149 | 147 | {
|
150 | 148 | auto small_queue = MakeUnique<Correct_Queue>(QUEUE_BATCH_SIZE);
|
151 | 149 | boost::thread_group tg;
|
152 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 150 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
153 | 151 | tg.create_thread([&]{small_queue->Thread();});
|
154 | 152 | }
|
155 | 153 | // Make vChecks here to save on malloc (this test can be slow...)
|
@@ -214,7 +212,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure)
|
214 | 212 | auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
|
215 | 213 |
|
216 | 214 | boost::thread_group tg;
|
217 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 215 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
218 | 216 | tg.create_thread([&]{fail_queue->Thread();});
|
219 | 217 | }
|
220 | 218 |
|
@@ -246,7 +244,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure)
|
246 | 244 | {
|
247 | 245 | auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
|
248 | 246 | boost::thread_group tg;
|
249 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 247 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
250 | 248 | tg.create_thread([&]{fail_queue->Thread();});
|
251 | 249 | }
|
252 | 250 |
|
@@ -274,7 +272,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck)
|
274 | 272 | {
|
275 | 273 | auto queue = MakeUnique<Unique_Queue>(QUEUE_BATCH_SIZE);
|
276 | 274 | boost::thread_group tg;
|
277 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 275 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
278 | 276 | tg.create_thread([&]{queue->Thread();});
|
279 | 277 |
|
280 | 278 | }
|
@@ -310,7 +308,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory)
|
310 | 308 | {
|
311 | 309 | auto queue = MakeUnique<Memory_Queue>(QUEUE_BATCH_SIZE);
|
312 | 310 | boost::thread_group tg;
|
313 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 311 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
314 | 312 | tg.create_thread([&]{queue->Thread();});
|
315 | 313 | }
|
316 | 314 | for (size_t i = 0; i < 1000; ++i) {
|
@@ -342,7 +340,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
|
342 | 340 | auto queue = MakeUnique<FrozenCleanup_Queue>(QUEUE_BATCH_SIZE);
|
343 | 341 | boost::thread_group tg;
|
344 | 342 | bool fails = false;
|
345 |
| - for (auto x = 0; x < nScriptCheckThreads; ++x) { |
| 343 | + for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) { |
346 | 344 | tg.create_thread([&]{queue->Thread();});
|
347 | 345 | }
|
348 | 346 | std::thread t0([&]() {
|
|
0 commit comments