diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e2629e32..45610257 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -69,6 +69,7 @@ jobs: cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ -DUSE_LUA=ON -DENABLE_BUILD_PROTOBUF=OFF \ -DENABLE_INTERNAL_TESTS=ON -DENABLE_LAPI_TESTS=ON \ + -DENABLE_COV=ON \ -G Ninja -S . -B build if: ${{ matrix.LUA == 'lua' }} @@ -77,6 +78,7 @@ jobs: cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ -DUSE_LUAJIT=ON -DENABLE_BUILD_PROTOBUF=OFF \ -DENABLE_INTERNAL_TESTS=ON -DENABLE_LAPI_TESTS=ON \ + -DENABLE_COV=ON \ -G Ninja -S . -B build if: ${{ matrix.LUA == 'luajit' }} diff --git a/cmake/BuildLuaJIT.cmake b/cmake/BuildLuaJIT.cmake index 021b3d5d..28630f22 100644 --- a/cmake/BuildLuaJIT.cmake +++ b/cmake/BuildLuaJIT.cmake @@ -130,6 +130,7 @@ macro(build_luajit LJ_VERSION) set(LUA_LIBRARIES bundled-liblua) set(LUA_INCLUDE_DIR ${LJ_SOURCE_DIR}/src/) set(LUA_VERSION_STRING "LuaJIT ${LJ_VERSION}") + set(LUA_SOURCE_DIR ${LJ_SOURCE_DIR}) unset(LJ_SOURCE_DIR) unset(LJ_BINARY_DIR) diff --git a/cmake/BuildLuzer.cmake b/cmake/BuildLuzer.cmake index a55e7ce3..292227b9 100644 --- a/cmake/BuildLuzer.cmake +++ b/cmake/BuildLuzer.cmake @@ -17,6 +17,14 @@ list(APPEND LUZER_CMAKE_FLAGS "-DLUA_INCLUDE_DIR=${LUA_INCLUDE_DIR}" "-DLUA_LIBRARIES=${LUA_LIBRARIES_LOCATION}" ) +# Prevents an error on loading `luzer_impl.so` due to undefined +# symbol `llvm_gcda_summary_info`. +if(ENABLE_COV) + list(APPEND LUZER_CMAKE_FLAGS + -DCMAKE_C_FLAGS=-fprofile-instr-generate + -DCMAKE_CXX_FLAGS=-fprofile-instr-generate + ) +endif() if(USE_LUAJIT) list(APPEND LUZER_CMAKE_FLAGS "-DLUAJIT_FRIENDLY_MODE=ON" diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 0ec887f4..9d004cfe 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -18,7 +18,7 @@ endif() # See https://gcovr.com/en/stable/manpage.html. set(GCOVR_OPTIONS - --branches + --txt-metric branch --cobertura ${COVERAGE_XML_REPORT} --decisions --gcov-executable "llvm-cov gcov" @@ -29,7 +29,7 @@ set(GCOVR_OPTIONS --output ${COVERAGE_HTML_REPORT} --print-summary --root ${LUA_SOURCE_DIR} - --sort-percentage + --sort-key uncovered-percent ) if(USE_LUA)