]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Only run -ftest-coverage + -fprofile-dir tests for GCC
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 2 Aug 2022 19:16:09 +0000 (21:16 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 20 Aug 2022 12:14:31 +0000 (14:14 +0200)
Clang complains with "warning: argument unused during compilation:
'-fprofile-dir=dir'".

(cherry picked from commit 9d899e98e643b08737c3ee1e70149ace461426d5)

test/suites/profiling.bash

index f9043b1a555773e5e98307f1b1039d0d2142f299..e85ea43c2355b9593bffb1233e351ea28f523ff7 100644 (file)
@@ -157,36 +157,36 @@ SUITE_profiling() {
     # check that the compiler doesn't warn about not finding the profile data.
 
     # -------------------------------------------------------------------------
-    TEST "-ftest-coverage with -fprofile-dir"
-
-    # GCC 9 and newer creates a mangled .gcno filename (still in the current
-    # working directory) if -fprofile-dir is given.
-
-    for flag in "" -fprofile-dir=dir; do
-        for dir in . subdir; do
-            $CCACHE -z >/dev/null
-
-            mkdir -p "$dir"
-            touch "$dir/test.c"
-            find -name '*.gcno' -delete
-
-            $COMPILER $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
-            gcno_name=$(find -name '*.gcno')
-            rm "$gcno_name"
-
-            $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
-            expect_stat direct_cache_hit 0
-            expect_stat cache_miss 1
-            expect_exists "$gcno_name"
-            rm "$gcno_name"
-
-            $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
-            expect_stat direct_cache_hit 1
-            expect_stat cache_miss 1
-            expect_exists "$gcno_name"
-            rm "$gcno_name"
+    if $COMPILER_TYPE_GCC; then
+        # GCC 9 and newer creates a mangled .gcno filename (still in the current
+        # working directory) if -fprofile-dir is given.
+        for flag in "" -fprofile-dir=dir; do
+            for dir in . subdir; do
+                TEST "-ftest-coverage with -fprofile-dir=$flag, dir=$dir"
+                $CCACHE -z >/dev/null
+
+                mkdir -p "$dir"
+                touch "$dir/test.c"
+                find -name '*.gcno' -delete
+
+                $COMPILER $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
+                gcno_name=$(find -name '*.gcno')
+                rm "$gcno_name"
+
+                $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
+                expect_stat direct_cache_hit 0
+                expect_stat cache_miss 1
+                expect_exists "$gcno_name"
+                rm "$gcno_name"
+
+                $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o
+                expect_stat direct_cache_hit 1
+                expect_stat cache_miss 1
+                expect_exists "$gcno_name"
+                rm "$gcno_name"
+            done
         done
-    done
+    fi
 
     # -------------------------------------------------------------------------
     TEST "-fprofile-arcs for different object file paths"