| 10547 | |
| 10548 | #ifdef __linux__ |
| 10549 | static void cleanup_long_db_fixture(char *deep_dir, const char *root, const char *db_path, |
| 10550 | const char *staging_path) { |
| 10551 | (void)cbm_unlink(db_path); |
| 10552 | (void)cbm_remove_db_sidecars(db_path); |
| 10553 | |
| 10554 | /* The unfixed full-dump path writes to the first 1023 bytes of the |
| 10555 | * staging name. Remove that sibling so the RED test cleans up after |
| 10556 | * itself as well as the fixed implementation. */ |
| 10557 | if (staging_path && strlen(staging_path) >= CBM_SZ_1K) { |
| 10558 | char truncated[CBM_SZ_1K]; |
| 10559 | memcpy(truncated, staging_path, sizeof(truncated) - 1); |
| 10560 | truncated[sizeof(truncated) - 1] = '\0'; |
| 10561 | (void)cbm_unlink(truncated); |
| 10562 | (void)cbm_remove_db_sidecars(truncated); |
| 10563 | } |
| 10564 | |
| 10565 | size_t root_len = strlen(root); |
| 10566 | while (strlen(deep_dir) > root_len) { |
| 10567 | (void)cbm_rmdir(deep_dir); |
| 10568 | char *slash = strrchr(deep_dir, '/'); |
| 10569 | if (!slash) { |
| 10570 | break; |
| 10571 | } |
| 10572 | *slash = '\0'; |
| 10573 | } |
| 10574 | (void)cbm_rmdir(root); |
| 10575 | } |
| 10576 | |
| 10577 | TEST(full_reindex_preserves_exact_long_db_path) { |
| 10578 | if (setup_incremental_repo() != 0) { |
no test coverage detected