Skip to content

tests: Add board qualification test for I2C bus scan.#90

Merged
nedseb merged 4 commits intofeature/board-qualification-frameworkfrom
feature/board-i2c-scan
Mar 13, 2026
Merged

tests: Add board qualification test for I2C bus scan.#90
nedseb merged 4 commits intofeature/board-qualification-frameworkfrom
feature/board-i2c-scan

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 13, 2026

Summary

Closes #84
Depends on #89 (framework extension)

Adds a board qualification test scenario that scans the internal I2C bus, verifies all expected device addresses are present, and checks the WHO_AM_I / device ID register of each component.

Scenario: tests/scenarios/board_i2c_scan.yaml

Bus scan tests (2 tests)

Test Description
I2C bus scan finds expected devices Scans I2C(1) and verifies 9 expected addresses
No unexpected I2C devices Verifies no unknown addresses on the bus

WHO_AM_I / Device ID tests (7 tests)

Test Address Register Expected
LIS2MDL WHO_AM_I 0x1E 0x4F 0x40
MCP23009E IODIR default 0x20 0x00 0xFF
VL53L1X model ID 0x29 0x010F 0xEACC
APDS9960 device ID 0x39 0x92 0xAB
WSEN-PADS device ID 0x5D 0x0F 0xB3
HTS221/WSEN-HIDS device ID 0x5F 0x0F 0xBC
ISM330DL WHO_AM_I 0x6B 0x0F 0x6A

Expected I2C addresses (7-bit):

  • 0x1E LIS2MDL, 0x20 MCP23009E, 0x29 VL53L1X, 0x39 APDS9960
  • 0x3B STM32F103CB, 0x55 BQ27441, 0x5D WSEN-PADS
  • 0x5F HTS221/WSEN-HIDS, 0x6B ISM330DL

Note: MCP23009E requires releasing RST_EXPANDER pin before scan.

How to test

# Mock tests (no regression)
pytest tests/ -k mock

# Collect board tests (no hardware needed)
pytest tests/ -k board_i2c_scan --collect-only

# Run on hardware (requires STeaMi board)
pytest tests/ --port /dev/ttyACM0 -k board_i2c_scan -s -v

Test plan

  • ruff check tests/ — passed
  • pytest tests/ -k mock — 41 passed (no regression)
  • Board tests correctly collected and skipped without --port
  • Hardware validation on STeaMi board — 9 passed

@nedseb nedseb self-assigned this Mar 13, 2026
@nedseb nedseb requested a review from Copilot March 13, 2026 09:04
@nedseb nedseb added enhancement New feature or request test labels Mar 13, 2026
@nedseb nedseb linked an issue Mar 13, 2026 that may be closed by this pull request
Copy link
Copy Markdown
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

Adds a new board-level qualification YAML scenario to validate the STeaMi board’s internal I2C bus population by scanning I2C(1) on hardware and asserting that expected devices are present and no unknown devices appear (per #84, leveraging the “board scenario” framework from #89).

Changes:

  • Introduces board_i2c_scan board scenario with two hardware-only tests: (1) required-address presence and (2) no-unexpected-addresses check.
  • Encodes the expected/known I2C address sets directly in the scenario scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/scenarios/board_i2c_scan.yaml Outdated
Comment thread tests/scenarios/board_i2c_scan.yaml Outdated
@nedseb nedseb force-pushed the feature/board-i2c-scan branch from 5529dea to e56ada4 Compare March 13, 2026 09:14
@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 13, 2026

Corrections suite à la review Copilot (58277d9) :

  • Meilleur diagnostic : result retourne maintenant la liste des adresses manquantes/inattendues (triée) avec expect: [], au lieu d'un booléen. En cas d'échec, le message d'erreur affichera les adresses problématiques.

Copy link
Copy Markdown
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

Adds a new board-level qualification YAML scenario to validate the STeaMi board’s internal I2C bus by scanning for expected devices and performing a few identification-register sanity checks, leveraging the existing type: board scenario runner behavior.

Changes:

  • Introduces a new type: board scenario that scans I2C(1) and asserts a fixed set of expected/known addresses.
  • Adds per-device WHO_AM_I / ID-register reads for several components to confirm devices respond correctly beyond just presence on the bus.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/scenarios/board_i2c_scan.yaml
Comment thread tests/scenarios/board_i2c_scan.yaml
@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 13, 2026

Réponses aux commentaires Copilot :

expect_trueexpect: [] (commentaires 1 et 2) — Déjà corrigé dans un commit précédent : les tests retournent la liste des adresses manquantes/inattendues avec expect: [].

Adresses incohérentes avec la description PR (commentaire 3) — Corrigé : la description PR est mise à jour avec les bonnes adresses (0x3B=STM32F103CB, 0x6B=ISM330DL ajoutés, 0x5C retiré).

Tests WHO_AM_I non mentionnés (commentaire 4) — Corrigé : la description PR liste maintenant les 9 tests (2 scan + 7 WHO_AM_I/Device ID) avec un tableau détaillé des registres et valeurs attendues.

@nedseb nedseb merged commit b0699ff into feature/board-qualification-framework Mar 13, 2026
@nedseb nedseb deleted the feature/board-i2c-scan branch March 13, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Add board qualification test for I2C bus scan.

2 participants