Skip to content

test: add comprehensive unit tests for dtkcore - #583

Draft
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:test/dtkcore-unit-tests
Draft

test: add comprehensive unit tests for dtkcore#583
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:test/dtkcore-unit-tests

Conversation

@MyLeeJiEun

Copy link
Copy Markdown

Summary

Add comprehensive unit test suite for dtkcore, validated across 15 execution rounds (808 passed / 0 failed).

Test Results

  • 808 passed / 0 failed
  • Coverage: line 85.0% ✅ / function 92.5% ✅ / branch 45.9%

Changes

  • 14 new test files (ut_*.cpp) covering DSysInfo, DConfig, DDBus, DCI, DFileSystemWatcher, DFileWatcher, DSettings, DTrash, and more
  • 25 existing test files updated with improved coverage and bug fixes
  • New dsysinfo_stub.cpp for LD_PRELOAD-based DSysInfo mocking
  • Updated CMakeLists.txt with OBJECT library and stub integration

Related Issue

MUL-DDE-209

How to Build & Test

mkdir build && cd build
cmake .. -DBUIILD_TESTING=ON
make -j$(nproc)
ctest --output-on-failure

1. Add 14 new test files covering DSysInfo, DConfig, DDBus, DCI,
   DFileSystemWatcher, DFileWatcher, DSettings, DTrash and more
2. Update 25 existing test files with improved coverage and fixes
3. Add dsysinfo_stub.cpp for LD_PRELOAD-based DSysInfo mocking
4. Update CMakeLists.txt with OBJECT library and stub integration
5. Tests validated: 808 passed / 0 failed across 15 execution rounds

Influence:
1. Build with BUIILD_TESTING=ON and run ctest to verify all tests pass
2. Verify coverage metrics: line 85%, function 92.5%, branch 45.9%
3. Test DSysInfo mock with LD_PRELOAD stub in isolated environment

test: 补充 dtkcore 单元测试代码

1. 新增 14 个测试文件,覆盖 DSysInfo、DConfig、DDBus、DCI、
   DFileSystemWatcher、DFileWatcher、DSettings、DTrash 等模块
2. 更新 25 个已有测试文件,提升覆盖率并修复失败用例
3. 新增 dsysinfo_stub.cpp 实现 LD_PRELOAD 方式的 DSysInfo mock
4. 更新 CMakeLists.txt 集成 OBJECT 库与 stub 机制
5. 测试验证:15 轮执行 808 passed / 0 failed

Influence:
1. 使用 BUIILD_TESTING=ON 编译并运行 ctest 验证全部测试通过
2. 验证覆盖率指标:行 85%、函数 92.5%、分支 45.9%
3. 在隔离环境中测试 DSysInfo mock 的 LD_PRELOAD stub 机制

PMS: TASK-DDE-209
@MyLeeJiEun
MyLeeJiEun marked this pull request as draft September 4, 2026 13:37

@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.

Sorry @MyLeeJiEun, your pull request is larger than the review limit of 150,000 diff characters

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @MyLeeJiEun. Thanks for your PR. 😃

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants