summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-04 10:40:21 +0100
committerskal <pascal.massimino@gmail.com>2026-02-04 10:40:21 +0100
commit3850a46d1d4138b80dbc20bbe4ac4342d6911ab0 (patch)
tree017c62612b034065c35aa3b350e41da00d3bb30b /scripts
parent8da917bce6e937ab092bb2f68c0bcf6039c3a3d7 (diff)
feat(tooling): Add directory filtering to coverage report script (Task #46)
Updated gen_coverage_report.sh to accept an optional argument for targeting specific directories using lcov --extract.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_coverage_report.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/gen_coverage_report.sh b/scripts/gen_coverage_report.sh
index bae2141..b569251 100755
--- a/scripts/gen_coverage_report.sh
+++ b/scripts/gen_coverage_report.sh
@@ -7,12 +7,16 @@ set -e
PROJECT_ROOT=$(cd "$(dirname "$0")/.." && pwd)
BUILD_DIR="${PROJECT_ROOT}/build_coverage"
REPORT_DIR="${PROJECT_ROOT}/build_coverage/coverage_report"
+TARGET_FILTER="$1"
# Common lcov options to handle AppleClang quirks
LCOV_OPTS="--ignore-errors mismatch,inconsistent,gcov,format,unsupported,category"
echo "=== Code Coverage Report Generator ==="
echo "Project Root: ${PROJECT_ROOT}"
+if [ -n "$TARGET_FILTER" ]; then
+ echo "Target Filter: ${TARGET_FILTER}"
+fi
# Check for lcov
if ! command -v lcov &> /dev/null; then
@@ -48,9 +52,16 @@ echo "--- Filtering Coverage Data ---"
# Remove system headers and third-party libraries
lcov --remove coverage.info '/usr/*' "${PROJECT_ROOT}/third_party/*" "${PROJECT_ROOT}/build_coverage/*" '*/test_*' --output-file coverage_filtered.info $LCOV_OPTS
+# Apply target directory filter if provided
+if [ -n "$TARGET_FILTER" ]; then
+ echo "--- Applying Target Filter: ${TARGET_FILTER} ---"
+ # We use '*' around the filter to match the absolute path
+ lcov --extract coverage_filtered.info "*${TARGET_FILTER}*" --output-file coverage_filtered.info $LCOV_OPTS
+fi
+
echo "--- Generating HTML Report ---"
genhtml coverage_filtered.info --output-directory "${REPORT_DIR}" $LCOV_OPTS
echo "=== Coverage Report Generated ==="
echo "Open the report with:"
-echo "open ${REPORT_DIR}/index.html"
+echo "open ${REPORT_DIR}/index.html" \ No newline at end of file