]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Skip “Directory is not hashed if using -gz[=zlib]” tests for GCC 6
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 5 Jul 2020 18:34:54 +0000 (20:34 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 5 Jul 2020 19:05:42 +0000 (21:05 +0200)
The GCC 6 (tested with GCC 6.3) preprocessor includes the current
working directory in the preprocessed output if run with -gz, which
means that there won’t be cache hits between directories, thus failing
the “Directory is not hashed if using -gz[=zlib]” tests. Fix this by
skipping the test if the preprocessor behaves that way.

Fixes #602.

test/suites/base.bash

index e73acbb710627d9f2e281c97a24f019dff862d98..0c680eb2b3d09be6a6bbcd16dd71e69e881e0309 100644 (file)
@@ -458,7 +458,8 @@ base_tests() {
     # -------------------------------------------------------------------------
     TEST "Directory is not hashed if using -gz"
 
-    if $REAL_COMPILER -c test1.c -gz -o /dev/null 2>/dev/null; then
+    $REAL_COMPILER -E test1.c -gz >preprocessed.i 2>/dev/null
+    if [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then
         mkdir dir1 dir2
         cp test1.c dir1
         cp test1.c dir2
@@ -480,7 +481,8 @@ base_tests() {
     # -------------------------------------------------------------------------
     TEST "Directory is not hashed if using -gz=zlib"
 
-    if $REAL_COMPILER -c test1.c -gz=zlib -o /dev/null 2>/dev/null; then
+    $REAL_COMPILER -E test1.c -gz=zlib >preprocessed.i 2>/dev/null
+    if [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then
         mkdir dir1 dir2
         cp test1.c dir1
         cp test1.c dir2