]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add unit test for hash_dir with -fdebug-prefix-map
authorAnders Björklund <anders@itension.se>
Wed, 27 Jan 2016 20:49:32 +0000 (21:49 +0100)
committerAnders Björklund <anders@itension.se>
Mon, 8 Feb 2016 18:36:44 +0000 (19:36 +0100)
Test that we get cache hits with CCACHE_BASEDIR when debugging,
with CCACHE_HASHDIR - but without the dir in the debug object.

test.sh

diff --git a/test.sh b/test.sh
index 25f24b5a40f4768ebfb5275c26a94d5337c0ef86..e6d2cf52feba8d4e64829be727ddb4340dfc889f 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -1680,6 +1680,34 @@ EOF
         checkstat 'files in cache' 4
         cd ..
     fi
+
+    ##################################################################
+    # Check that gcc's -fdebug-prefix-map argument maps the debuginfo cwd.
+    if [ $COMPILER_TYPE_GCC -eq 1 ]; then
+        testname="debug-prefix-map"
+        $CCACHE -Cz >/dev/null
+        cd dir1
+        CCACHE_HASHDIR=1 CCACHE_BASEDIR=`pwd` $CCACHE $COMPILER -I`pwd`/include -g -fdebug-prefix-map=`pwd`=dir -c `pwd`/src/test.c -o `pwd`/test.o
+        checkstat 'cache hit (direct)' 0
+        checkstat 'cache hit (preprocessed)' 0
+        checkstat 'cache miss' 1
+        checkstat 'files in cache' 2
+        if grep -E "[^=]`pwd`[^=]" test.o >/dev/null 2>&1; then
+            test_failed "Source dir (`pwd`) found in test.o"
+        fi
+        cd ..
+
+        cd dir2
+        CCACHE_HASHDIR=1 CCACHE_BASEDIR=`pwd` $CCACHE $COMPILER -I`pwd`/include -g -fdebug-prefix-map=`pwd`=dir -c `pwd`/src/test.c -o `pwd`/test.o
+        checkstat 'cache hit (direct)' 1
+        checkstat 'cache hit (preprocessed)' 0
+        checkstat 'cache miss' 1
+        checkstat 'files in cache' 2
+        if grep -E "[^=]`pwd`[^=]" test.o >/dev/null 2>&1; then
+            test_failed "Source dir (`pwd`) found in test.o"
+        fi
+        cd ..
+    fi
 }
 
 compression_suite() {