eBPF-based security platform
ci: collect LCOV from instrumented host tests
Mahe Tardy95b15ffeed51
diff --git a/.github/scripts/coverage.sh b/.github/scripts/coverage.shnew file mode 100755index 00000000..b23683e6--- /dev/null+++ b/.github/scripts/coverage.sh@@ -0,0 +1,44 @@+#!/bin/sh+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo++set -eu++cd "$(git rev-parse --show-toplevel)"+mkdir -p coverage++capture() {+ suffix=$1+ shift++ # VM state under build/ may be inaccessible and holds no host counters.+ # Helpers write production counters alongside the linked objects.+ for dir in \+ . \+ util \+ tools/shirudo-build \+ tools/quote-check \+ build/unit \+ build/quote-check/util \+ build/quote-check/tools/quote-check+ do+ for profile in "$dir"/*."$suffix"; do+ [ -f "$profile" ] || continue+ set -- "$@" --directory "$dir"+ break+ done+ done+ lcov --capture --no-recursion "$@"+}++capture gcno --initial --output-file coverage/baseline.lcov+capture gcda --output-file coverage/run.lcov+# Optimized code can give gcov different hit counts for a function and its lines.+lcov --ignore-errors inconsistent \+ --add-tracefile coverage/baseline.lcov --add-tracefile coverage/run.lcov \+ --output-file coverage/combined.lcov+lcov --ignore-errors inconsistent \+ --extract coverage/combined.lcov "$PWD/*" --output-file coverage/repo.lcov+lcov --ignore-errors inconsistent,unused \+ --remove coverage/repo.lcov '*/testing/*' '*/vendor/*' '*/build/*' \+ '*/util/version_id.c' --output-file coverage/host.lcovdiff --git a/.github/scripts/tests.sh b/.github/scripts/tests.shindex 60d0738c..07a4ef09 100755--- a/.github/scripts/tests.sh+++ b/.github/scripts/tests.sh@@ -67,6 +67,9 @@ setup() {# spatch opens libpython3.X.so by that name for the Python of its# rules, and only the -dev package installs it.set -- rpm coccinelle libpython3-dev+ if [ "${COVERAGE:-0}" = 1 ]; then+ set -- "$@" lcov+ fiif [ "${VM:-1}" != 0 ]; thenset -- "$@" autoconf autoconf-archive automake cloud-image-utils \dracut-core file isc-dhcp-client libguestfs-tools libltdl-dev \@@ -153,4 +156,5 @@ sudo prlimit --pid "$$" --memlock=unlimited:unlimited# secure_path, and the OpenSSL 3.5 build needs both: for the openssl the# config probes run and for every shirudo binary the tests run here.# shellcheck disable=SC2086-sudo -E env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" make VM="${VM:-1}" $goals+sudo -E env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \+ COVERAGE="${COVERAGE:-0}" make VM="${VM:-1}" $goals