testing: coverage
authorMichael Wallner <mike@php.net>
Wed, 14 Oct 2020 14:24:03 +0000 (16:24 +0200)
committerMichael Wallner <mike@php.net>
Wed, 14 Oct 2020 14:24:03 +0000 (16:24 +0200)
.cirrus.yml
CMake/CheckDebug.cmake

index 46ea911e23bc515470706bbaab7574a2ff6d715a..1562dc36b30a1d8364d91b7fc9a35c61b484cd2d 100644 (file)
@@ -49,7 +49,7 @@ task:
     sudo -E -u nobody make -C build install DESTDIR=/tmp
   on_success:
     codecov_script: |
-      bash <(curl -s https://codecov.io/bash) -- -x "llvm-cov gcov"
+      bash <(curl -s https://codecov.io/bash) -x "llvm-cov gcov"
     gitter_success_script: |
       curl -sS "${gitter}" \
         --data-urlencode "level=info" \
index 32fbf26d1ddb1dcd7caf576d4a2fdb13a487e164..e3e046bf8c7be78accb56c79c458c294f4d84bbf 100644 (file)
@@ -14,56 +14,61 @@ endfunction()
 
 function(check_debug)
     if(CMAKE_BUILD_TYPE STREQUAL "Debug")
-        check_flag(-Og -O0)
-        check_flag(-ggdb -g)
         add_definitions(-DDEBUG=1)
-        foreach(FLAG IN ITEMS
-                -fno-inline
-                -fno-omit-frame-pointer
-                -fno-eliminate-unused-debug-types
-                -funsafe-loop-optimizations
+        if(CMAKE_CXX_FLAGS MATCHES --coverage)
+            message("-- Coverage build detected!")
+            message("--   Skipping debug and sanitizer flag checks.")
+        else()
+            check_flag(-Og -O0)
+            check_flag(-ggdb -g)
+            foreach(FLAG IN ITEMS
+                    -fno-inline
+                    -fno-omit-frame-pointer
+                    -fno-eliminate-unused-debug-types
+                    -funsafe-loop-optimizations
 
-                -Wall
-                -Wextra
+                    -Wall
+                    -Wextra
 
-                -Wdouble-promotion
-                -Wduplicated-cond
-                -Wduplicated-branches
-                -Wformat=2
-                -Wlogical-op
-                -Wnull-dereference
-                -Wrestrict
-                -Wshadow
-                -Wunknown-pragmas
-                -Wunsafe-loop-optimizations
-                )
-            check_flag(${FLAG} IGNORE)
-        endforeach()
+                    -Wdouble-promotion
+                    -Wduplicated-cond
+                    -Wduplicated-branches
+                    -Wformat=2
+                    -Wlogical-op
+                    -Wnull-dereference
+                    -Wrestrict
+                    -Wshadow
+                    -Wunknown-pragmas
+                    -Wunsafe-loop-optimizations
+                    )
+                check_flag(${FLAG} IGNORE)
+            endforeach()
 
-        if(ENABLE_SANITIZERS)
-            if(address IN_LIST ENABLE_SANITIZERS OR asan IN_LIST ENABLE_SANITIZERS)
-                cmake_push_check_state(RESET)
-                set(CMAKE_REQUIRED_LIBRARIES asan)
-                check_cxx_compiler_flag(-fsanitize=address HAVE_ASAN)
-                cmake_pop_check_state()
-                if(HAVE_ASAN)
-                    add_compile_definitions(HAVE_ASAN)
-                    add_compile_options(-fsanitize=address)
-                    link_libraries(-fsanitize=address)
-                    check_flag(-fsanitize-recover=address IGNORE)
+            if(ENABLE_SANITIZERS)
+                if(address IN_LIST ENABLE_SANITIZERS OR asan IN_LIST ENABLE_SANITIZERS)
+                    cmake_push_check_state(RESET)
+                    set(CMAKE_REQUIRED_LIBRARIES asan)
+                    check_cxx_compiler_flag(-fsanitize=address HAVE_ASAN)
+                    cmake_pop_check_state()
+                    if(HAVE_ASAN)
+                        add_compile_definitions(HAVE_ASAN)
+                        add_compile_options(-fsanitize=address)
+                        link_libraries(-fsanitize=address)
+                        check_flag(-fsanitize-recover=address IGNORE)
+                    endif()
                 endif()
-            endif()
 
-            if(undefined IN_LIST ENABLE_SANITIZERS OR ubsan IN_LIST ENABLE_SANITIZERS)
-                cmake_push_check_state(RESET)
-                set(CMAKE_REQUIRED_LIBRARIES ubsan)
-                check_cxx_compiler_flag(-fsanitize=undefined HAVE_UBSAN)
-                cmake_pop_check_state()
-                if(HAVE_UBSAN)
-                    add_compile_definitions(HAVE_UBSAN)
-                    add_compile_options(-fsanitize=undefined)
-                    link_libraries(-fsanitize=undefined)
-                    check_flag(-fsanitize-recover=undefined IGNORE)
+                if(undefined IN_LIST ENABLE_SANITIZERS OR ubsan IN_LIST ENABLE_SANITIZERS)
+                    cmake_push_check_state(RESET)
+                    set(CMAKE_REQUIRED_LIBRARIES ubsan)
+                    check_cxx_compiler_flag(-fsanitize=undefined HAVE_UBSAN)
+                    cmake_pop_check_state()
+                    if(HAVE_UBSAN)
+                        add_compile_definitions(HAVE_UBSAN)
+                        add_compile_options(-fsanitize=undefined)
+                        link_libraries(-fsanitize=undefined)
+                        check_flag(-fsanitize-recover=undefined IGNORE)
+                    endif()
                 endif()
             endif()
         endif()