From fbe45b77f24c17723d3930014e8b3d6d6eeb238d Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 2 Oct 2022 19:02:09 +0200 Subject: [PATCH] fix: Don't increment preprocessed_cache_miss in recache mode --- src/ccache.cpp | 4 +++- test/suites/base.bash | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ccache.cpp b/src/ccache.cpp index 3df194193..2ae809327 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -2457,7 +2457,9 @@ do_cache_compilation(Context& ctx, const char* const* argv) return Statistic::preprocessed_cache_hit; } - ctx.storage.local.increment_statistic(Statistic::preprocessed_cache_miss); + if (!ctx.config.recache()) { + ctx.storage.local.increment_statistic(Statistic::preprocessed_cache_miss); + } } if (ctx.config.read_only()) { diff --git a/test/suites/base.bash b/test/suites/base.bash index 39dcdf041..937530732 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -449,11 +449,13 @@ fi $CCACHE_COMPILE -c test1.c expect_stat preprocessed_cache_hit 0 + expect_stat preprocessed_cache_miss 1 expect_stat cache_miss 1 expect_stat recache 0 CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c expect_stat preprocessed_cache_hit 0 + expect_stat preprocessed_cache_miss 1 expect_stat cache_miss 1 expect_stat recache 1 -- 2.47.2