Skip to content

Commit d995762

Browse files
committed
[tests] Don't use TestingSetup in the checkqueue_tests
It's only needed for a hardcoded int, which we can define locally.
1 parent bc3fcf3 commit d995762

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/test/checkqueue_tests.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <util/memory.h>
66
#include <util/system.h>
77
#include <util/time.h>
8-
#include <validation.h>
98

109
#include <test/setup_common.h>
1110
#include <checkqueue.h>
@@ -19,11 +18,10 @@
1918

2019
#include <unordered_set>
2120

22-
// BasicTestingSetup not sufficient because nScriptCheckThreads is not set
23-
// otherwise.
2421
BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, TestingSetup)
2522

2623
static const unsigned int QUEUE_BATCH_SIZE = 128;
24+
static const int SCRIPT_CHECK_THREADS = 3;
2725

2826
struct FakeCheck {
2927
bool operator()()
@@ -149,7 +147,7 @@ static void Correct_Queue_range(std::vector<size_t> range)
149147
{
150148
auto small_queue = MakeUnique<Correct_Queue>(QUEUE_BATCH_SIZE);
151149
boost::thread_group tg;
152-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
150+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
153151
tg.create_thread([&]{small_queue->Thread();});
154152
}
155153
// Make vChecks here to save on malloc (this test can be slow...)
@@ -214,7 +212,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure)
214212
auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
215213

216214
boost::thread_group tg;
217-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
215+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
218216
tg.create_thread([&]{fail_queue->Thread();});
219217
}
220218

@@ -246,7 +244,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure)
246244
{
247245
auto fail_queue = MakeUnique<Failing_Queue>(QUEUE_BATCH_SIZE);
248246
boost::thread_group tg;
249-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
247+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
250248
tg.create_thread([&]{fail_queue->Thread();});
251249
}
252250

@@ -274,7 +272,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck)
274272
{
275273
auto queue = MakeUnique<Unique_Queue>(QUEUE_BATCH_SIZE);
276274
boost::thread_group tg;
277-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
275+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
278276
tg.create_thread([&]{queue->Thread();});
279277

280278
}
@@ -310,7 +308,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory)
310308
{
311309
auto queue = MakeUnique<Memory_Queue>(QUEUE_BATCH_SIZE);
312310
boost::thread_group tg;
313-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
311+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
314312
tg.create_thread([&]{queue->Thread();});
315313
}
316314
for (size_t i = 0; i < 1000; ++i) {
@@ -342,7 +340,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
342340
auto queue = MakeUnique<FrozenCleanup_Queue>(QUEUE_BATCH_SIZE);
343341
boost::thread_group tg;
344342
bool fails = false;
345-
for (auto x = 0; x < nScriptCheckThreads; ++x) {
343+
for (auto x = 0; x < SCRIPT_CHECK_THREADS; ++x) {
346344
tg.create_thread([&]{queue->Thread();});
347345
}
348346
std::thread t0([&]() {

0 commit comments

Comments
 (0)