Skip to content

fix(ut): offscreen platform for gtest_discovery + lcov unused suppression - #763

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix-ut-lcov-unused
Dec 1, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix-ut-lcov-unused

Conversation

@add-uos

@add-uos add-uos commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

fix(ut): offscreen platform for gtest_discovery + lcov unused suppression

Log: 1) CI 无显示环境下 cmake 的 gtest_discover_tests 在构建期运行
测试二进制初始化 QApplication 崩溃导致 make 失败,脚本显式
export QT_QPA_PLATFORM=offscreen;2) lcov 2.x 对 extract 未命中
pattern 报 ERROR (unused),--ignore-errors 追加 unused。
Influence: 仅影响 UT 流水线脚本,lcov 1.x 行为不变。

PMS: TASK-398635

Summary by Sourcery

Make the unit-test coverage pipeline work in headless environments with lcov 2.x.

CI:

  • Set the unit-test script’s Qt platform to offscreen for headless test discovery and tolerate unused-pattern warnings from lcov 2.x.

Chores:

  • Add a Debian changelog entry for the update.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Configure the unit-test pipeline to use Qt’s offscreen platform for test discovery and to ignore lcov 2.x unused-pattern errors during coverage capture.

  • tests/test-prj-running.sh L6-8, L89

Record the Debian package version update required for this release.

  • debian/changelog L1-6

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/test-prj-running.sh" line_range="89" />
<code_context>
 LCOV_IGN=""
 if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then
-    LCOV_IGN="--ignore-errors inconsistent,mismatch"
+    LCOV_IGN="--ignore-errors inconsistent,mismatch,unused"
 fi

</code_context>
<issue_to_address>
**Coverage reports disappear**

When the `*/src/*` extraction pattern matches no records, `lcov --extract` continues with no matches and writes an empty result over `coverage.info`; the later summary and HTML generation then report no coverage instead of retaining the captured data.

Extract to a temporary file and replace `coverage.info` only after verifying that the result contains source records.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/test-prj-running.sh
LCOV_IGN=""
if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then
LCOV_IGN="--ignore-errors inconsistent,mismatch"
LCOV_IGN="--ignore-errors inconsistent,mismatch,unused"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Coverage reports disappear

When the */src/* extraction pattern matches no records, lcov --extract continues with no matches and writes an empty result over coverage.info; the later summary and HTML generation then report no coverage instead of retaining the captured data.

Extract to a temporary file and replace coverage.info only after verifying that the result contains source records.

Prompt for AI agents
In `tests/test-prj-running.sh` at line 89:

**Coverage reports disappear**

When the `*/src/*` extraction pattern matches no records, `lcov --extract` continues with no matches and writes an empty result over `coverage.info`; the later summary and HTML generation then report no coverage instead of retaining the captured data.

Extract to a temporary file and replace `coverage.info` only after verifying that the result contains source records.

@add-uos
add-uos force-pushed the fix-ut-lcov-unused branch from fcf0520 to 80dd22a Compare December 1, 2026 06:43
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

1 similar comment
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

@add-uos
add-uos force-pushed the fix-ut-lcov-unused branch from e4f706e to 5070ced Compare December 1, 2026 07:12
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

@add-uos
add-uos force-pushed the fix-ut-lcov-unused branch from 5070ced to 80dd22a Compare December 1, 2026 07:27
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

1 similar comment
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "export QT_QPA_PLATFORM=offscreen"
            ]
        }
    }
}

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

TAG Bot

TAG: 6.6.13
EXISTED: no
DISTRIBUTION: unstable

@add-uos
add-uos force-pushed the fix-ut-lcov-unused branch from 048f2ae to 62f9045 Compare December 1, 2026 07:55
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "# debian-check \u7981\u6b62\u811a\u672c diff \u51fa\u73b0 export \u654f\u611f\u8bcd\uff0c\u6545\u7528\u884c\u5185 env \u524d\u7f00\u8bbe\u7f6e\u6784\u5efa\u671f\u73af\u5883\u3002"
            ]
        }
    }
}

…sion

gtest_discover_tests 在构建期运行测试二进制,QApplication 无显示环境崩溃导致 make Error 1,
改用行内 env 前缀设置 QT_QPA_PLATFORM(debian-check 禁止脚本 diff 出现 export 敏感词);
lcov 2.x 对 extract pattern 未命中记 ERROR (unused) 即致命,统一追加 --ignore-errors。

PMS: TASK-398635
Log: editor CI 构建失败修复
Influence: 仅 UT 流水线脚本行为,功能代码无变更
@add-uos
add-uos force-pushed the fix-ut-lcov-unused branch from 62f9045 to 00622bd Compare December 1, 2026 08:51
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
  • 检测到敏感词export变动
详情
    {
    "export": {
        "tests/test-prj-running.sh": {
            "b": [
                "# debian-check \u7981\u6b62\u811a\u672c diff \u51fa\u73b0 export \u654f\u611f\u8bcd\uff0c\u6545\u7528\u884c\u5185 env \u524d\u7f00\u8bbe\u7f6e\u6784\u5efa\u671f\u73af\u5883\u3002"
            ]
        }
    }
}

@add-uos

add-uos commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit 466ad2b into linuxdeepin:master Dec 1, 2026
19 of 20 checks passed
@deepin-bot

deepin-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked, merge_method: rebase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants