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

Function fork_test

tests/system_test/fork_test.cpp:157–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155} // namespace
156
157auto fork_test() -> bool {
158 klog::Info("===== Fork System Test Start =====");
159 g_tests_completed = 0;
160 g_tests_failed = 0;
161
162 auto& tm = TaskManagerSingleton::instance();
163
164 auto t1 = kstd::make_unique<TaskControlBlock>("TestForkBasic", 10,
165 test_fork_basic, nullptr);
166 tm.AddTask(std::move(t1));
167
168 auto t2 = kstd::make_unique<TaskControlBlock>("TestForkMultiple", 10,
169 test_fork_multiple, nullptr);
170 tm.AddTask(std::move(t2));
171
172 int timeout = 200;
173 while (timeout-- > 0 && g_tests_completed.load() < 2) {
174 (void)sys_sleep(50);
175 }
176
177 EXPECT_EQ(g_tests_completed.load(), 2, "All fork tests completed");
178 EXPECT_EQ(g_tests_failed.load(), 0, "No fork tests failed");
179
180 klog::Info("Fork System Test: COMPLETED");
181 return true;
182}

Callers

nothing calls this directly

Calls 3

InfoFunction · 0.85
sys_sleepFunction · 0.85
AddTaskMethod · 0.80

Tested by

no test coverage detected