Skip to content

test(ut): add PMS regression tests for sev1/sev2 bug hotspots - #941

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:feat/pms-regression-tests-sev1-sev2
Sep 29, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:feat/pms-regression-tests-sev1-sev2

Conversation

@add-uos

@add-uos add-uos commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

背景

基于 PMS 缺陷热点补强(qt-autotest-generator Mode 7),对 sev1/sev2 高频缺陷修复路径补强回归用例,防止退化。

改动内容

新增 13 个 PMS 命名回归用例(5 个批次头文件),覆盖 12 个 sev1/sev2 BUG 修复路径,全部编译运行通过。

批次 用例 BUG sev 类::函数
1 BUG185721_StartCountdownNoSegfault 185721 1 MainWindow::startCountdown
1 BUG275661_InitAttributesScreenLayerIdempotent 275661 2 MainWindow::initAttributes
1 BUG314667_EmptyImageGuardReturnsFalse 314667 1 PixMergeThread::mergeImageWork
1 BUG129883_WaylandGstStartRecordBgraNoCrash 129883 2 GstRecordX::waylandGstStartRecord
2 BUG308389_OnTranscodePaletteFinishedNoLeak 308389 2 RecordProcess::onTranscodePaletteFinished
2 BUG291463_SetRecordInfoStoresRect 291463 2 RecordProcess::setRecordInfo
2 BUG283491_RecordVideoNoCrash 283491 2 RecordProcess::recordVideo
3 BUG280187_InitTreelandtAttributesIdempotent 280187 2 MainWindow::initTreelandtAttributes
3 BUG172577_OnTranscodeFinishNoCrash 172577 2 RecordProcess::onTranscodeFinish
3 BUG308389_DestructorNoCrash 308389 2 RecordProcess::~RecordProcess
4 BUG352125_InitMainWindowNoCrash 352125 2 MainWindow::initMainWindow
4 BUG308909_InitRecordOptionNoCrash 308909 2 SubToolWidget::initRecordOption
5 BUG79399_ConstructorNoHangAndSlotSafe 79399 1 voiceVolumeWatcher

测试验证

[==========] Running 13 tests from 6 test suites.
[  PASSED  ] 13 tests. (283 ms total)

质量保证

  • 复用既有 Fixture(MainWindowCov4Test / PixMergeThreadTest / GstRecordXTest / RecordProcessCov2Test / SubToolWidgetCov2Test / VoiceVolumeWatcherCovTest)与既有 ACCESS_PRIVATE_FUN/FIELD 包装器,零 ODR 冲突风险
  • 每例头部带 PMS URL + commit sha + 根因注释,可追溯
  • 断言不改源码,针对当前代码语义验证修复路径稳定

Summary by Sourcery

Strengthen unit-test coverage against high-priority PMS regression hotspots with 13 named sev1/sev2 tests.

Enhancements:

  • Add PMS-traceable regression coverage for 13 sev1/sev2 bug-fix paths across window initialization, recording, image merging, audio monitoring, and recording-option setup.

Build:

  • Update ignored files and refresh test header copyright metadata.

Tests:

  • Add 13 named unit tests covering 12 high-priority PMS defect paths, including crash, hang, lifecycle, state-storage, and invalid-input regressions.

@sourcery-ai

sourcery-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds 13 PMS-linked regression tests in five batch headers, reusing established fixtures and access wrappers to exercise 12 sev1/sev2 bug-fix hotspots without production-code changes, then wires the batches into the aggregate unit-test build. Reviewers should focus on whether each test meaningfully asserts the documented fix rather than only absence of crashes, and on lifecycle/cleanup safety in the GStreamer and RecordProcess cases.

File-Level Changes

Change Details Files
Added PMS-traceable regression tests for high-severity bug-fix paths across the screen recorder unit-test suite.
  • Added 13 BUG-numbered GoogleTest cases covering MainWindow initialization/countdown, PixMergeThread empty-image handling, GStreamer Wayland recording, RecordProcess lifecycle/transcoding/recording, SubToolWidget record options, and voice-volume watcher startup.
  • Documented each regression with PMS links, fixing commit identifiers, root-cause context, and the intended stable behavior.
  • Reused existing fixtures and private-access wrappers, adding only the SubToolWidget private-function wrapper needed by the new tests.
tests/ut_screen_shot_recorder/ut_pms_regression_batch1.h
tests/ut_screen_shot_recorder/ut_pms_regression_batch2.h
tests/ut_screen_shot_recorder/ut_pms_regression_batch3.h
tests/ut_screen_shot_recorder/ut_pms_regression_batch4.h
tests/ut_screen_shot_recorder/ut_pms_regression_batch5.h
Integrated the new regression-test batches into the unit-test build and aggregate test header.
  • Included all five batch headers after the existing fixture and wrapper definitions.
  • Registered the new headers in the qmake project file.
  • Added the test-directory ignore file and updated ignore configuration.
tests/ut_screen_shot_recorder/test_all_interfaces.h
tests/ut_screen_shot_recorder/ut_screen_shot_recorder.pro
.gitignore
tests/ut_screen_shot_recorder/.gitignore

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/ut_screen_shot_recorder/ut_pms_regression_batch2.h" line_range="43-49" />
<code_context>
+    ASSERT_NE(m_p, nullptr);
+
+    // Act — 触发转码回调(修复点:QProcess 父挂 this)
+    EXPECT_NO_FATAL_FAILURE(
+        call_private_fun::RecordProcessonTranscodePaletteFinished(
+            *m_p, QStringLiteral("/tmp/ut_pms_nonexistent_308389.png")));
+
+    // Assert — 对象存活(QProcess 随父托管,未泄漏致 OOM)
+    EXPECT_NE(m_p, nullptr);
+}
+
+// =========================================================================
</code_context>
<issue_to_address>
**issue (testing):** The test only checks that `m_p` remains non-null immediately after starting ffmpeg; it never verifies that the created `QProcess` is parented, exits, or is destroyed. A regression that allocates an unparented process would still pass this test, so the claimed no-leak protection is not covered.

**Triggers:** When the process is asynchronous, which is the normal behavior of `QProcess::start`.

**Suggested fix:** Inspect the created process's parent or child-object list and wait for deterministic cleanup, or expose a test seam that verifies process ownership and destruction.
</issue_to_address>

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

Comment thread tests/ut_screen_shot_recorder/ut_pms_regression_batch2.h Outdated
@add-uos
add-uos force-pushed the feat/pms-regression-tests-sev1-sev2 branch 2 times, most recently from 28b2a41 to 9f9bc76 Compare September 29, 2026 11:21
基于 PMS 缺陷热点补强(qt-autotest-generator Mode 7),对 sev1/sev2 高频缺陷
修复路径补强回归用例,防止退化。用例按所属 fixture 归入既有测试文件,不另建
批次文件。

新增 13 个 PMS 命名回归用例,覆盖 12 个 BUG(3 sev1 + 9 sev2),全部编译运行通过:

  MainWindowCov4Test:
    BUG185721_StartCountdownNoSegfault       (sev1, startCountdown)
    BUG275661_InitAttributesScreenLayerIdempotent (sev2, initAttributes)
    BUG280187_InitTreelandtAttributesIdempotent   (sev2, initTreelandtAttributes)
    BUG352125_InitMainWindowNoCrash          (sev2, initMainWindow)
  PixMergeCovTest:
    BUG314667_EmptyImageGuardReturnsFalse    (sev1, mergeImageWork 空图守卫)
  GstRecordXTest:
    BUG129883_WaylandGstStartRecordBgraNoCrash (sev2, waylandGstStartRecord BGRA)
  RecordProcessCov2Test:
    BUG308389_OnTranscodePaletteFinishedNoLeak (sev2, onTranscodePaletteFinished OOM)
    BUG291463_SetRecordInfoStoresRect         (sev2, setRecordInfo)
    BUG283491_RecordVideoNoCrash              (sev2, recordVideo)
    BUG172577_OnTranscodeFinishNoCrash        (sev2, onTranscodeFinish)
    BUG308389_DestructorNoCrash               (sev2, ~RecordProcess)
  SubToolWidgetCov2Test:
    BUG308909_InitRecordOptionNoCrash         (sev2, initRecordOption gif 选项)
  VoiceVolumeWatcherCovTest:
    BUG79399_ConstructorNoHangAndSlotSafe     (sev1, 启动卡死)

复用既有 fixture 与 ACCESS_PRIVATE_FUN/FIELD 包装器;仅 SubToolWidget::
initRecordOption 为新增声明(全仓唯一,无 ODR 冲突)。每例头部带 PMS URL +
commit sha + 根因注释,可追溯。

验证: [ PASSED ] 13 tests. (698 ms)
@add-uos
add-uos force-pushed the feat/pms-regression-tests-sev1-sev2 branch from 9f9bc76 to d74b9f2 Compare September 29, 2026 11:24
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@add-uos

add-uos commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit 88d7a01 into linuxdeepin:master Sep 29, 2026
6 checks passed
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.

3 participants