]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add test for directory in ignore_headers_in_manifest
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 25 Mar 2017 20:23:06 +0000 (21:23 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 25 Mar 2017 20:23:06 +0000 (21:23 +0100)
I should have added this test in a61d0f24 – that would have prevented
issue #165.

test.sh

diff --git a/test.sh b/test.sh
index 89642e2b844bd747eecfda48ce893779dfd21e0c..ea76e20d484bd2c675bb3290bc575685f93b277a 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -2257,20 +2257,41 @@ EOF
     expect_stat 'cache miss' 2
 
     # -------------------------------------------------------------------------
-    TEST "CCACHE_IGNOREHEADERS"
+    TEST "CCACHE_IGNOREHEADERS with filename"
 
-    cat <<EOF >ignore.h
+    mkdir subdir
+    cat <<EOF >subdir/ignore.h
 // We don't want this header in the manifest.
 EOF
-    backdate ignore.h
+    backdate subdir/ignore.h
     cat <<EOF >ignore.c
-#include "ignore.h"
+#include "subdir/ignore.h"
 int foo;
 EOF
 
-    CCACHE_IGNOREHEADERS="ignore.h" $CCACHE_COMPILE -c ignore.c
+    CCACHE_IGNOREHEADERS="subdir/ignore.h" $CCACHE_COMPILE -c ignore.c
     manifest=`find $CCACHE_DIR -name '*.manifest'`
-    data="`$CCACHE --dump-manifest $manifest | grep ignore.h`"
+    data="`$CCACHE --dump-manifest $manifest | grep subdir/ignore.h`"
+    if [ -n "$data" ]; then
+        test_failed "$manifest contained ignored header: $data"
+    fi
+
+    # -------------------------------------------------------------------------
+    TEST "CCACHE_IGNOREHEADERS with directory"
+
+    mkdir subdir
+    cat <<EOF >subdir/ignore.h
+// We don't want this header in the manifest.
+EOF
+    backdate subdir/ignore.h
+    cat <<EOF >ignore.c
+#include "subdir/ignore.h"
+int foo;
+EOF
+
+    CCACHE_IGNOREHEADERS="subdir" $CCACHE_COMPILE -c ignore.c
+    manifest=`find $CCACHE_DIR -name '*.manifest'`
+    data="`$CCACHE --dump-manifest $manifest | grep subdir/ignore.h`"
     if [ -n "$data" ]; then
         test_failed "$manifest contained ignored header: $data"
     fi