From 08a66f52d3b4a69ebf8262f78c4db84a7e33963d Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sat, 6 Oct 2018 11:05:45 +0200 Subject: [PATCH] Add option --pool-threads for easier testing --- tests/thread/parallel_tests.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/thread/parallel_tests.cpp b/tests/thread/parallel_tests.cpp index 144175b..ddd04ed 100644 --- a/tests/thread/parallel_tests.cpp +++ b/tests/thread/parallel_tests.cpp @@ -33,6 +33,21 @@ #include #include +struct thread_config { + thread_config() { + for( int i = 0; i < boost::unit_test::framework::master_test_suite().argc - 1; ++i ) + if( !strcmp( boost::unit_test::framework::master_test_suite().argv[i], "--pool-threads" ) ) + { + uint16_t threads = atoi(boost::unit_test::framework::master_test_suite().argv[++i]); + std::cout << "Using " << threads << " pool threads\n"; + fc::asio::default_io_service_scope::set_num_threads(threads); + } + } +}; + +BOOST_GLOBAL_FIXTURE( thread_config ); + + BOOST_AUTO_TEST_SUITE(parallel_tests) BOOST_AUTO_TEST_CASE( do_nothing_parallel )