Skip to content

Fix code coverage #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}

Expand All @@ -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' }}

Expand Down
1 change: 1 addition & 0 deletions cmake/BuildLuaJIT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions cmake/BuildLuzer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions cmake/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down