From a5efa87cf924576e33a09954db6d44ad779399b6 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 1 Dec 2026 14:35:52 +0800 Subject: [PATCH] fix(ut): suppress lcov 2.x unused error for extract patterns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI 镜像 lcov 2.x 对 --extract 未命中的 include pattern 直接报 ERROR (unused), 1.x 仅警告;脚本 set -e 中断导致 ut-summary.json 未产出,流水线覆盖率记 0。 统一在 lcov 2.x 版本门控的 --ignore-errors 中追加 unused。 PMS: TASK-398635 Log: CI 上 lcov 2.x extract pattern 未命中即致命,ut-summary.json 缺失 Influence: 仅影响 UT 流水线覆盖率采集脚本,lcov 1.x 行为不变 --- tests/local-test.sh | 2 +- tests/qmake-lcov-test.sh | 2 +- tests/test-prj-running.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/local-test.sh b/tests/local-test.sh index 725998d2..80412925 100644 --- a/tests/local-test.sh +++ b/tests/local-test.sh @@ -31,7 +31,7 @@ $build_dir/$executable --gtest_output=xml:$result_report_dir LCOV_MAJOR=$(lcov --version 2>/dev/null | grep -oE '[0-9]+(\.[0-9]+)+' | head -1 | cut -d. -f1) LCOV_IGN="" if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then - LCOV_IGN="--ignore-errors inconsistent,mismatch" + LCOV_IGN="--ignore-errors inconsistent,mismatch,unused" fi lcov $LCOV_IGN -d $build_dir -c -o $build_dir/coverage.info diff --git a/tests/qmake-lcov-test.sh b/tests/qmake-lcov-test.sh index 944c5751..b7000cac 100644 --- a/tests/qmake-lcov-test.sh +++ b/tests/qmake-lcov-test.sh @@ -23,7 +23,7 @@ $build_dir/$executable --gtest_output=xml:$result_report_dir LCOV_MAJOR=$(lcov --version 2>/dev/null | grep -oE '[0-9]+(\.[0-9]+)+' | head -1 | cut -d. -f1) LCOV_IGN="" if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then - LCOV_IGN="--ignore-errors inconsistent,mismatch" + LCOV_IGN="--ignore-errors inconsistent,mismatch,unused" fi lcov $LCOV_IGN -d $build_dir -c -o $build_dir/coverage.info diff --git a/tests/test-prj-running.sh b/tests/test-prj-running.sh index 6e193d26..4f4e2248 100755 --- a/tests/test-prj-running.sh +++ b/tests/test-prj-running.sh @@ -59,7 +59,7 @@ workdir="${build_path}" LCOV_MAJOR=$(lcov --version 2>/dev/null | grep -oE '[0-9]+(\.[0-9]+)+' | head -1 | cut -d. -f1) LCOV_IGN="" if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then - LCOV_IGN="--ignore-errors inconsistent,mismatch" + LCOV_IGN="--ignore-errors inconsistent,mismatch,unused" fi lcov $LCOV_IGN --directory "${workdir}" --zerocounters || true