Skip to content

Commit

Permalink
Setup coverage tools
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed May 20, 2024
1 parent 73dbf7e commit f0819de
Show file tree
Hide file tree
Showing 4 changed files with 787 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install deps
run: sudo apt-get install lcov
- name: Run tests
run: |
cmake -Bbuild && cd build
Expand Down
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
cmake_minimum_required(VERSION 3.9)
project(reactor-uc LANGUAGES C)

option(BUILD_TESTS "Build unit tests" ON)
option(BUILD_EXAMPLES "Build example programs" ON)
option(TEST_COVERAGE "Compute test coverage" ON)
set(BUILD_TESTS ON CACHE BOOL "Build unit tests")
set(BUILD_EXAMPLES ON CACHE BOOL "Build example programs")
set(TEST_COVERAGE ON CACHE BOOL "Compute test coverage")

if(TEST_COVERAGE)
set(CMAKE_BUILD_TYPE "Debug")
include(external/cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
endif()


find_program(CLANG_TIDY clang-tidy)
Expand All @@ -16,8 +22,10 @@ file(GLOB SOURCES "src/*.c")
message(${SOURCES})
add_library(reactor-uc STATIC ${SOURCES})
target_compile_options(reactor-uc PRIVATE -Wall -Wextra -pedantic -Werror)
add_compile_options (-fdiagnostics-color=always)
target_include_directories(reactor-uc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)


if(BUILD_TESTS)
set(UNITY_DIR ${CMAKE_CURRENT_LIST_DIR}/external/Unity)
include(CTest)
Expand All @@ -31,6 +39,3 @@ if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if(TEST_COVERAGE)
# FIXME: Integrate with lcov/gcov
endif()
Loading

0 comments on commit f0819de

Please sign in to comment.