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

Function compare_graphs_fixture_open

tests/test_mcp.c:18669–18694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18667}
18668
18669static bool compare_graphs_fixture_open(compare_graphs_fixture_t *fixture) {
18670 memset(fixture, 0, sizeof(*fixture));
18671 snprintf(fixture->cache, sizeof(fixture->cache), "%s/cbm-compare-525-XXXXXX", cbm_tmpdir());
18672 if (!cbm_mkdtemp(fixture->cache)) {
18673 return false;
18674 }
18675 const char *saved = getenv("CBM_CACHE_DIR");
18676 fixture->saved_cache = saved ? strdup(saved) : NULL;
18677 if ((saved && !fixture->saved_cache) || cbm_setenv("CBM_CACHE_DIR", fixture->cache, 1) != 0) {
18678 free(fixture->saved_cache);
18679 fixture->saved_cache = NULL;
18680 (void)th_rmtree(fixture->cache);
18681 return false;
18682 }
18683 snprintf(fixture->base_path, sizeof(fixture->base_path), "%s/base525.db", fixture->cache);
18684 snprintf(fixture->target_path, sizeof(fixture->target_path), "%s/target525.db", fixture->cache);
18685 if (!compare_write_fixture_store(fixture->base_path, "base525", false) ||
18686 !compare_write_fixture_store(fixture->target_path, "target525", true)) {
18687 restore_cache_dir(fixture->saved_cache);
18688 free(fixture->saved_cache);
18689 fixture->saved_cache = NULL;
18690 (void)th_rmtree(fixture->cache);
18691 return false;
18692 }
18693 return true;
18694}
18695
18696static bool compare_graphs_fixture_close(compare_graphs_fixture_t *fixture) {
18697 restore_cache_dir(fixture->saved_cache);

Callers 1

test_mcp.cFile · 0.85

Calls 6

cbm_tmpdirFunction · 0.85
cbm_mkdtempFunction · 0.85
cbm_setenvFunction · 0.85
th_rmtreeFunction · 0.85
restore_cache_dirFunction · 0.85

Tested by

no test coverage detected