SimpleKernel 1.17.0
Loading...
Searching...
No Matches
clone_system_test.cpp File Reference
#include <cpu_io.h>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include "arch.h"
#include "basic_info.hpp"
#include "kernel.h"
#include "kstd_cstdio"
#include "kstd_cstring"
#include "kstd_libcxx.h"
#include "kstd_memory"
#include "sk_stdlib.h"
#include "syscall.hpp"
#include "system_test.h"
#include "task_control_block.hpp"
#include "task_manager.hpp"
Include dependency graph for clone_system_test.cpp:

Go to the source code of this file.

Functions

auto clone_system_test () -> bool
 

Function Documentation

◆ clone_system_test()

auto clone_system_test ( ) -> bool

Definition at line 425 of file clone_system_test.cpp.

425 {
426 klog::Info("===== Clone System Test Start =====");
427
428 g_tests_completed = 0;
429 g_tests_failed = 0;
430
431 auto& task_mgr = TaskManagerSingleton::instance();
432
433 auto test1 = kstd::make_unique<TaskControlBlock>("TestCloneProcess", 10,
434 test_clone_process, nullptr);
435 task_mgr.AddTask(std::move(test1));
436
437 auto test2 = kstd::make_unique<TaskControlBlock>("TestCloneThread", 10,
438 test_clone_thread, nullptr);
439 task_mgr.AddTask(std::move(test2));
440
441 auto test3 = kstd::make_unique<TaskControlBlock>(
442 "TestCloneParentFlag", 10, test_clone_parent_flag, nullptr);
443 task_mgr.AddTask(std::move(test3));
444
445 auto test4 = kstd::make_unique<TaskControlBlock>(
446 "TestCloneFlagsAutoCompletion", 10, test_clone_flags_auto_completion,
447 nullptr);
448 task_mgr.AddTask(std::move(test4));
449
450 int timeout = 200;
451 while (timeout > 0) {
452 (void)sys_sleep(50);
453 if (g_tests_completed >= 4) {
454 break;
455 }
456 timeout--;
457 }
458
459 EXPECT_EQ(g_tests_completed, 4, "tests completed");
460 EXPECT_EQ(g_tests_failed, 0, "tests failed");
461
462 klog::Info("Clone System Test Suite: COMPLETED");
463 return true;
464}
auto Info(etl::format_string< Args... > fmt, Args &&... args) -> void
以 INFO 级别记录日志
auto sys_sleep(uint64_t ms) -> int
休眠指定毫秒数
Definition syscall.cpp:90
#define EXPECT_EQ(val1, val2, msg)
Here is the call graph for this function: