]> git.ipfire.org Git - thirdparty/ccache.git/blobdiff - test/suites/base.bash
fix: Disable caching for modified source/include files
[thirdparty/ccache.git] / test / suites / base.bash
index 17056a4cc527891f3aabc24e8d346b99ba8e9f52..b7eab536971290acad3d024a0f35f0dd1812352b 100644 (file)
@@ -281,6 +281,48 @@ fi
 
     rm -rf src
 
+    # -------------------------------------------------------------------------
+    TEST "Too new source file"
+
+    touch new.c
+    touch -t 203801010000 new.c
+
+    $CCACHE_COMPILE -c new.c
+    expect_stat modified_input_file 1
+    expect_stat cache_miss 0
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c
+    expect_stat modified_input_file 1
+    expect_stat cache_miss 1
+
+    # -------------------------------------------------------------------------
+    TEST "Too new include file"
+
+    cat <<EOF >new.c
+#include "new.h"
+EOF
+    cat <<EOF >new.h
+int test;
+EOF
+    touch -t 203801010000 new.h
+
+    $CCACHE_COMPILE -c new.c
+    expect_stat modified_input_file 1
+    expect_stat cache_miss 0
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c
+    expect_stat modified_input_file 1
+    expect_stat cache_miss 1
+
+    # -------------------------------------------------------------------------
+    TEST "Too new source file ignored if sloppy"
+
+    touch new.c
+    touch -t 203801010000 new.c
+
+    CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c
+    expect_stat cache_miss 1
+
     # -------------------------------------------------------------------------
     TEST "LANG"