return tl::unexpected(manifest_key_result.error());
}
manifest_key = *manifest_key_result;
- if (manifest_key) {
+ if (manifest_key && !ctx.config.recache()) {
LOG("Manifest key: {}", util::format_digest(*manifest_key));
result_key = get_result_key_from_manifest(ctx, *manifest_key);
}
expect_stat cache_miss 1
# -------------------------------------------------------------------------
- TEST "CCACHE_RECACHE doesn't add a new manifest entry"
+ TEST "CCACHE_RECACHE clears existing manifest"
$CCACHE_COMPILE -c test.c
expect_stat direct_cache_hit 0
+ expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 1
expect_stat recache 0
expect_stat files_in_cache 2 # result + manifest
- manifest_file=$(find $CCACHE_DIR -name '*M')
- cp $manifest_file saved.manifest
+ mv test3.h test3.h.saved
+ echo 'int new_content;' >test3.h
+ backdate test3.h
CCACHE_RECACHE=1 $CCACHE_COMPILE -c test.c
expect_stat direct_cache_hit 0
+ expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 1
expect_stat recache 1
- expect_stat files_in_cache 2
+ expect_stat files_in_cache 3 # 2 * result + manifest
+
+ mv test3.h.saved test3.h
+ backdate test3.h
- expect_equal_content $manifest_file saved.manifest
+ $CCACHE_COMPILE -c test.c
+ expect_stat direct_cache_hit 0
+ expect_stat preprocessed_cache_hit 1
+ expect_stat cache_miss 1
+ expect_stat recache 1
+ expect_stat files_in_cache 3 # 2 * recache + manifest
# -------------------------------------------------------------------------
TEST "Detection of appearing include directories"
expect_stat local_storage_hit 0
expect_stat local_storage_miss 0
expect_stat local_storage_read_hit 0
- expect_stat local_storage_read_miss 1 # Try to read manifest for updating
+ expect_stat local_storage_read_miss 0
expect_stat local_storage_write 2
expect_stat remote_storage_hit 0
expect_stat remote_storage_miss 0
expect_stat remote_storage_read_hit 0
- expect_stat remote_storage_read_miss 1 # Try to read manifest for updating
+ expect_stat remote_storage_read_miss 0
expect_stat remote_storage_write 2
expect_file_count 3 '*' remote # CACHEDIR.TAG + result + manifest
expect_stat local_storage_hit 0
expect_stat local_storage_miss 0
expect_stat local_storage_read_hit 0
- expect_stat local_storage_read_miss 2 # Try to read manifest for updating
+ expect_stat local_storage_read_miss 0
expect_stat local_storage_write 4
expect_stat remote_storage_hit 0
expect_stat remote_storage_miss 0
- expect_stat remote_storage_read_hit 1 # Read manifest for updating
- expect_stat remote_storage_read_miss 1
- expect_stat remote_storage_write 3 # Not 4 since result key already present
+ expect_stat remote_storage_read_hit 0
+ expect_stat remote_storage_read_miss 0
+ expect_stat remote_storage_write 4
# -------------------------------------------------------------------------
if touch test.c && ln test.c test-if-fs-supports-hard-links.c 2>/dev/null; then