|
MeshX 0.4
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
Integration tests for MeshX GPIO subsystem. More...
#include <string.h>#include <stdbool.h>#include "unit_test.h"#include "gpio_integration_test.h"#include "../../meshx/interface/gpio/meshx_gpio.h"#include "../../meshx/interface/gpio/meshx_gpio_types.h"#include "../../meshx/interface/gpio/meshx_gpio_kv.h"#include "../../meshx/interface/gpio/meshx_pwm.h"#include "../../meshx/io/interface/meshx_io_bridge.h"#include "../../meshx/inc/meshx_kv_engine.h"#include "../../meshx/interface/utils/meshx_fal_interface.h"#include "../../meshx/interface/logging/meshx_log.h"#include "../../meshx/inc/module_id.h"#include "../../meshx/inc/meshx_err.h"Data Structures | |
| struct | gpio_integration_state_t |
| Integration test state for tracking cross-subsystem operations. More... | |
Functions | |
| void | meshx_gpio_test_set_pin_count (uint8_t count) |
| void | meshx_gpio_test_set_pin_mode (uint8_t pin, meshx_gpio_mode_t mode) |
| void | meshx_pwm_test_set_pin_count (uint8_t count) |
| static void | mock_hosted_event_callback (const meshx_gpio_hosted_event_t *event) |
| Mock hosted event callback for testing UART transport. | |
| static void | mock_interrupt_callback (uint8_t logical_pin, void *user_data) |
| Mock interrupt callback for testing. | |
| static void | init_integration_state (void) |
| Initialize integration test state. | |
| static void | setup_test_gpio_config (void) |
| Setup test GPIO configuration. | |
| static void | cleanup_integration_test (void) |
| Cleanup integration test resources. | |
| static meshx_err_t | test_io_interface_creation (void) |
| Test GPIO with abstract IO interface creation. | |
| static meshx_err_t | test_element_state_change (void) |
| Test GPIO with element state changes. | |
| static meshx_err_t | test_io_function_execution (void) |
| Test GPIO function execution through abstract IO interface. | |
| static meshx_err_t | test_hosted_mode_switching (void) |
| Test hosted mode switching. | |
| static meshx_err_t | test_gpio_operations_in_hosted_mode (void) |
| Test GPIO operations in hosted mode. | |
| static meshx_err_t | test_hosted_interrupt_processing (void) |
| Test hosted interrupt processing. | |
| static meshx_err_t | test_kv_engine_init (void) |
| Test GPIO KV Engine initialization. | |
| static meshx_err_t | test_kv_config_save (void) |
| Test GPIO configuration save to KV Engine. | |
| static meshx_err_t | test_kv_config_load (void) |
| Test GPIO configuration load from KV Engine. | |
| static meshx_err_t | test_kv_config_round_trip (void) |
| Test KV Engine configuration round-trip. | |
| static meshx_err_t | test_kv_pin_state_persistence (void) |
| Test KV Engine pin state persistence. | |
| static meshx_err_t | test_kv_config_export_import (void) |
| Test KV Engine configuration export/import. | |
| static meshx_err_t | test_kv_corruption_recovery (void) |
| Test KV Engine corruption recovery. | |
| static meshx_err_t | test_gpio_logging_integration (void) |
| Test GPIO with logging subsystem integration. | |
| static meshx_err_t | test_full_gpio_lifecycle (void) |
| Test full GPIO lifecycle with all subsystems. | |
| static meshx_err_t | run_gpio_integration_tests (void) |
| Run all GPIO integration tests. | |
| static meshx_err_t | gpio_integration_test_handler (int cmd_id, int argc, char **argv) |
| Integration test command handler. | |
| meshx_err_t | register_gpio_integration_tests (void) |
| Register GPIO integration tests. | |
Variables | |
| static gpio_integration_state_t | intg_state |
| static meshx_fal_partition_t | mock_kv_partition |
| Mock FAL partition for KV Engine testing. | |
Integration tests for MeshX GPIO subsystem.
This file implements comprehensive integration tests for the MeshX GPIO subsystem, testing GPIO with element integration, hosted/non-hosted mode switching, and KV Engine persistence and recovery.
Validates: Requirements 10.5-10.8
Requirements coverage:
Integration test categories:
|
static |
Cleanup integration test resources.
|
static |
Integration test command handler.
| cmd_id | Command ID specifying which test to run |
| argc | Argument count |
| argv | Argument values |
|
static |
Initialize integration test state.
|
extern |
|
extern |
|
extern |
|
static |
Mock hosted event callback for testing UART transport.
|
static |
Mock interrupt callback for testing.
| meshx_err_t register_gpio_integration_tests | ( | void | ) |
Register GPIO integration tests.
Register GPIO integration tests with the unit test framework.
|
static |
Run all GPIO integration tests.
|
static |
Setup test GPIO configuration.
|
static |
Test GPIO with element state changes.
Validates that GPIO operations triggered by element state changes work correctly through the abstract IO interface.
|
static |
Test full GPIO lifecycle with all subsystems.
Validates the complete GPIO lifecycle including initialization, operation, hosted mode switching, KV persistence, and deinitialization.
|
static |
Test GPIO with logging subsystem integration.
Validates that GPIO operations correctly integrate with the MeshX logging subsystem for debug and error reporting.
|
static |
Test GPIO operations in hosted mode.
Validates that GPIO operations in hosted mode correctly invoke the hosted event callback instead of direct hardware access.
|
static |
Test hosted interrupt processing.
Validates that interrupts from the host are correctly processed and dispatched to registered callbacks.
|
static |
Test hosted mode switching.
Validates that the GPIO subsystem correctly switches between hosted and non-hosted modes while preserving pin state and interrupt registrations.
|
static |
Test GPIO function execution through abstract IO interface.
Validates that the function-based API works correctly through the abstract IO interface for various GPIO operations.
|
static |
Test GPIO with abstract IO interface creation.
Validates that GPIO pins can be created through the abstract IO interface and that the IO bridge correctly dispatches operations to the GPIO subsystem.
|
static |
Test KV Engine configuration export/import.
Validates that configuration can be exported to binary format and imported back correctly.
|
static |
Test GPIO configuration load from KV Engine.
Validates that GPIO configuration can be loaded and deserialized from KV Engine.
|
static |
Test KV Engine configuration round-trip.
Validates that saving and loading configuration produces identical results.
|
static |
Test GPIO configuration save to KV Engine.
Validates that GPIO configuration can be serialized and saved to KV Engine.
|
static |
Test KV Engine corruption recovery.
Validates that corrupted KV Engine data triggers fallback to defaults and logs appropriate errors.
|
static |
Test GPIO KV Engine initialization.
Validates that the GPIO KV persistence layer initializes correctly with a FAL partition and product name.
|
static |
Test KV Engine pin state persistence.
Validates that runtime pin states can be saved and restored from KV Engine.
|
static |
|
static |
Mock FAL partition for KV Engine testing.