Skip to content
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

Testing coverage #23

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure code
if: matrix.os == 'ubuntu-latest'
run: cmake -Bbuild -DENABLE_COVERAGE=1
- name: Configure code
if: matrix.os == 'macos-latest'
run: cmake -Bbuild
- name: Build code
run: cmake --build build --parallel
- name: Test code
run: ctest --test-dir build -V
- name: collect code coverage
run: bash <(curl -s https://codecov.io/bash) || echo "codecov failure"
1 change: 1 addition & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
option(BUILD_SHARED_LIBS "Build the shared library" ON)
option(BUILD_EXAMPLES "Build the examples" ON)
option(ENABLE_UNIT_TESTS "Enable unit testing" ON)
option(ENABLE_COVERAGE "Enable unit test coverage" OFF)
set(TEST_COMM_SIZE "2" CACHE STRING "MPI Communicator Size for tests")
option(ENABLE_JENKINS_OUTPUT "Enable xml output for unit tests" OFF)
7 changes: 7 additions & 0 deletions cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ if (ENABLE_UNIT_TESTS)
FetchContent_MakeAvailable(googletest)
add_library(googletest INTERFACE IMPORTED)
target_link_libraries(googletest INTERFACE gtest_main)

if(ENABLE_COVERAGE)
target_compile_options(googletest INTERFACE -O0 -g -fprofile-arcs -ftest-coverage)
target_link_options(googletest INTERFACE -fprofile-arcs -ftest-coverage)
endif()
endif()



#function(add_unit target sources)
# set(mpimain_SRC ${CMAKE_SOURCE_DIR}/raptor/tests/mpi_main.cpp)
# add_executable(${target} ${sources} ${mpimain_SRC})
Expand Down