| 10324 | |
| 10325 | #ifdef __linux__ |
| 10326 | static 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 | |
| 10354 | TEST(full_reindex_preserves_exact_long_db_path) { |
| 10355 | if (setup_incremental_repo() != 0) { |
no test coverage detected