Skip to content

Commit

Permalink
Re #7218. Try to make tests more robust to slow thread startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Jun 4, 2013
1 parent 4f65381 commit e1f19e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Code/Mantid/Framework/DataHandling/test/MonitorLiveDataTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class MonitorLiveDataTest : public CxxTest::TestSuite
{
IAlgorithm_sptr alg1 = makeAlgo("fake1");
Poco::ActiveResult<bool> res1 = alg1->executeAsync();
Poco::Thread::sleep(100); // give it some time to start
while ( !alg1->isRunning() )
{
Poco::Thread::sleep(10); // give it some time to start
}

// This algorithm dies because another thread has the same output
boost::shared_ptr<MonitorLiveData> alg2 = makeAlgo("fake1");
Expand All @@ -97,7 +100,10 @@ class MonitorLiveDataTest : public CxxTest::TestSuite
{
IAlgorithm_sptr alg1 = makeAlgo("fake1", "accum1");
Poco::ActiveResult<bool> res1 = alg1->executeAsync();
Poco::Thread::sleep(100); // give it some time to start
while ( !alg1->isRunning() )
{
Poco::Thread::sleep(10); // give it some time to start
}

// This algorithm dies because another thread has the same output
boost::shared_ptr<MonitorLiveData> alg2 = makeAlgo("fake2", "accum1");
Expand All @@ -114,7 +120,10 @@ class MonitorLiveDataTest : public CxxTest::TestSuite
// Start and stop one algorithm
IAlgorithm_sptr alg1 = makeAlgo("fake1");
Poco::ActiveResult<bool> res1 = alg1->executeAsync();
Poco::Thread::sleep(100); // give it some time to start
while ( !alg1->isRunning() )
{
Poco::Thread::sleep(10); // give it some time to start
}
alg1->cancel();
res1.wait(10000);

Expand Down

0 comments on commit e1f19e7

Please sign in to comment.