-
Notifications
You must be signed in to change notification settings - Fork 38
Allow calculating cpp coverage #715
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| /build | ||
| build-coverage | ||
| /.cache | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ option(MLT_WITH_JSON "Include JSON support" ON) | |||||
| option(MLT_WITH_FASTPFOR "Include FastPFor support" ON) | ||||||
| option(MLT_WITH_TESTS "Include Tests" ON) | ||||||
| option(MLT_WITH_TOOLS "Include CLI tools" ON) | ||||||
| option(MLT_WITH_COVERAGE "Enable code coverage instrumentation" OFF) | ||||||
|
|
||||||
| set_target_properties( | ||||||
| mlt-cpp | ||||||
|
|
@@ -76,6 +77,16 @@ add_cxx_compiler_flag(-wd4514) # MSVC: unreferenced inline function has been rem | |||||
| add_cxx_compiler_flag(-wd4710) # MSVC: function not inlined | ||||||
| add_cxx_compiler_flag(-wd4820) # MSVC: padding added after data member | ||||||
|
|
||||||
| if(MLT_WITH_COVERAGE) | ||||||
| message(STATUS "[MLT] Enabling code coverage instrumentation") | ||||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") | ||||||
| target_compile_options(mlt-cpp PRIVATE --coverage -fprofile-arcs -ftest-coverage) | ||||||
|
||||||
| target_compile_options(mlt-cpp PRIVATE --coverage -fprofile-arcs -ftest-coverage) | |
| target_compile_options(mlt-cpp PRIVATE --coverage) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,3 +35,16 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | |||||
| add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/googletest" "${CMAKE_CURRENT_BINARY_DIR}/googletest" EXCLUDE_FROM_ALL SYSTEM) | ||||||
|
|
||||||
| target_link_libraries(mlt-cpp-test mlt-cpp gtest_main) | ||||||
|
|
||||||
| if(MLT_WITH_COVERAGE) | ||||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") | ||||||
| target_compile_options(mlt-cpp-test PRIVATE --coverage -fprofile-arcs -ftest-coverage) | ||||||
|
||||||
| target_compile_options(mlt-cpp-test PRIVATE --coverage -fprofile-arcs -ftest-coverage) | |
| target_compile_options(mlt-cpp-test PRIVATE --coverage) |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -122,6 +122,24 @@ test-js: install-js | |||||||
| test-rust: | ||||||||
| cd rust && cargo test | ||||||||
|
|
||||||||
| # Generate code coverage report for C++ | ||||||||
| [working-directory: 'cpp'] | ||||||||
| coverage-cpp: | ||||||||
| mkdir -p coverage | ||||||||
| cmake -B build-coverage -S . -DMLT_WITH_COVERAGE=ON | ||||||||
| cmake --build build-coverage --target mlt-cpp-test | ||||||||
| build-coverage/test/mlt-cpp-test | ||||||||
| lcov --directory build-coverage --capture --output-file coverage/coverage.info --ignore-errors inconsistent | ||||||||
| lcov --extract coverage/coverage.info '*/cpp/src/mlt/*' '*/cpp/include/mlt/*' --output-file coverage/coverage.info --ignore-errors inconsistent | ||||||||
|
||||||||
| lcov --extract coverage/coverage.info '*/cpp/src/mlt/*' '*/cpp/include/mlt/*' --output-file coverage/coverage.info --ignore-errors inconsistent | |
| lcov --extract coverage/coverage.info '*/cpp/src/mlt/*' '*/cpp/include/mlt/*' --output-file coverage/coverage.filtered.info --ignore-errors inconsistent | |
| mv coverage/coverage.filtered.info coverage/coverage.info |
Uh oh!
There was an error while loading. Please reload this page.