Skip to content

Conversation

@HTRamsey
Copy link
Collaborator

Summary

  • Fix null pointer dereference in MAVLinkSigning.cc that caused CI segfault (exit code 139) when mavlink_get_channel_status() returned nullptr for invalid MAVLink channels
  • Improve CTest integration with timeouts, labels, and parallel execution
  • Update GitHub workflow to use ctest for better CI reliability

Changes

Bug Fix

  • src/MAVLink/MAVLinkSigning.cc: Add null pointer checks in _getChannelSigning() and initSigning() to prevent segfault when channel is invalid (255)

CTest Improvements

  • Add test timeouts (120s default, configurable via QGC_TEST_TIMEOUT in cmake/CustomOptions.cmake)
  • Add test labels for filtering: ctest -L MAVLink, ctest -L Compression, etc.
  • Enable parallel test execution with --parallel $(nproc)
  • Set QT_QPA_PLATFORM=offscreen and QT_LOGGING_RULES=*=false via test properties
  • Add FAIL_REGULAR_EXPRESSION for FAIL!, Segmentation fault, ASSERT
  • Move include(CTest) to top-level CMakeLists.txt (required by CMake)

Re-enabled Tests

  • RequestMessageTest
  • SendMavCommandWithHandlerTest
  • SendMavCommandWithSignallingTest

Documentation

  • Add test/TESTING.md with concise testing guide
  • Add test/qgcunittest/TestHelpers.h with common test utilities

Test plan

  • Build completes successfully with -DQGC_BUILD_TESTING=ON
  • ctest -N lists all tests with correct labels
  • ctest -L MAVLink filters tests correctly
  • ParameterManagerTest::_paramWriteNoAckRetry() passes (previously segfaulted)
  • CI workflow runs tests successfully

Copilot AI review requested due to automatic review settings January 21, 2026 15:12
@github-actions github-actions bot added github_actions Pull requests that update GitHub Actions code CMake Tests MAVLink size/M labels Jan 21, 2026
Copy link
Contributor

Copilot AI left a 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.cc for 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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Build Results

Platform Status

Platform Status Details
Linux Failed View
Windows Passed View
MacOS Passed View
Android Passed View

Some builds failed.

Artifact Sizes

Artifact Size
QGroundControl-installer-AMD64-ARM64.exe 74.54 MB
QGroundControl-installer-AMD64.exe 162.38 MB
QGroundControl-installer-ARM64.exe 75.36 MB
QGroundControl-mac.apk 159.53 MB
QGroundControl-windows.apk 159.52 MB
QGroundControl.apk 312.28 MB
QGroundControl.dmg 311.46 MB

No baseline available for comparison

Updated: 2026-01-25 03:47:20 UTC • Triggered by: MacOS

@HTRamsey HTRamsey force-pushed the feature/qgc-testing branch from a4bac5e to c8c45e5 Compare January 22, 2026 11:02
@HTRamsey HTRamsey force-pushed the feature/qgc-testing branch 3 times, most recently from 888f1fc to 3225bb6 Compare January 22, 2026 14:01
@github-actions github-actions bot removed the Tools label Jan 22, 2026
@HTRamsey HTRamsey requested a review from Copilot January 22, 2026 15:22
Copy link
Contributor

Copilot AI left a 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

@HTRamsey HTRamsey force-pushed the feature/qgc-testing branch 11 times, most recently from e3c6166 to cf2b9f0 Compare January 23, 2026 03:34
@HTRamsey HTRamsey force-pushed the feature/qgc-testing branch 19 times, most recently from 2c68f0a to 8275422 Compare January 24, 2026 19:30
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
@HTRamsey HTRamsey force-pushed the feature/qgc-testing branch from 8275422 to 3efeeac Compare January 25, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMake github_actions Pull requests that update GitHub Actions code MAVLink size/XL Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant