From 4ee9c904a45fbf08ab5a144e6948b6af690d18de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Anders=20Bj=C3=B6rklund?= Date: Wed, 27 Jan 2016 21:49:32 +0100 Subject: [PATCH] Add unit test for hash_dir with -fdebug-prefix-map Test that we get cache hits with CCACHE_BASEDIR when debugging, with CCACHE_HASHDIR - but without the dir in the debug object. --- test.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test.sh b/test.sh index 25f24b5a4..e6d2cf52f 100755 --- 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() { -- 2.47.2