]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Don’t increment STATS_COMPILER on fatal error
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 16:37:22 +0000 (17:37 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 20:49:36 +0000 (21:49 +0100)
Statistics counters are otherwise never incremented on fatal errors.

src/ccache.cpp
test/suites/base.bash

index c937561969ef4471ddacbd725eedba72459568a8..35db7cc943770b5152a3509aa81e770488cada13 100644 (file)
@@ -2147,7 +2147,6 @@ find_compiler(Context& ctx, char** argv)
 
   char* compiler = find_executable(ctx, base.c_str(), MYNAME);
   if (!compiler) {
-    stats_update(ctx, STATS_COMPILER);
     fatal("Could not find compiler \"%s\" in PATH", base.c_str());
   }
   if (str_eq(compiler, argv[0])) {
index 4f5ea648e769ab98340e12faa2d36e4eacdf2cac..f3dc8f262dfe3d4b9caaba92cb4b6612f8df151d 100644 (file)
@@ -97,7 +97,10 @@ base_tests() {
     TEST "Couldn't find the compiler"
 
     $CCACHE blahblah -c test1.c 2>/dev/null
-    expect_stat "couldn't find the compiler" 1
+    exit_code=$?
+    if [ $exit_code -ne 1 ]; then
+        test_failed "Expected exit code to be 1, actual value $exit_code"
+    fi
 
     # -------------------------------------------------------------------------
     TEST "Bad compiler arguments"