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

Function test_affinity_errors

tests/system_test/affinity_test.cpp:186–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184// ===========================================================================
185
186void test_affinity_errors(void* /*arg*/) {
187 klog::Info("=== Affinity Errors Test ===");
188
189 bool passed = true;
190 uint64_t mask = 0;
191
192 // Invalid PID should return -1
193 int ret = sys_sched_getaffinity(99999, sizeof(uint64_t), &mask);
194 if (ret != -1) {
195 klog::Err(
196 "test_affinity_errors: getaffinity(pid=99999) returned {}, "
197 "expected -1",
198 ret);
199 passed = false;
200 }
201
202 // Too-small cpusetsize should return -1
203 ret = sys_sched_getaffinity(0, 1, &mask);
204 if (ret != -1) {
205 klog::Err(
206 "test_affinity_errors: getaffinity(cpusetsize=1) returned {}, "
207 "expected -1",
208 ret);
209 passed = false;
210 }
211
212 if (passed) {
213 klog::Info("Affinity Errors Test: PASSED");
214 } else {
215 klog::Err("Affinity Errors Test: FAILED");
216 g_tests_failed++;
217 }
218
219 g_tests_completed++;
220 sys_exit(passed ? 0 : 1);
221}
222
223} // namespace
224

Callers

nothing calls this directly

Calls 4

InfoFunction · 0.85
sys_sched_getaffinityFunction · 0.85
ErrFunction · 0.85
sys_exitFunction · 0.85

Tested by

no test coverage detected