Add configuration file for lcov
authorPatrick Griffis <pgriffis@igalia.com>
Thu, 22 Sep 2022 18:53:00 +0000 (13:53 -0500)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Mon, 17 Oct 2022 16:22:49 +0000 (18:22 +0200)
This is useful for accurately testing code coverage. You can use this with:

  meson configure -Db_coverage=true
  meson test
  ninja coverage

.lcovrc [new file with mode: 0644]

diff --git a/.lcovrc b/.lcovrc
new file mode 100644 (file)
index 0000000..3424650
--- /dev/null
+++ b/.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|nice_debug|g_error