MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / affinity_test

Function affinity_test

tests/system_test/affinity_test.cpp:225–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223} // namespace
224
225auto affinity_test() -> bool {
226 klog::Info("===== Affinity System Test Start =====");
227
228 g_tests_completed = 0;
229 g_tests_failed = 0;
230
231 auto& task_mgr = TaskManagerSingleton::instance();
232
233 auto test1 = kstd::make_unique<TaskControlBlock>(
234 "TestAffinityGetSelf", 10, test_affinity_get_self, nullptr);
235 task_mgr.AddTask(std::move(test1));
236
237 auto test2 = kstd::make_unique<TaskControlBlock>(
238 "TestAffinitySetGet", 10, test_affinity_set_get, nullptr);
239 task_mgr.AddTask(std::move(test2));
240
241 auto test3 = kstd::make_unique<TaskControlBlock>(
242 "TestAffinityOther", 10, test_affinity_other_task, nullptr);
243 task_mgr.AddTask(std::move(test3));
244
245 auto test4 = kstd::make_unique<TaskControlBlock>(
246 "TestAffinityErrors", 10, test_affinity_errors, nullptr);
247 task_mgr.AddTask(std::move(test4));
248
249 int timeout = 200;
250 while (timeout > 0) {
251 (void)sys_sleep(50);
252 if (g_tests_completed >= 4) {
253 break;
254 }
255 timeout--;
256 }
257
258 EXPECT_EQ(g_tests_completed, 4, "tests completed");
259 EXPECT_EQ(g_tests_failed, 0, "tests failed");
260
261 klog::Info("Affinity System Test Suite: COMPLETED");
262 return true;
263}

Callers

nothing calls this directly

Calls 3

InfoFunction · 0.85
sys_sleepFunction · 0.85
AddTaskMethod · 0.80

Tested by

no test coverage detected