Skip to content

RFC: Improve Sensor Testing Insfrastructure #78068

@ubieda

Description

@ubieda

Introduction

In the latest Sensor WG Meeting (240819), it was discussed the current state of sensor testing and there was interest in improving this to make it more effective without implying a significant effort.

In the context of migrating Sensor drivers to the Sensor model V2 (Asynchronous, Read/Decode APIs) it becomes more important to have a solution in place to keep track of regressions, as well as validate the porting process along the way.

Problem description

Currently, there are two main approaches for testing sensor drivers:

  1. Build-all sensors Testsuite -> https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/drivers/build_all/sensor
  2. Sensor Emulator Test-suites -> https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/drivers/sensor

The issues with only relying on these two approaches:

  • Build-all sensors:
    • Build-time only verification (for sensors with no emulator).
  • Sensor Emulator Test-suites
    • Requires developing and maintaining an emulator + test-suite per sensor driver (non-negligible effort).
    • Limited number of emulators in-tree (and all most of them are based on Sensor model v1 -> Fetch/Get approach).
    • There have been bugs identified for some of the emulators themselves.

In general, there are challenges with the existing :

Proposed change

HIL Testing Infrastructure in CI

Incorporate HIL sensor testing infrastructure in CI, in which run-time sensor operations are performed and verified. This implies test-beds provided by vendors and trusted community members are deployed and maintained operational.

To achieve this, we'd need to:

  • Coordinate with the Testing WG and understand what options we have.
  • Contact Sensor Vendors and trusted community members to provide and maintain a test-bed with supported sensors.
  • Start deploying and adding test-beds nodes in CI infrastructure.

Testing Approach

  • Go with generic tests (akin the existing generic sensor samples??) that is applicable to all sensors that support that type.
  • Evaluate the following parameters
    • Sensor Polling (read/decode with results validation)
    • Attributes (e.g: change ODR or resolution and verify it is effective)
    • Triggers (to the extend that is possible in a static setup, e.g: Watermark, Stationary, FIFO Full).
    • Preferrably, evaluate the sensor on all supported transports (e.g: BME280 both SPI and I2C).

Concerns and Unresolved Questions

  • Having enough vendors and community members to provide testing setup.
  • Whether we use the Sensor Shell for this or stick to the aforementioned generic testsuites.

Alternatives

Not doing any change in sensor testing and keep on catching bugs as people report them.

Metadata

Metadata

Assignees

Labels

RFCRequest For Comments: want input from the communityarea: SensorsSensorsarea: TestsIssues related to a particular existing or missing test

Type

Projects

Status

No status

Status

Todo

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions