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

Function pc_fixture_open

tests/test_pipeline_conventions.c:87–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 return ok;
86}
87static bool pc_fixture_open(pc_fixture_t *f, bool parallel) {
88 memset(f, 0, sizeof(*f));
89 const char *home = th_mktempdir("cbm-pipeline-conventions");
90 if (!home || strlen(home) >= sizeof(f->home)) return false;
91 memcpy(f->home, home, strlen(home) + 1);
92 bool ok = pc_path(f->repo, sizeof(f->repo), home, "repo") &&
93 pc_path(f->db, sizeof(f->db), home, "published.db") &&
94 pc_path(f->saved, sizeof(f->saved), home, "saved.db") &&
95 pc_path(f->config, sizeof(f->config), f->repo, ".codebase-memory.json") &&
96 th_mkdir_p(f->repo) == 0 &&
97 pc_source_write(f, "aux.c", "void auxiliary(void) {}\n");
98 /* The existing full driver needs >50 filtered files as well as >1 worker. */
99 for (int i = 0; ok && parallel && i < 51; i++) {
100 char leaf[40], body[80];
101 int a = snprintf(leaf, sizeof(leaf), "filler_%02d.c", i);
102 int b = snprintf(body, sizeof(body), "void filler_%02d(void) {}\n", i);
103 ok = a > 0 && (size_t)a < sizeof(leaf) && b > 0 && (size_t)b < sizeof(body) &&
104 pc_source_write(f, leaf, body);
105 }
106 if (!ok) { (void)th_rmtree(f->home); f->home[0] = '\0'; }
107 return ok;
108}
109static bool pc_env_restore(pc_env_t *env) {
110 bool ok = true;
111 if (!env->saved) return true;

Callers 3

pc_configured_caseFunction · 0.85
pc_typed_degradeFunction · 0.85

Calls 5

th_mktempdirFunction · 0.85
pc_pathFunction · 0.85
th_mkdir_pFunction · 0.85
pc_source_writeFunction · 0.85
th_rmtreeFunction · 0.85

Tested by

no test coverage detected