Repository navigation
build: wire tests, coverage, static analysis, and Tracy options in CMake - #11
Merged
Merged
Conversation
- CMake: activate the BUILD_TESTING path (was a no-op) via add_subdirectory(tests) so ctest actually runs the existing GoogleTest suite. - CMake: make ENABLE_COVERAGE use directory-scoped add_compile/add_link_options (--coverage -O0 -g) ordered before the test subdirectory so the test target inherits coverage flags too; guard against non-GCC/Clang toolchains. - CMake: replace the brittle clang-tidy target-property stub with proper CMAKE_CXX_CLANG_TIDY / CMAKE_CXX_CPPCHECK wiring that finds the tools and gracefully skips when absent (ENABLE_CLANG_TIDY / ENABLE_CPPCHECK). - CMake: add optional ENABLE_TRACY / TRACY_ON_DEMAND options that define TRACY_ENABLE/TRACY_ON_DEMAND and add the tracy include dir when the headers are present, and no-op otherwise. - tests/CMakeLists.txt: convert from a standalone project() to a proper subdirectory; fetch GoogleTest via FetchContent (no system GTest dependency) and register the test with add_test. - src/tracyprofiler.h: dependency-free instrumentation shim that pulls in Tracy zones when TRACY_ENABLE is defined and the headers exist, else expands to no-ops, so sources can be instrumented unconditionally. - .github/workflows/code-coverage.yml: new gcov/lcov CI workflow that builds with BUILD_TESTING+ENABLE_COVERAGE, runs ctest, captures/filters lcov, and uploads an HTML coverage report. Co-authored-by: MarcelRaschke <MarcelRaschke@users.noreply.github.com>
MarcelRaschke
marked this pull request as ready for review
August 18, 2026 05:54
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Focused, additive build-system + CI changes addressing the parts of the requested plan that represent genuine gaps. Several items in the original plan were skipped because they rest on incorrect premises or already exist (details below).
Changes made
Step 7): TheBUILD_TESTINGblock was a no-op (# Add tests here when available) even thoughtests/CMakeLists.txtexisted. Nowadd_subdirectory(tests)is wired soctestactually runs the existing GoogleTest suite.Step 4):ENABLE_COVERAGEnow uses directory-scopedadd_compile_options(--coverage -O0 -g)/add_link_options(--coverage), ordered before the test subdirectory so the test target inherits coverage flags too. Guards against non-GCC/Clang toolchains.Step 3): Replaced the brittle target-property-only stub with properCMAKE_CXX_CLANG_TIDY/CMAKE_CXX_CPPCHECKwiring that locates the tool and gracefully skips when absent (ENABLE_CLANG_TIDY/ENABLE_CPPCHECK).Step 5): NewENABLE_TRACY/TRACY_ON_DEMANDoptions. When the tracy headers are present they are added to the include path andTRACY_ENABLE/TRACY_ON_DEMANDare defined; otherwise the option no-ops, so it is always safe to enable.tests/CMakeLists.txt: Converted from a standaloneproject()into a proper subdirectory. Fetches GoogleTest viaFetchContent(no system GTest dependency) and registers the test withadd_test.src/tracyprofiler.h: Dependency-free instrumentation shim. Pulls in Tracy zones whenTRACY_ENABLEis defined and headers exist, else expands to no-ops — sources can be instrumented unconditionally without forcing a tracy dependency on regular builds..github/workflows/code-coverage.yml: New gcov/lcov CI workflow: builds withBUILD_TESTING=ON -DENABLE_COVERAGE=ON, runsctest, captures and filters lcov (excluding system/third-party/test-framework code), generates an HTML report, and uploads it as an artifact.Items intentionally NOT done (with reasons)
Step 1 — OpenGL-Header anpassen (glad/glew → Kodi): Premise is false. There is noglad/glad.horGL/glew.hinclude anywhere insrc/. The code already uses the correct Kodi headers (<kodi/addon-instance/Visualization.h>,<kodi/gui/gl/Shader.h>insrc/main.h:10-11). Nothing to replace.Step 3(clang-tidy/cppcheck) andStep 5(Tracy) CI: The dedicated.github/workflows/clang-tidy.yml,cppcheck.yml, andsonarqube.ymlalready exist and run in CI. The CMake-side wiring (above) is the genuine gap; the CI workflows were not duplicated.Step 8 (Dockerfile): Already exists as a working multi-stage build.src/main.cppwith no test coverage for the new behavior. Each is its own design decision and was not guessed at. Recommend tackling them as separate, scoped PRs.Verification
Local sandbox validation (no Kodi SDK available, so the addon module target cannot fully configure — that is expected and pre-existing):
tests/CMakeLists.txtpattern configured, built, and rantest_visualization_matrix— 14/14 tests PASSED, discovered byctest.BUILD_TESTING=ON -DENABLE_COVERAGE=ON, confirmed the test target inherits--coverage -O0 -g(compile) and--coverage(link);.gcno/.gcdaartifacts generated after running tests.CMakeLists.txtconfigure with-DENABLE_COVERAGE=ON,-DENABLE_TRACY=ON,-DENABLE_CLANG_TIDY=ON,-DENABLE_CPPCHECK=ON— all configure cleanly, with graceful skip messages when the tool/headers are absent.