[libgweather/ebassi/ci-coverage] ci: Add test code coverage report
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/ebassi/ci-coverage] ci: Add test code coverage report
- Date: Tue, 23 Nov 2021 01:19:28 +0000 (UTC)
commit 60714a52aa4e09f8d53d5fa1a46cedc6208341de
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Nov 23 01:18:45 2021 +0000
ci: Add test code coverage report
Use lcov to generate a code coverage report from our test suite.
.gitlab-ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++
.gitlab-ci/lcovrc | 13 +++++++++++++
2 files changed, 53 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7d4f0337..892ee2e1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -256,6 +256,46 @@ asan-build:
- "_asan_build/meson-logs"
allow_failure: true
+coverage:
+ extends: .build-setup
+ stage: analysis
+ needs: []
+ variables:
+ PROJECT_DEPS:
+ gdk-pixbuf2-devel
+ geocode-glib-devel
+ gettext
+ git
+ gobject-introspection-devel
+ itstool
+ lcov
+ libsoup-devel
+ libxml2-devel
+ ninja-build
+ pylint
+ python3
+ python3-gobject
+ python3-pip
+ python3-wheel
+ redhat-rpm-config
+ MESON_VERSION: "0.55.3"
+ MESON_EXTRA_FLAGS: "--buildtype=debug -Dgtk_doc=false -Dintrospection=false"
+ CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
+ script:
+ - meson setup --prefix /usr ${MESON_EXTRA_FLAGS} _build .
+ - meson compile -C _build
+ - meson install -C _build
+ - mkdir -p _coverage
+ - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file
"_coverage/${CI_JOB_NAME}-baseline.lcov"
+ - meson test -C _build
+ - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file
"_coverage/${CI_JOB_NAME}.lcov"
+ artifacts:
+ name: "gweather-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+ when: always
+ paths:
+ - "_build/meson-logs"
+ - "_coverage"
+
reference:
stage: docs
needs: []
diff --git a/.gitlab-ci/lcovrc b/.gitlab-ci/lcovrc
new file mode 100644
index 00000000..ac5997b7
--- /dev/null
+++ b/.gitlab-ci/lcovrc
@@ -0,0 +1,13 @@
+# lcov and genhtml configuration
+# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php
+
+# Always enable branch coverage
+lcov_branch_coverage = 1
+
+# Exclude precondition assertions, as we can never reasonably get full branch
+# coverage of them, as they should never normally fail.
+# See https://github.com/linux-test-project/lcov/issues/44
+lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_
+
+# Similarly for unreachable assertions.
+lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]