[glib-networking/pgriffis/coverage-reports: 45/45] ci: Add coverage reports




commit 4233474162933ac1e7bfcefe5bca6886e12927a7
Author: Patrick Griffis <pgriffis igalia com>
Date:   Mon Jun 21 20:07:42 2021 -0500

    ci: Add coverage reports

 .gitlab-ci.yml    |  7 ++++++-
 .gitlab-ci/lcovrc | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1d0908bd..369ffbbc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,7 +6,9 @@ fedora-x86_64:
     # Remove for PKCS11 logs, otherwise generates a lot of noise hitting gitlab's limit
     PKCS11SPY_PATH: disabled
   script:
+    - cp .gitlab-ci/lcovrc ~/.lcovrc
     - meson --prefix=$HOME/glib-networking-installed
+            -Db_coverage=true
             -Dgnutls=enabled
             -Dopenssl=enabled
             -Dlibproxy=enabled
@@ -16,10 +18,13 @@ fedora-x86_64:
     - meson compile -C _build/
     - meson test -v -C _build/ --repeat=1000
     - meson install -C _build/
+    - ninja -C _build coverage-html
   artifacts:
     paths:
       - _build/test-results
-    when: on_failure
+      - _build/meson-logs/coveragereport
+    when: always
+  coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
 
 fedora-x86_64-asan:
   tags: [ asan ]
diff --git a/.gitlab-ci/lcovrc b/.gitlab-ci/lcovrc
new file mode 100644
index 00000000..d77d5d80
--- /dev/null
+++ b/.gitlab-ci/lcovrc
@@ -0,0 +1,14 @@
+# 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
+# Also ignore g_clear macros as we don't care about the NULL path often
+lcov_excl_br_line = 
LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_|g_warn_if_fail|g_clear_
+
+# Similarly for unreachable assertions.
+lcov_excl_line = 
LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached|g_warn_if_reached


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]