| 19252 | |
| 19253 | #ifdef __linux__ |
| 19254 | static void cleanup_long_db_fixture(char *deep_dir, const char *root, const char *db_path, |
| 19255 | const char *staging_path) { |
| 19256 | (void)cbm_unlink(db_path); |
| 19257 | (void)cbm_remove_db_sidecars(db_path); |
| 19258 | |
| 19259 | /* The unfixed full-dump path writes to the first 1023 bytes of the |
| 19260 | * staging name. Remove that sibling so the RED test cleans up after |
| 19261 | * itself as well as the fixed implementation. */ |
| 19262 | if (staging_path && strlen(staging_path) >= CBM_SZ_1K) { |
| 19263 | char truncated[CBM_SZ_1K]; |
| 19264 | memcpy(truncated, staging_path, sizeof(truncated) - 1); |
| 19265 | truncated[sizeof(truncated) - 1] = '\0'; |
| 19266 | (void)cbm_unlink(truncated); |
| 19267 | (void)cbm_remove_db_sidecars(truncated); |
| 19268 | } |
| 19269 | |
| 19270 | size_t root_len = strlen(root); |
| 19271 | while (strlen(deep_dir) > root_len) { |
| 19272 | (void)cbm_rmdir(deep_dir); |
| 19273 | char *slash = strrchr(deep_dir, '/'); |
| 19274 | if (!slash) { |
| 19275 | break; |
| 19276 | } |
| 19277 | *slash = '\0'; |
| 19278 | } |
| 19279 | (void)cbm_rmdir(root); |
| 19280 | } |
| 19281 | |
| 19282 | TEST(full_reindex_preserves_exact_long_db_path) { |
| 19283 | if (setup_incremental_repo() != 0) { |
no test coverage detected