// run on just the target CPU void testAffinity2(boost::scoped_ptr<TestPeriodic>& run, boost::scoped_ptr<Activity>& t, int targetCPU) { bool r = false; t->run( run.get() ); BOOST_CHECK(t->setCpuAffinity(1 << targetCPU)); BOOST_CHECK_EQUAL((1 << targetCPU), t->getCpuAffinity()); if ( t->getScheduler() == os::HighestPriority) { r = t->start(); BOOST_CHECK_MESSAGE( r, "Failed to start Thread"); r = t->stop(); BOOST_CHECK_MESSAGE( r, "Failed to stop Thread"); BOOST_CHECK_MESSAGE( run->stepped == true, "Step not executed" ); BOOST_CHECK_EQUAL(targetCPU, run->cpu); BOOST_CHECK_LT(0, run->succ); run->reset(); } BOOST_CHECK_EQUAL(0, run->cpu); r = t->start(); BOOST_CHECK_MESSAGE( r, "Failed to start Thread"); sleep(1); r = t->stop(); BOOST_CHECK_MESSAGE( r, "Failed to stop Thread" ); BOOST_CHECK_MESSAGE( run->stepped == true, "Step not executed" ); BOOST_CHECK_EQUAL(targetCPU, run->cpu); BOOST_CHECK_LT(0, run->succ); t->run(0); }