commit 320b6bdb33fd9b46d53eeb5651b19cd7a5b8818d from: Sergey Bronnikov via: Sergey Bronnikov date: Tue Oct 25 11:32:23 2022 UTC cmake: propagate code coverage flags TODO: propagate flags commit c6794757ce71013d9137de124aec759209004882 "build: refactor passing compiler flags to dependencies" NO_CHANGELOG=internal NO_DOC=internal NO_TEST=internal commit - f2d83489db5f8cf6665b5a9860346834f9df0bb9 commit + 320b6bdb33fd9b46d53eeb5651b19cd7a5b8818d blob - 25ec8832200a4f883d49cd114b077be23b2f2d73 blob + d70799f7fbd5d0d46a26ff4d05c546a8fce84790 --- .test.mk +++ .test.mk @@ -143,15 +143,9 @@ test-coverage: build run-luajit-test run-test --exclude '/usr/*' \ --exclude '*/build/*' \ --exclude '*/test/*' \ - --exclude 'third_party/base64.c' \ - --exclude 'third_party/base64.h' \ --exclude 'third_party/c-ares' \ --exclude 'third_party/c-dt' \ - --exclude 'third_party/clock_gettime.c' \ - --exclude 'third_party/compat' \ --exclude 'third_party/coro' \ - --exclude 'third_party/crc32_impl.c' \ - --exclude 'third_party/crc32_impl.h' \ --exclude 'third_party/curl' \ --exclude 'third_party/decNumber' \ --exclude 'third_party/libeio' \ @@ -161,30 +155,17 @@ test-coverage: build run-luajit-test run-test --exclude 'third_party/libyaml' \ --exclude 'third_party/lua-cjson' \ --exclude 'third_party/luafun' \ - --exclude 'third_party/luajit' \ --exclude 'third_party/luarocks' \ - --exclude 'third_party/lua-yaml' \ --exclude 'third_party/luazip' \ --exclude 'third_party/lua-zlib' \ - --exclude 'third_party/memmem.c' \ - --exclude 'third_party/memrchr.c' \ --exclude 'third_party/nghttp2' \ - --exclude 'third_party/PMurHash.c' \ - --exclude 'third_party/PMurHash.h' \ - --exclude 'third_party/qsort_arg.c' \ - --exclude 'third_party/qsort_arg.h' \ - --exclude 'third_party/qsort_arg_mt.c' \ + --exclude 'third_party/tz' \ + --exclude 'third_party/xxHash' \ + --exclude 'third_party/zstd' \ + --exclude 'third_party/compat' \ --exclude 'third_party/queue.h' \ - --exclude 'third_party/sha1.c' \ - --exclude 'third_party/sha1.h' \ --exclude 'third_party/sptree.h' \ - --exclude 'third_party/tarantool_eio.c' \ - --exclude 'third_party/tarantool_eio.h' \ - --exclude 'third_party/tarantool_ev.c' \ - --exclude 'third_party/tarantool_ev.h' \ - --exclude 'third_party/tz' \ - --exclude 'third_party/xxHash' \ - --exclude 'third_party/zstd' + --exclude 'third_party/lua-yaml' lcov --list ${OUTPUT_FILE} ############################## blob - 11fdfac938a08ece0c7451a06c0ad8f86bd24354 blob + f548707f0cbaf5636444dd0d9f47ebe9e9037e9d --- CMakeLists.txt +++ CMakeLists.txt @@ -52,6 +52,8 @@ if(NOT EXISTS ${PROJECT_SOURCE_DIR}/src/lib/small/CMak message(FATAL_ERROR "Failed to find submodules") endif() endif() + +set(CODE_COVERAGE_FLAGS "") option(DEV_BUILD "Enable build options that make debugging more convenient" OFF) blob - a542a3deafcd645276516a7a37083510c2c20a80 blob + 48062cb165801811d5942d7ab909b4a1b0b0b0e3 --- cmake/BuildLibEIO.cmake +++ cmake/BuildLibEIO.cmake @@ -7,6 +7,7 @@ macro(libeio_build) set(eio_compile_flags "${eio_compile_flags} -w") set(eio_compile_flags "${eio_compile_flags} -DENABLE_BUNDLED_LIBEIO=1") set(eio_compile_flags "${eio_compile_flags} -DEIO_STACKSIZE=0") + set(eio_compile_flags "${eio_compile_flags} ${CODE_COVERAGE_FLAGS}") if (TARGET_OS_LINUX) set(eio_compile_flags "${eio_compile_flags} -DHAVE_SYS_PRCTL_H -DHAVE_PRCTL_SET_NAME") @@ -17,7 +18,7 @@ macro(libeio_build) ) add_library(eio STATIC ${eio_src}) - target_link_libraries(eio pthread) + target_link_libraries(eio pthread ${CODE_COVERAGE_FLAGS}) set_target_properties(eio PROPERTIES COMPILE_FLAGS "${eio_compile_flags}") blob - a8fef0a8d01653e9273ca8de1d363c125b1e817f blob + 0c080a04235882fb92a5a8b405fcc7d81177f51c --- cmake/BuildLibEV.cmake +++ cmake/BuildLibEV.cmake @@ -2,6 +2,7 @@ # A macro to build the bundled libev macro(libev_build) set(ev_compile_flags ${DEPENDENCY_CFLAGS}) + set(ev_compile_flags ${CODE_COVERAGE_FLAGS}) set(ev_link_libraries) # There are warnings in libev code which are impossible to selectively # turn off, see blob - edd076528bc844872d2844da41050021aa7cfeaf blob + 730d4230ecbd31e0dcfb747caa37cc07bfdd240d --- cmake/BuildMisc.cmake +++ cmake/BuildMisc.cmake @@ -32,7 +32,7 @@ macro(libmisc_build) endif() add_library(misc STATIC ${misc_src}) - set_target_properties(misc PROPERTIES COMPILE_FLAGS "${DEPENDENCY_CFLAGS}") + set_target_properties(misc PROPERTIES COMPILE_FLAGS "${DEPENDENCY_CFLAGS} ${CODE_COVERAGE_FLAGS}") if (HAVE_OPENMP) if(BUILD_STATIC) blob - 92cc88e7034ba4290001bc7c591e0f3290a8c390 blob + db9e9db2ecd3186f9d177d26cc0904ff434c5b73 --- cmake/luajit.cmake +++ cmake/luajit.cmake @@ -29,6 +29,9 @@ TestAndAppendFLag(CMAKE_C_FLAGS -Wno-misleading-indent TestAndAppendFLag(CMAKE_C_FLAGS -Wno-varargs) TestAndAppendFLag(CMAKE_C_FLAGS -Wno-implicit-fallthrough) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CODE_COVERAGE_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CODE_COVERAGE_FLAGS}") + set(BUILDMODE static CACHE STRING "Build mode: build only static lib" FORCE) set(LUAJIT_ENABLE_GC64 ${LUAJIT_ENABLE_GC64} CACHE BOOL blob - 16492efb160ff9a737670ba3f5aa5f6ddc30d3fd blob + c45675c3995598a374342af523e0fb850bde46f5 --- cmake/profile.cmake +++ cmake/profile.cmake @@ -18,15 +18,11 @@ if (ENABLE_GCOV) "ENABLE_GCOV option requested but gcov library is not found") endif() - add_compile_flags("C;CXX" - "-fprofile-arcs" - "-ftest-coverage" - ) + set(CODE_COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage") + add_compile_flags("C;CXX" "${CODE_COVERAGE_FLAGS}") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ftest-coverage") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CODE_COVERAGE_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CODE_COVERAGE_FLAGS}") # add_library(gcov SHARED IMPORTED) endif() blob - 6429a244dd24926d1aaa483717a1e1c249f91835 blob + e91d047b2f89103bddef2b956a679b9f46e6f4a2 --- src/CMakeLists.txt +++ src/CMakeLists.txt @@ -124,7 +124,7 @@ add_library(crc32 STATIC crc32.c ${PROJECT_SOURCE_DIR}/third_party/crc32_impl.c ) -target_link_libraries(crc32 cpu_feature) +target_link_libraries(crc32 cpu_feature ${CODE_COVERAGE_FLAGS}) add_library(shutdown STATIC on_shutdown.c)