Skip to content

fix: enable BUILD_TESTING in debian packaging - #596

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/dde/fa9541483ea5
Nov 9, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/dde/fa9541483ea5

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Enable BUILD_TESTING in debian packaging for dtkcore

This PR enables unit test compilation and execution during dpkg packaging by switching BUILD_TESTING from OFF to ON in debian/rules for both DTK5 and DTK6 build configurations.

Changes

  • debian/rules: Changed -DBUILD_TESTING=OFF → -DBUILD_TESTING=ON in both DTK5 and DTK6 override_dh_auto_configure commands

Rationale

dtkcore already has override_dh_auto_test hooks in debian/rules that run dh_auto_test for both build5 and build6. However, BUILD_TESTING=OFF prevented test binaries from being compiled. With this change, dh_auto_test will compile and execute the unit tests during packaging.

Related issue: DDE-574

Summary by Sourcery

Enable and stabilize unit test execution during Debian packaging across DTK5 and DTK6 configurations.

Bug Fixes:

  • Enable unit tests during Debian packaging for both DTK5 and DTK6 builds.
  • Improve test reliability in packaging and constrained environments by isolating test state, serializing execution, and skipping unsupported environment-dependent cases.
  • Correct test expectations for file operations, D-Bus registration, recent-file handling, permissions, and timed-loop behavior.

Enhancements:

  • Improve compatibility across Qt versions and environments, including packaging chroots, container filesystems, unavailable session buses, and root execution.

Tests:

  • Make the test suite robust for Debian package builds by configuring writable test homes, validating D-Bus fixtures, and preventing conflicting parallel fixture cleanup.

@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Enable BUILD_TESTING for both DTK5 and DTK6 Debian builds so packaging compiles and runs the unit tests.

  • debian/rules L36-40

Tests

Run discovered tests serially and configure a writable test HOME for packaging environments.

  • tests/CMakeLists.txt L221-228
  • tests/main.cpp L1, L7-8, L16-23

Update filesystem, Qt-version, permission, settings, and event-loop tests to behave correctly across packaging and constrained environments.

  • tests/ut_dcapfile.cpp L201, L216-218, L224
  • tests/ut_dcapfsfileengine.cpp L73-75, L139, L345-351
  • tests/ut_ddesktopentrytest.cpp L15, L824-825
  • tests/ut_dlog.cpp L496
  • tests/ut_drecentmanager.cpp L20-26, L46-50, L64-68 (+9 small edits)
  • tests/ut_dsettings.cpp L1, L117-123, L163-169
  • tests/ut_dtimedloop.cpp L68-69
  • tests/ut_ddci.cpp L980 (removed lines), L982 (removed lines)

Skip D-Bus tests when the session bus or fake service is unavailable, and initialize fixture pointers safely when setup skips.

  • tests/fakedbus/fakedbusservice.cpp L1, L25-26, L32-36
  • tests/fakedbus/fakedbusservice.h L1, L36-37, L63
  • tests/ut_ddbusextendedabstractinterface.cpp L73-77
  • tests/ut_ddbusinterface.cpp L12, L25-41, L55-59
  • tests/ut_dexportedinterface.cpp L1, L34-40
  • tests/ut_dnotifysender.cpp L13, L188-189

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

@MyLeeJiEun
MyLeeJiEun marked this pull request as draft November 6, 2026 06:59

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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@MyLeeJiEun
MyLeeJiEun force-pushed the agent/dde/fa9541483ea5 branch 2 times, most recently from ad0f3c0 to aebe7bb Compare November 9, 2026 06:50
1. Enable BUILD_TESTING in debian/rules for packaging
2. Add RUN_SERIAL TRUE to prevent parallel test fixture conflicts
3. Set temporary HOME dir for chroot (HOME=/nonexistent)
4. Fix moveToTrash test to check original path not trash path
5. Make beginEntryList compatible with Qt5 and Qt6
6. Skip D-Bus tests gracefully when session bus unavailable
7. Replace CopyExtension with version-agnostic static_cast
8. Prevent SEGFAULT in D-Bus/DSettings tests in bad environment
9. Fix QByteArray::number overload ambiguity for st_dev/st_ino
10. Skip symLinkTarget/copyWithPermission on container fs failure
11. Skip SaveToReadOnlyFile test when running as root

Log: Enabled unit tests in debian packaging and fixed CI failures

Influence:
1. Verify debian packaging runs unit tests successfully
2. Verify tests pass in CI Docker container environment
3. Verify D-Bus tests skip gracefully without session bus
4. Confirm permission tests skip correctly as root

test: 启用并修复 CI 打包环境下的单元测试

1. 在 debian/rules 中启用 BUILD_TESTING 执行打包测试
2. 添加 RUN_SERIAL TRUE 防止并行测试 fixture 冲突
3. 为 chroot 环境设置临时 HOME 目录(HOME=/nonexistent)
4. 修复 moveToTrash 测试,检查原始路径而非回收站路径
5. 使 beginEntryList 调用兼容 Qt5 和 Qt6
6. 无 session bus 时优雅跳过 D-Bus 测试
7. 使用版本无关的 static_cast 替换 CopyExtension
8. 防止 D-Bus/DSettings 测试在环境不可用时段错误
9. 修复 st_dev/st_ino 的 QByteArray::number 重载歧义
10. 容器文件系统失败时跳过 symLinkTarget/copyWithPermission
11. root 运行时跳过 SaveToReadOnlyFile 测试

Log: 启用 debian 打包单元测试并修复 CI 容器测试失败

Influence:
1. 验证 debian 打包成功执行单元测试
2. 验证测试在 CI Docker 容器环境中通过
3. 验证无 session bus 时 D-Bus 测试被优雅跳过
4. 确认 root 运行时权限测试正确跳过
@MyLeeJiEun
MyLeeJiEun force-pushed the agent/dde/fa9541483ea5 branch from 7d5115e to 3a2ee4d Compare November 9, 2026 08:59
@MyLeeJiEun
MyLeeJiEun marked this pull request as ready for review November 9, 2026 09:18
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Sorry @MyLeeJiEun, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 18 hours and 32 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, 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

@MyLeeJiEun

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 0332b10 into linuxdeepin:master Nov 9, 2026
18 of 19 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