Commit 8c8de084 by Sachin Basil John

Added check for number of cores in test task before affinity is checked

parent 3577c136
...@@ -78,13 +78,19 @@ void TaskTest::TestBasic() { ...@@ -78,13 +78,19 @@ void TaskTest::TestBasic() {
PT_EXPECT_EQ(policy.GetPriority(), 0u); PT_EXPECT_EQ(policy.GetPriority(), 0u);
policy.AddWorker(0u); policy.AddWorker(0u);
PT_EXPECT_EQ(policy.GetAffinity(), 1u); PT_EXPECT_EQ(policy.GetAffinity(), 1u);
if (policy.GetCoreCount() > 1) {
policy.AddWorker(1u); policy.AddWorker(1u);
PT_EXPECT_EQ(policy.GetAffinity(), 3u); PT_EXPECT_EQ(policy.GetAffinity(), 3u);
}
policy.RemoveWorker(0u); policy.RemoveWorker(0u);
PT_EXPECT_EQ(policy.GetAffinity(), 2u);
PT_EXPECT_EQ(policy.IsSetWorker(0), false); PT_EXPECT_EQ(policy.IsSetWorker(0), false);
PT_EXPECT_EQ(policy.IsSetWorker(1), true);
if (policy.GetCoreCount() > 1) {
PT_EXPECT_EQ(policy.GetAffinity(), 2u);
PT_EXPECT_EQ(policy.IsSetWorker(1), true);
}
std::string test; std::string test;
embb::tasks::Task task = node.Spawn( embb::tasks::Task task = node.Spawn(
embb::base::Bind( embb::base::Bind(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment