mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Remove flaky util thread unit tests
This commit is contained in:
parent
b45fd0a5a4
commit
b8e1dc2e53
@ -323,62 +323,4 @@ BOOST_AUTO_TEST_CASE(util_seed_insecure_rand)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nCounter = 0;
|
|
||||||
|
|
||||||
static void Count()
|
|
||||||
{
|
|
||||||
++nCounter;
|
|
||||||
MilliSleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CountWithArg(int arg)
|
|
||||||
{
|
|
||||||
nCounter += arg;
|
|
||||||
MilliSleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_loop_forever1)
|
|
||||||
{
|
|
||||||
boost::thread_group threadGroup;
|
|
||||||
|
|
||||||
threadGroup.create_thread(boost::bind(&LoopForever<void (*)()>, "count", &Count, 1));
|
|
||||||
MilliSleep(1);
|
|
||||||
threadGroup.interrupt_all();
|
|
||||||
BOOST_CHECK_EQUAL(nCounter, 1);
|
|
||||||
nCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_loop_forever2)
|
|
||||||
{
|
|
||||||
boost::thread_group threadGroup;
|
|
||||||
|
|
||||||
boost::function<void()> f = boost::bind(&CountWithArg, 11);
|
|
||||||
threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "count11", f, 11));
|
|
||||||
MilliSleep(1);
|
|
||||||
threadGroup.interrupt_all();
|
|
||||||
BOOST_CHECK_EQUAL(nCounter, 11);
|
|
||||||
nCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_threadtrace1)
|
|
||||||
{
|
|
||||||
boost::thread_group threadGroup;
|
|
||||||
|
|
||||||
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "count11", &Count));
|
|
||||||
threadGroup.join_all();
|
|
||||||
BOOST_CHECK_EQUAL(nCounter, 1);
|
|
||||||
nCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_threadtrace2)
|
|
||||||
{
|
|
||||||
boost::thread_group threadGroup;
|
|
||||||
|
|
||||||
boost::function<void()> f = boost::bind(&CountWithArg, 11);
|
|
||||||
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "count11", f));
|
|
||||||
threadGroup.join_all();
|
|
||||||
BOOST_CHECK_EQUAL(nCounter, 11);
|
|
||||||
nCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user