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

Add support for test coverage information #4084

Merged
merged 3 commits into from
Jul 10, 2021
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
57 changes: 57 additions & 0 deletions .github/workflows/build-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
include:
- name: clazy
- name: clang-tidy
- name: coverage
runs-on: ubuntu-20.04
name: ${{ matrix.name }}
steps:
Expand Down Expand Up @@ -71,6 +72,31 @@ jobs:
-DWAVPACK=ON \
..
working-directory: build
- name: Configure (coverage)
if: matrix.name == 'coverage'
run: |
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DOPTIMIZE=off \
-DCOVERAGE=ON \
-DWARNINGS_FATAL=OFF \
-DDEBUG_ASSERTIONS_FATAL=OFF \
-DBATTERY=ON \
-DBROADCAST=ON \
-DBULK=ON \
-DHID=ON \
-DLILV=ON \
-DOPUS=ON \
-DQTKEYCHAIN=ON \
-DVINYLCONTROL=ON \
-DFFMPEG=ON \
-DKEYFINDER=ON \
-DLOCALECOMPARE=ON \
-DMAD=ON \
-DMODPLUG=ON \
-DWAVPACK=ON \
..
working-directory: build
- name: Set up problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
Expand All @@ -80,3 +106,34 @@ jobs:
env:
CLAZY_CHECKS: level2,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast,no-qstring-allocations,no-function-args-by-value,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-missing-qobject-macro,no-rule-of-three,no-returning-void-expression,no-missing-typeinfo,no-base-class-event
CLAZY_IGNORE_DIRS: lib/.*
- name: "Test"
if: matrix.name == 'coverage'
run: ctest --timeout 45
working-directory: build
env:
# Render analyzer waveform tests to an offscreen buffer
QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }}
GTEST_COLOR: 1
# Only use single thread to prevent *.gcna files from overwriting each other
CTEST_PARALLEL_LEVEL: 1
CTEST_OUTPUT_ON_FAILURE: 1
- name: "Generate Coverage Report"
if: matrix.name == 'coverage'
run: >-
lcov
--capture
--directory .
--base-directory ..
--include "${PWD%/*}/src/*"
--exclude "${PWD%/*}/src/test/*"
--exclude "${PWD%/*}/build/*"
--exclude "${PWD%/*}/lib/*"
--output-file lcov.info
working-directory: build
- name: "Upload Coverage Report to coveralls.io"
if: matrix.name == 'coverage'
uses: coverallsapp/github-action@master
with:
flag-name: ubuntu-20.04
path-to-lcov: build/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ if(NOT BUILD_LOW_MEMORY)
add_compile_options(-pipe)
endif()

# Coverage
#
# This is only available with GCC, therefore this option is forcibly set to OFF
# for all other compilers.
cmake_dependent_option(COVERAGE "Coverage (i.e. gcov) support" OFF "GNU_GCC" OFF)
if(COVERAGE)
add_compile_options(--coverage -fprofile-arcs -ftest-coverage)
add_link_options(--coverage -fprofile-arcs -ftest-coverage)
endif()

# Profiling
#
# This is only available on Linux, therefore this option is forcibly set to OFF
Expand Down
1 change: 1 addition & 0 deletions tools/debian_buildenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ case "$1" in
fonts-open-sans \
fonts-ubuntu \
g++ \
lcov \
libchromaprint-dev \
libdistro-info-perl \
libebur128-dev \
Expand Down