Repository navigation
test: add unit tests for utils, threads and entries - #562
Conversation
|
Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 45 minutes by commenting |
Reviewer's GuideTest-only batch 4/8 expansion adds 1,295 lines of unit coverage across utilities, journal parsing and workers, single-instance/authentication helpers, and Qt view event/rendering paths, using stubs, temporary resources, and child processes to isolate external dependencies. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
508db69 to
64ba7f0
Compare
64ba7f0 to
f1fd1b2
Compare
1. Add ut_utils_extra, ut_cliapplicationhelper, ut_logtableview and ut_logviewer_auth_main test files 2. Rewrite ut_logtreeview.cpp with stricter assertions 3. Extend ut_logapplicationparsethread.cpp and ut_journalwork.cpp Log: No user-facing changes Influence: 1. Run deepin-log-viewer-test with --gtest_filter='*Utils*;*TreeView*' 2. Verify full suite passes with ASAN_OPTIONS=detect_leaks=0 3. Check lcov function coverage of utils and parse threads test: 新增工具类、解析线程与入口单元测试 1. 新增 ut_utils_extra、ut_cliapplicationhelper、ut_logtableview 与 ut_logviewer_auth_main 测试文件 2. 重写 ut_logtreeview.cpp,断言更严格 3. 扩展 ut_logapplicationparsethread.cpp 与 ut_journalwork.cpp Log: 无用户可见变化 Influence: 1. 运行 deepin-log-viewer-test 过滤 Utils/TreeView 套件 2. 以 ASAN_OPTIONS=detect_leaks=0 验证全量用例通过 3. 用 lcov 检查 utils 与解析线程函数覆盖率
f1fd1b2 to
2663d86
Compare
|
TAG Bot New tag: 6.5.43 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,语法逻辑正确。'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['将 UT_GetDateTimeFromStamp_002 的恒真断言改为具体预期值检查,或添加注释说明为覆盖率测试', '在 ut_logviewer_auth_main.cpp 顶部补充注释,说明直接包含 .cpp 文件是为覆盖率测试的必要做法', '考虑将公共 stub 函数提取到 tests/src/stubs/ 目录下的公共头文件中'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无需修改,测试性能合理。'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无需修改,测试代码无安全风险。'] 💡 改进建议代码示例// 建议:将 UT_GetDateTimeFromStamp_002 中的恒真断言改为有意义的验证 TEST_F(LogApplicationParseThread_UT, UT_GetDateTimeFromStamp_002) {
// 空字符串应返回空结果或特定默认值,根据实际实现确定预期
QString result = m_logAppThread->getDateTimeFromStamp("");
EXPECT_TRUE(result.isEmpty()) << "Empty timestamp should return empty string";
}本报告由 AI 代码审查工具自动生成 |
Part 4/8 of the deepin-log-viewer unit-test coverage series (single-commit PR; all 8 PRs touch disjoint file sets and are mutually independent).
Files in this PR (7 files, +1295/-176 lines)
tests/src/ut_utils_extra.cpp(new)tests/src/ut_logtreeview.cpptests/src/ut_logapplicationparsethread.cpptests/src/ut_cliapplicationhelper.cpp(new)tests/src/ut_logviewer_auth_main.cpp(new)tests/src/ut_logtableview.cpp(new)tests/src/ut_journalwork.cppNotes
tests/src//tests/dbusproxy//tests/ut_logviewerplugin/, globbed automatically bytests/CMakeLists.txt(re-run cmake after pulling).Summary by Sourcery
Increase unit-test coverage for utilities, journal workers, log views, single-instance support, and authentication startup paths.
Enhancements:
Tests: