Repository navigation
fix(test): repair UT build and sanitizer failures after coverage series merge - #570
Conversation
…es merge The merged coverage-series test suites failed to build and run as a whole. This fixes the integration issues found in a full-tree build: - tests/CMakeLists.txt: compile cliapplicationhelper.cpp, logtableview.cpp and logViewerService/logviewerservice.cpp into the test target; add logViewerService/ logViewerAuth/ include dirs; link Qt6 Gui/Core private modules; register org_deepin_log_viewer.hpp for AUTOMOC (replaces the hand-written moc file) - restore 8 lines mangled by a credential redaction filter in ut_dldbushandler.cpp / ut_userlogaccess.cpp / ut_logviewerservice.cpp (openLogStream token retrieval calls) - ut_displaycontent.cpp: define the missing LogFileParser_parseByAudit/ parseByAuth/parseByCoredump stub functions - ut_loglistview.cpp / ut_logauththread.cpp: make duplicate stub helpers static to fix ODR violations across test TUs - ut_logbackend.cpp: return properly aligned dummy objects from DLDBusHandler::instance/LogApplicationHelper::instance stubs instead of (X*)0x1, which is UB under UBSan - ut_logcollectormain.cpp: ensure a QApplication exists before creating widgets in each test Result: 1497 of 1508 tests pass (2 pre-existing DBusManager failures; 9 tests need follow-up: fork-based auth/truncate main tests deadlock under ASan, LogViewHeaderView paint tests and one timer test crash)
|
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 9 hours and 49 minutes by commenting |
Reviewer's GuideRepairs the post-coverage-merge unit-test integration by fixing CMake source and Qt metadata/linkage omissions, restoring missing or unsafe test stubs, and guarding widget tests against QApplication teardown; the resulting Debug ASan/UBSan build links both test binaries and substantially restores suite execution, with documented DBus, fork, paint, timer, and source-level allocator follow-ups remaining. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 无编译错误,逻辑合理,存在轻微边界处理问题 ✅ 通过 潜在问题: 建议: ['将 nullptr 替换为 static char *argv[] = {nullptr};,再传给 QApplication 构造函数'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整,存在轻微一致性问题 ✅ 通过 潜在问题: 建议: ['为 ut_displaycontent.cpp 中新增的三个桩函数添加 static 关键字,与 ut_logauththread.cpp、ut_loglistview.cpp 的修复保持一致'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// tests/src/ut_displaycontent.cpp — 为新增桩函数添加 static 关键字
static int LogFileParser_parseByAudit(const AUDIT_FILTERS &)
{
return 0;
}
static int LogFileParser_parseByAuth(const AUTH_FILTERS &)
{
return 0;
}
static int LogFileParser_parseByCoredump(const COREDUMP_FILTERS &, bool)
{
return 0;
}
// tests/src/ut_logcollectormain.cpp — 修复 QApplication argv 传 nullptr 的 UB
static QApplication *ensureQtApp()
{
if (qApp == nullptr) {
static int argc = 0;
static char *argv[] = {nullptr};
static QApplication *app = new QApplication(argc, argv);
return app;
}
return static_cast<QApplication *>(qApp);
}本报告由 AI 代码审查工具自动生成 |
|
[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 |
|
/merge |
Problem
After merging the unit-test coverage series (#559–#566), the main test binary
deepin-log-viewer-testfailed to build, so only the 8-case plugin binary could run (a local run showed 66 cases and ~10% coverage). The delivered test files had never been verified in one integrated build.Root causes & fixes
LogViewerService,CliApplicationHelper,LogTableView)tests/CMakeLists.txtlogviewerservice.h/viewapplication.hnot in include pathlogViewerService/,logViewerAuth/include dirsorg_deepin_log_viewer.hpp(Q_OBJECT) symbols missingqeventdispatcher_glib_p.h)Qt6::GuiPrivate,Qt6::CorePrivateQString [REDACTED CREDENTIAL]by an upload-side redaction filteropenLogStream(...)callsut_displaycontent.cppLogFileParser_parseByAudit/Auth/Coredumpstubsstaticinstance()stubs returning(X*)0x1→ UBSan crashensureQtApp()guardVerified result (full-tree Debug + ASan/UBSan build)
LogViewerAuth/Truncatemain tests deadlock under ASan, 3LogViewHeaderViewpaint tests and 1LogCollectorMaintimer test crash in event deliveryASAN_OPTIONS=detect_leaks=0:alloc_dealloc_mismatch=0(the latter masks a realexportLogmalloc/new mismatch inlogviewerservice.cppflagged by Mode-5 review — worth a separate source fix)Summary by Sourcery
Restore a buildable and sanitizer-stable integrated unit-test suite after the coverage-series merge.
Bug Fixes:
Enhancements:
Build:
Tests: