MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fixture

Function fixture

tests/test_coverage_parent_failure.c:248–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248static int fixture(const char *test) {
249 Fixture f = {.pid = -1, .ack = {-1, -1}, .gate = {-1, -1}};
250 const char *root = getenv("CBM_TEST_COVERAGE_DIR");
251 if (!root || root[0] != '/' || !tf_current_suite)
252 return 1;
253 struct sigaction ignore = {.sa_handler = SIG_IGN}, previous;
254 (void)sigemptyset(&ignore.sa_mask);
255 if (sigaction(SIGPIPE, &ignore, &previous) != 0)
256 return 1;
257 bool ok = setup(&f, root) && launch(&f) && observe_and_release(&f, root, test);
258 if (f.parent_restore_pending && !restore_parent(&f))
259 ok = false;
260 if (!reap(&f, true))
261 ok = false;
262 if (!close_fd(&f.ack[0]))
263 ok = false;
264 if (!close_fd(&f.ack[1]))
265 ok = false;
266 if (!close_fd(&f.gate[0]))
267 ok = false;
268 if (!close_fd(&f.gate[1]))
269 ok = false;
270 if (sigaction(SIGPIPE, &previous, NULL) != 0)
271 ok = false;
272 if (!ok || f.parent_restore_failed)
273 fprintf(stderr, "coverage parent fixture failed: native protocol or restoration\n");
274 if (f.parent_restore_failed) {
275 (void)fflush(stderr);
276 _Exit(2); /* Never continue the runner with an unverified parent limit. */
277 }
278 return ok ? 0 : 1;
279}
280
281TEST(coverage_marker_creation) {
282 fixture_entered = true;

Callers 1

Calls 8

observe_and_releaseFunction · 0.85
restore_parentFunction · 0.85
_ExitFunction · 0.85
sigactionClass · 0.70
setupFunction · 0.70
launchFunction · 0.70
reapFunction · 0.70
close_fdFunction · 0.70

Tested by

no test coverage detected