Fixes #367.
* Fixed a bug in the “depend mode” where a manifest hash only could be
associated with one set of header dependencies.
+* Manifest files did not get marked as used on direct cache hits, so the LRU
+ cache cleanup would incorrectly remove them eventually. This has now been
+ fixed.
+
ccache 3.6
----------
}
if (manifest_put(manifest_path, cached_obj_hash, included_files)) {
cc_log("Added object file hash to %s", manifest_path);
- update_mtime(manifest_path);
if (x_stat(manifest_path, &st) == 0) {
stats_update_size(file_size(&st) - old_size, old_size == 0 ? 1 : 0);
}
object_hash = manifest_get(conf, manifest_path);
if (object_hash) {
cc_log("Got object file hash from manifest");
+ update_mtime(manifest_path);
} else {
cc_log("Did not find object file hash in manifest");
}
fi
}
+# Verify that $1 is newer than (or same age as) $2.
+expect_file_newer_than() {
+ local newer_file=$1
+ local older_file=$2
+ if [ "$newer_file" -ot "$older_file" ]; then
+ test_failed "$newer_file is older than $older_file"
+ fi
+}
+
run_suite() {
local suite_name=$1
expect_stat 'files in cache' 2 # .o + .manifest
expect_equal_object_files reference_test.o test.o
+ manifest_file=$(find $CCACHE_DIR -name '*.manifest')
+ backdate $manifest_file
+
$CCACHE_COMPILE -c test.c
expect_stat 'cache hit (direct)' 1
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 1
expect_stat 'files in cache' 2
expect_equal_object_files reference_test.o test.o
+ expect_file_newer_than $manifest_file test.c
# -------------------------------------------------------------------------
TEST "Corrupt manifest file"