326 {
328
329 g_tests_completed = 0;
330 g_tests_failed = 0;
331
332 auto& task_mgr = TaskManagerSingleton::instance();
333
334
335 auto test1 = kstd::make_unique<TaskControlBlock>("TestWaitBasic", 10,
336 test_wait_basic, nullptr);
337 task_mgr.AddTask(std::move(test1));
338
339
340 auto test2 = kstd::make_unique<TaskControlBlock>(
341 "TestWaitAnyChild", 10, test_wait_any_child, nullptr);
342 task_mgr.AddTask(std::move(test2));
343
344
345 auto test3 = kstd::make_unique<TaskControlBlock>("TestWaitNoHang", 10,
346 test_wait_no_hang, nullptr);
347 task_mgr.AddTask(std::move(test3));
348
349
350 auto test4 = kstd::make_unique<TaskControlBlock>(
351 "TestWaitProcessGroup", 10, test_wait_process_group, nullptr);
352 task_mgr.AddTask(std::move(test4));
353
354
355 auto test5 = kstd::make_unique<TaskControlBlock>(
356 "TestWaitZombieReap", 10, test_wait_zombie_reap, nullptr);
357 task_mgr.AddTask(std::move(test5));
358
359
360 constexpr int kExpectedTests = 5;
361 int timeout = 400;
362 while (timeout > 0) {
364 if (g_tests_completed >= kExpectedTests) {
365 break;
366 }
367 timeout--;
368 }
369
370 EXPECT_EQ(g_tests_completed.load(), kExpectedTests,
371 "All wait tests should complete");
372 EXPECT_EQ(g_tests_failed.load(), 0,
"No wait tests should fail");
373
374 klog::Info(
"Wait System Test Suite: COMPLETED");
375 return true;
376}
auto Info(etl::format_string< Args... > fmt, Args &&... args) -> void
以 INFO 级别记录日志
auto sys_sleep(uint64_t ms) -> int
休眠指定毫秒数
#define EXPECT_EQ(val1, val2, msg)