Skip to content

test: 增量补全未覆盖访问器单元测试(Device vendor/DriverInfo getters,批次 2) - #728

Draft
add-uos wants to merge 1 commit into
linuxdeepin:masterfrom
add-uos:ut/devicemanager-covgap2-20260810
Draft

test: 增量补全未覆盖访问器单元测试(Device vendor/DriverInfo getters,批次 2)#728
add-uos wants to merge 1 commit into
linuxdeepin:masterfrom
add-uos:ut/devicemanager-covgap2-20260810

Conversation

@add-uos

@add-uos add-uos commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

增量补全未覆盖访问器单元测试(批次 2)

继续增量补全 GUI(deepin-devicemanager)中此前未覆盖的简单访问器函数。文件放在既有 tests/src/ 下,构建通过 file(GLOB_RECURSE) 自动纳入,无需改动 CMakeLists。

本批次覆盖的方法

模块 新覆盖方法
DeviceManager DeviceAudio chip_name, vendor
DeviceManager DeviceBios tomlname
DeviceManager DeviceBluetooth/Cdrom/Computer/Gpu/Image/Input/Memory/Monitor/OtherPCI/Others/Power vendor
DeviceManager DeviceBaseInfo setEnable(基类默认实现,限定名调用)
MacroDefinition DriverInfo vendorName, modelName, driverName, backupFileName

构建与验证

  • 编译:make deepin-devicemanager-test 通过
  • 运行:新增 18 个用例全部通过

基线

  • commit: 89825dcd (2026-08-06) fix(gpu): fix GPU VRAM size parsing failure on multi-line gpu-info

Draft PR,与批次 1(#727)文件互不重叠,无合并冲突。

Summary by Sourcery

Add unit tests to cover previously untested accessor methods for device vendor and related getters in deepin-devicemanager.

Tests:

  • Add UT_DeviceVendorExtra tests to verify vendor/chip_name/tomlname getters across multiple DeviceManager subclasses.
  • Add UT_DriverInfoGetters tests to validate inline getter methods of the DriverInfo struct in MacroDefinition.
  • Add UT_DeviceBaseInfoExtra test to ensure the DeviceBaseInfo::setEnable base implementation consistently returns EDS_Success.

…verInfo getters

Incrementally cover previously-uncovered simple accessor functions.

Batch classes covered:
- DeviceManager: DeviceAudio(chip_name, vendor), DeviceBios(tomlname),
  DeviceBluetooth/Cdrom/Computer/Gpu/Image/Input/Memory/Monitor/OtherPCI/Others/Power(vendor)
- DeviceManager: DeviceBaseInfo::setEnable (base default impl via qualified call)
- MacroDefinition: DriverInfo getters (vendorName, modelName, driverName, backupFileName)

Batch stats: 18 new test cases, all passing.
Baseline commit: 89825dc (2026-08-06) fix(gpu): fix GPU VRAM size parsing failure on multi-line gpu-info
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds focused unit tests to cover previously untested simple getter and base method implementations in deepin-devicemanager, specifically vendor/chip_name/tomlname accessors across various DeviceManager subclasses, DriverInfo inline getters in MacroDefinition, and the DeviceBaseInfo::setEnable base implementation.

File-Level Changes

Change Details Files
Add unit tests that directly set protected members of various DeviceManager device subclasses and verify vendor/chip_name/tomlname getters return those member values.
  • Create UT_DeviceVendorExtra test suite instantiating device subclasses (audio, bios, bluetooth, cdrom, computer, gpu, image, input, memory, monitor, other PCI, others, power).
  • Use -fno-access-control assumptions to assign to protected member variables storing vendor/chip/chip-related strings before calling getters.
  • Assert getter return values match the set members using EXPECT_STREQ with toStdString().c_str().
  • Ensure each device subclass getter (vendor(), chip_name(), tomlname()) is individually covered by its own test case.
deepin-devicemanager/tests/src/DeviceManager/ut_devicevendor_extra.cpp
Add unit tests for DriverInfo inline getters to ensure they return corresponding string members.
  • Create UT_DriverInfoGetters test suite with separate tests for vendorName(), modelName(), driverName(), backupFileName().
  • Initialize a DriverInfo instance in each test and set the corresponding m_VendorName, m_ModelName, m_DriverName, or m_BackupFileName member.
  • Verify each getter returns the correct string via EXPECT_STREQ on the QString converted to std::string.
deepin-devicemanager/tests/src/ut_driverinfo_macro_extra.cpp
Add a unit test to explicitly exercise the DeviceBaseInfo::setEnable base implementation and verify it returns EDS_Success.
  • Create UT_DeviceBaseInfoExtra test that uses a DevicePrint instance to access the DeviceBaseInfo base implementation.
  • Invoke DeviceBaseInfo::setEnable(true) via qualified name on the DevicePrint object to avoid hitting any overridden version.
  • Assert the returned EnableDeviceStatus equals EDS_Success, confirming the base default behavior.
  • Maintain consistency with existing test infrastructure by including ut_Head.h, stub.h, QCoreApplication, and gtest.
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinfo_base_extra.cpp

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

@deepin-bot

deepin-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.70
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #724

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