]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Only run -fprofile-update=atomic test when supported by compiler
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 17 Jul 2024 08:31:07 +0000 (10:31 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 17 Jul 2024 08:47:20 +0000 (10:47 +0200)
This fixes an issue with the arm-linux-gnueabi GCC which doesn't support
-fprofile-update=atomic.

(cherry picked from commit 2031c581a648e14d3f3eaa475df0ae3d29780180)

test/suites/profiling_gcc.bash

index 89f901377f0f783c562a96d65f523e49eb0893ef..d1023441ba8b5cc6ae16ae3d97fdad69af0fd239 100644 (file)
@@ -184,24 +184,23 @@ SUITE_profiling_gcc() {
     expect_stat cache_miss 2
 
     # -------------------------------------------------------------------------
+    if $COMPILER -Werror -fprofile-update=atomic -fprofile-generate -c test.c 2>/dev/null; then
+        TEST "-fprofile-update=atomic"
 
-    TEST "-fprofile-update=atomic"
-
-    $CCACHE_COMPILE -fprofile-update=atomic -fprofile-generate -c test.c
-    expect_stat direct_cache_hit 0
-    expect_stat cache_miss 1
-
-    $COMPILER -fprofile-generate -fprofile-update=atomic test.o -o test
+        $CCACHE_COMPILE -fprofile-update=atomic -fprofile-generate -c test.c
+        expect_stat direct_cache_hit 0
+        expect_stat cache_miss 1
 
-    ./test
+        $COMPILER -fprofile-generate -fprofile-update=atomic test.o -o test
 
-    $CCACHE_COMPILE -fprofile-update=atomic -fprofile-generate -c test.c
-    expect_stat direct_cache_hit 1
-    expect_stat cache_miss 1
+        ./test
 
-    $CCACHE_COMPILE -fprofile-use -c test.c
-    expect_stat direct_cache_hit 1
-    expect_stat cache_miss 2
+        $CCACHE_COMPILE -fprofile-update=atomic -fprofile-generate -c test.c
+        expect_stat direct_cache_hit 1
+        expect_stat cache_miss 1
 
-    # -------------------------------------------------------------------------
+        $CCACHE_COMPILE -fprofile-use -c test.c
+        expect_stat direct_cache_hit 1
+        expect_stat cache_miss 2
+    fi
 }