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

Function cleanup_long_db_fixture

tests/test_pipeline.c:10326–10352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10324
10325#ifdef __linux__
10326static void cleanup_long_db_fixture(char *deep_dir, const char *root, const char *db_path,
10327 const char *staging_path) {
10328 (void)cbm_unlink(db_path);
10329 (void)cbm_remove_db_sidecars(db_path);
10330
10331 /* The unfixed full-dump path writes to the first 1023 bytes of the
10332 * staging name. Remove that sibling so the RED test cleans up after
10333 * itself as well as the fixed implementation. */
10334 if (staging_path && strlen(staging_path) >= CBM_SZ_1K) {
10335 char truncated[CBM_SZ_1K];
10336 memcpy(truncated, staging_path, sizeof(truncated) - 1);
10337 truncated[sizeof(truncated) - 1] = '\0';
10338 (void)cbm_unlink(truncated);
10339 (void)cbm_remove_db_sidecars(truncated);
10340 }
10341
10342 size_t root_len = strlen(root);
10343 while (strlen(deep_dir) > root_len) {
10344 (void)cbm_rmdir(deep_dir);
10345 char *slash = strrchr(deep_dir, '/');
10346 if (!slash) {
10347 break;
10348 }
10349 *slash = '\0';
10350 }
10351 (void)cbm_rmdir(root);
10352}
10353
10354TEST(full_reindex_preserves_exact_long_db_path) {
10355 if (setup_incremental_repo() != 0) {

Callers 1

test_pipeline.cFile · 0.85

Calls 3

cbm_unlinkFunction · 0.85
cbm_remove_db_sidecarsFunction · 0.85
cbm_rmdirFunction · 0.85

Tested by

no test coverage detected