Conversation
1. Root cause: BUILD_TESTS option defaulted ON regardless of CMAKE_BUILD_TYPE, Release packaging builds compiled and ran unit tests via gtest_discover_tests which timed out on aarch64 under high parallelism (make -j96) due to Qt6 WebEngine shared library loading exceeding the 5s default DISCOVERY_TIMEOUT 2. Fix: guard BUILD_TESTS with CMAKE_BUILD_TYPE check to skip tests in Release mode; add DISCOVERY_TIMEOUT 30 to all gtest_discover_tests calls as Debug-mode defensive measure 3. Impact: Release packaging builds no longer compile or run unit tests, eliminating the timeout; Debug builds retain full test coverage with extended discovery timeout Influence: 1. Verify Release mode packaging build completes without timeout 2. Verify Debug mode unit tests still run with DISCOVERY_TIMEOUT 30 3. Confirm no test targets are missing DISCOVERY_TIMEOUT parameter fix: Release模式下跳过单元测试修复打包失败 1. 根因:BUILD_TESTS 选项默认 ON 且不检查 CMAKE_BUILD_TYPE, Release 打包构建编译并运行单元测试,gtest_discover_tests 在 aarch64 高并行(make -j96)下因 Qt6 WebEngine 共享库 加载超过 5 秒默认 DISCOVERY_TIMEOUT 而超时 2. 方案:BUILD_TESTS 增加 CMAKE_BUILD_TYPE 检查,Release 模式 跳过测试;所有 gtest_discover_tests 调用添加 DISCOVERY_TIMEOUT 30 作为 Debug 模式防御性措施 3. 影响:Release 打包构建不再编译运行单元测试,消除超时; Debug 构建保留完整测试覆盖并延长发现超时时间 Influence: 1. 验证 Release 模式打包构建无超时完成 2. 验证 Debug 模式单元测试在 DISCOVERY_TIMEOUT 30 下正常运行 3. 确认所有测试目标均已添加 DISCOVERY_TIMEOUT 参数 PMS: BUG-20260918
There was a problem hiding this comment.
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 3 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRelease builds now skip configuring unit tests to avoid Qt6 WebEngine/gtest discovery timeouts during packaging, while Debug builds retain full test coverage with a 30-second discovery timeout across all test targets. Sequence diagram for Release packaging buildsequenceDiagram
participant Packager
participant CMake
participant Tests
participant Package
Packager->>CMake: configure Release build
CMake->>CMake: evaluate BUILD_TESTS AND NOT CMAKE_BUILD_TYPE STREQUAL Release
CMake-->>Packager: skip add_subdirectory tests
Packager->>Package: build packaging artifacts
Package-->>Packager: complete without test discovery timeout
Sequence diagram for Debug unit test discoverysequenceDiagram
participant Developer
participant CMake
participant Tests
participant GTest
Developer->>CMake: configure Debug build
CMake->>Tests: add_subdirectory tests
Tests->>GTest: gtest_discover_tests with DISCOVERY_TIMEOUT 30
GTest-->>Tests: discover unit tests
Tests-->>Developer: run full unit test coverage
Flow diagram for build-mode test selectionflowchart TD
A[CMake configure] --> B{BUILD_TESTS enabled?}
B -->|No| C[Configure application only]
B -->|Yes| D{CMAKE_BUILD_TYPE is Release?}
D -->|Yes| C
D -->|No| E[add_subdirectory tests]
E --> F[Build and run unit tests]
F --> G[gtest_discover_tests with DISCOVERY_TIMEOUT 30]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 6.6.4 |
fix: skip unit tests in Release build for packaging
CMAKE_BUILD_TYPE, Release packaging builds compiled and ran
unit tests via gtest_discover_tests which timed out on aarch64
under high parallelism (make -j96) due to Qt6 WebEngine shared
library loading exceeding the 5s default DISCOVERY_TIMEOUT
tests in Release mode; add DISCOVERY_TIMEOUT 30 to all
gtest_discover_tests calls as Debug-mode defensive measure
tests, eliminating the timeout; Debug builds retain full test
coverage with extended discovery timeout
Influence:
fix: Release模式下跳过单元测试修复打包失败
Release 打包构建编译并运行单元测试,gtest_discover_tests
在 aarch64 高并行(make -j96)下因 Qt6 WebEngine 共享库
加载超过 5 秒默认 DISCOVERY_TIMEOUT 而超时
跳过测试;所有 gtest_discover_tests 调用添加
DISCOVERY_TIMEOUT 30 作为 Debug 模式防御性措施
Debug 构建保留完整测试覆盖并延长发现超时时间
Influence:
PMS: BUG-20260918
Summary by Sourcery
Skip unit tests in Release builds and extend GoogleTest discovery timeouts to make packaging reliable while retaining Debug test coverage.
Bug Fixes:
Enhancements:
Build: