Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Dec 15, 2025

This reverts commit 774c00e.

Summary by Sourcery

Revert previous changes to the Debian packaging rules related to unit test build handling.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 15, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Reverts a previous packaging change by restoring debian/rules to its earlier state, effectively undoing prior modifications related to unit test build error handling.

File-Level Changes

Change Details Files
Restore previous debian packaging behavior by reverting earlier modifications to the build rules.
  • Revert logic previously added to address unit test errors during package builds
  • Restore original build targets and flags that existed before the reverted commit
  • Remove any additional unit-test-specific handling introduced in the reverted commit
debian/rules

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@BLumia
Copy link
Member

BLumia commented Dec 15, 2025

CI构建没过(

1. Added rolecombinemodel.h and rolecombinemodel.cpp source files to
rolecombinemodel_tests target
2. Added rolegroupmodel.h and rolegroupmodel.cpp source files to
rolegroupmodel_tests target
3. Added Qt${QT_VERSION_MAJOR}::Gui dependency to both test targets
4. Removed dock-taskmanager library dependency from
rolecombinemodel_tests
5. Commented out dock-taskmanager library dependency from
rolegroupmodel_tests

These changes fix the test build configuration by including the actual
source files directly in the test targets instead of linking against the
dock-taskmanager library. This ensures the tests can properly compile
and link the rolecombinemodel and rolegroupmodel implementations. The Qt
Gui module was added as a dependency since these models likely require
GUI components.

Influence:
1. Verify that rolecombinemodel_tests and rolegroupmodel_tests can be
built successfully
2. Test that all unit tests pass after the build configuration changes
3. Ensure no linking errors occur due to missing dependencies
4. Confirm that the test executables run without crashes

fix: 更新角色模型的测试CMakeLists配置

1. 将rolecombinemodel.h和rolecombinemodel.cpp源文件添加到
rolecombinemodel_tests目标
2. 将rolegroupmodel.h和rolegroupmodel.cpp源文件添加到
rolegroupmodel_tests目标
3. 为两个测试目标添加Qt${QT_VERSION_MAJOR}::Gui依赖
4. 从rolecombinemodel_tests中移除dock-taskmanager库依赖
5. 从rolegroupmodel_tests中注释掉dock-taskmanager库依赖

这些更改修复了测试构建配置,通过直接将实际源文件包含在测试目标中,而不
是链接到dock-taskmanager库。这确保测试能够正确编译和链接rolecombinemodel
和rolegroupmodel的实现。添加了Qt Gui模块依赖,因为这些模型可能需要GUI
组件。

Influence:
1. 验证rolecombinemodel_tests和rolegroupmodel_tests能够成功构建
2. 测试构建配置更改后所有单元测试是否通过
3. 确保不会因缺少依赖而发生链接错误
4. 确认测试可执行文件运行不会崩溃
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个diff进行详细审查:

  1. debian/rules 的修改:
-#DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON
+DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON

这个修改启用了 CMAKE_SKIP_BUILD_RPATH 选项。从安全角度来看,这是一个好的改动:

  • 优点:可以防止运行时使用不安全的RPATH,提高安全性
  • 建议:确保这个修改不会影响正常的库文件链接
  1. CMakeLists.txt 的修改:
    主要涉及两个测试可执行文件的构建配置变更。

对于 rolecombinemodel_tests:

+    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolecombinemodel.h
+    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolecombinemodel.cpp
-    dock-taskmanager
+    Qt${QT_VERSION_MAJOR}::Gui

对于 rolegroupmodel_tests:

+    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolegroupmodel.h
+    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolegroupmodel.cpp
-    dock-taskmanager
+    Qt${QT_VERSION_MAJOR}::Gui

代码质量方面的问题和建议:

  1. 代码结构:
  • 直接添加源文件而不是链接库的做法可能不是最佳实践
  • 建议考虑创建一个专门的测试库,而不是直接包含源文件
  1. 依赖管理:
  • 移除了 dock-taskmanager 依赖,改用直接包含源文件的方式
  • 添加了 Qt::Gui 依赖,这是合理的,因为这些组件可能需要GUI相关功能
  1. 安全性:
  • 使用 CMAKE_SKIP_BUILD_RPATH 是好的安全实践
  • 确保测试代码中不会引入新的安全漏洞
  1. 性能:
  • 直接包含源文件可能会增加编译时间
  • 建议考虑使用预编译头文件来优化编译速度
  1. 改进建议:
# 建议的改进方案
add_library(test_common STATIC
    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolecombinemodel.cpp
    ${CMAKE_SOURCE_DIR}/panels/dock/taskmanager/rolegroupmodel.cpp
)
target_link_libraries(test_common
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
)

add_executable(rolecombinemodel_tests
    combinemodela.cpp
    combinemodela.h
    # ... 其他测试文件
)
target_link_libraries(rolecombinemodel_tests
    test_common
    GTest::GTest
    GTest::Main
    Qt${QT_VERSION_MAJOR}::Test
)

这样的改进可以:

  • 提高代码复用性
  • 减少重复编译
  • 更好地管理依赖关系
  • 使测试结构更清晰

总的来说,这个diff的主要目的是改进测试的构建方式,虽然当前实现方式可以工作,但还有改进空间。建议考虑重构测试构建系统,使其更加模块化和可维护。

@18202781743
Copy link
Contributor Author

CI构建没过(

再看看,之前去掉rpath,test没有通过是因为它link了taskmanager这个so,它不在默认路径下,
看能不能这样改,test直接编译相关的代码到这个二进制中,

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

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

@18202781743 18202781743 merged commit f846ad0 into linuxdeepin:master Dec 15, 2025
10 of 11 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