From: Anders Björklund Date: Wed, 27 Jan 2016 20:49:32 +0000 (+0100) Subject: Add unit test for hash_dir with -fdebug-prefix-map X-Git-Tag: v3.3~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ee9c904a45fbf08ab5a144e6948b6af690d18de;p=thirdparty%2Fccache.git 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. --- 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() {