-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(test): Fix CI segfault and improve CTest integration #13881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical null pointer dereference in MAVLinkSigning.cc that caused CI test failures with segfault (exit 139) and modernizes the test infrastructure with CTest integration.
Changes:
- Adds null pointer checks in
MAVLinkSigning.ccfor invalid MAVLink channels - Implements comprehensive CTest integration with timeouts, labels, parallel execution, and failure detection
- Adds TestHelpers.h with reusable test utilities and convenience macros
- Re-enables three previously disabled MAVLink command tests
- Updates GitHub Actions workflow to use ctest instead of direct test execution
- Adds TESTING.md documentation for developers
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/MAVLink/MAVLinkSigning.cc | Adds null pointer checks to prevent segfault when mavlink_get_channel_status returns nullptr |
| test/qgcunittest/TestHelpers.h | New file providing reusable test utilities (waitFor, signal helpers, fuzzy compare, etc.) |
| test/qgcunittest/CMakeLists.txt | Adds TestHelpers.h to build |
| test/CMakeLists.txt | Implements CTest integration with add_qgc_test function, timeout configuration, test labels, and parallel execution |
| test/UnitTestList.cc | Re-enables RequestMessageTest, SendMavCommandWithHandlerTest, and SendMavCommandWithSignallingTest |
| test/TESTING.md | Comprehensive testing documentation with quick start guide and examples |
| cmake/CustomOptions.cmake | Adds QGC_TEST_TIMEOUT configuration option (default 120s) |
| CMakeLists.txt | Conditionally includes CTest module when testing is enabled |
| .github/workflows/linux.yml | Updates CI to use ctest with parallel execution and proper working directory |
Build ResultsPlatform Status
Some builds failed. Artifact Sizes
No baseline available for comparisonUpdated: 2026-01-25 03:47:20 UTC • Triggered by: MacOS |
a4bac5e to
c8c45e5
Compare
888f1fc to
3225bb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 155 out of 181 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
test/UnitTestFramework/TestHelpers.h:1
- The template parameter name 'Worker' in the function signature is inconsistent with the actual parameter name 'worker' (lowercase). The template parameter should be named F or Func to match common C++ conventions and avoid confusion with the function parameter.
#pragma once
e3c6166 to
cf2b9f0
Compare
2c68f0a to
8275422
Compare
Comprehensive improvements to QGC's unit testing infrastructure for better test isolation, faster execution, and improved maintainability. ## Test Framework Enhancements - Add TestHelpers.h with wait utilities, verification helpers, numeric comparisons, JSON utilities, coordinate helpers, and property-based testing support - Enhance MultiSignalSpy with automatic signal discovery, fluent API, summary reporting, and modern C++20 accessors - Add TestFixtures (VehicleTestFixture, MissionTestFixture, ParameterTestFixture) for common test patterns - Add MockHelpers with TestDataGenerator for deterministic random data ## CMake Test Infrastructure - Add QGCTest.cmake with add_qgc_test() function for standardized test registration with labels, timeouts, and resource locks - Add Coverage.cmake for code coverage reporting - Add Sanitizers.cmake for ASan/UBSan/TSan support - Add FuzzTesting.cmake for fuzz testing infrastructure - Configure RESOURCE_LOCK GlobalState for all tests to prevent parallel execution conflicts ## Vehicle/MockLink Improvements - Add shorter timeouts for unit tests (50ms check interval, 100ms ack) - Stop command timers before vehicle destruction to prevent SIGSEGV during rapid connect/disconnect cycles - Add test-specific heartbeat and comm loss detection timeouts - Enhance MockConfiguration with failure mode support ## Test Organization - Reorganize test directory structure by component - Add proper test registration in UnitTestList.cc - Remove base class (MissionControllerManagerTest) from test registration - Add JUnit XML output support for CI integration ## Bug Fixes - Fix SIGSEGV in RequestMessageTest caused by timer callbacks during vehicle destruction sequence - Fix race condition between link disconnect and vehicle cleanup
8275422 to
3efeeac
Compare
Summary
MAVLinkSigning.ccthat caused CI segfault (exit code 139) whenmavlink_get_channel_status()returned nullptr for invalid MAVLink channelsctestfor better CI reliabilityChanges
Bug Fix
src/MAVLink/MAVLinkSigning.cc: Add null pointer checks in_getChannelSigning()andinitSigning()to prevent segfault when channel is invalid (255)CTest Improvements
QGC_TEST_TIMEOUTin cmake/CustomOptions.cmake)ctest -L MAVLink,ctest -L Compression, etc.--parallel $(nproc)QT_QPA_PLATFORM=offscreenandQT_LOGGING_RULES=*=falsevia test propertiesFAIL_REGULAR_EXPRESSIONforFAIL!,Segmentation fault,ASSERTinclude(CTest)to top-level CMakeLists.txt (required by CMake)Re-enabled Tests
RequestMessageTestSendMavCommandWithHandlerTestSendMavCommandWithSignallingTestDocumentation
test/TESTING.mdwith concise testing guidetest/qgcunittest/TestHelpers.hwith common test utilitiesTest plan
-DQGC_BUILD_TESTING=ONctest -Nlists all tests with correct labelsctest -L MAVLinkfilters tests correctlyParameterManagerTest::_paramWriteNoAckRetry()passes (previously segfaulted)