Files
L'électron rare f55093d6fe
ESP-IDF CI / Host Tests (Unity) (push) Successful in 1m8s
CI / firmware-native (push) Successful in 2m57s
Rust Protection Tests / Cargo test (host) (push) Failing after 3m21s
ESP-IDF CI / ESP-IDF Build (v5.4) (push) Failing after 6m55s
ESP-IDF CI / Memory Budget Gate (push) Has been skipped
qa-cicd-environments / qa-kxkm-s3-build (push) Successful in 8m53s
qa-cicd-environments / qa-sim-host (push) Successful in 2m2s
qa-cicd-environments / qa-kxkm-s3-memory-budget (push) Successful in 11m17s
chore: import KXKM Batterie Parallelator
Context: the project archive (KXKM_Batterie_Parallelator-main) had
no git history locally; a fresh repository is needed to host it on
git.saillant.cc (electron/KXKM_Batterie_Parallelator).

Approach: initialize a new repo on branch main, stage the archive
content, and harden .gitignore before the first commit.

Changes:
- Import the full project tree: firmware/, firmware-idf/,
  firmware-rs/, iosApp/, kxkm-bmu-app/, kxkm-api/, hardware/,
  docs/, specs/, scripts/, models/, tests/
- Keep project dotfiles tracked despite the trailing '.*' ignore
  rule: .github/, .claude/, .superpowers/, .gitattributes,
  .markdownlint.json
- Extend .gitignore: firmware/src/credentials.h (local secrets,
  template kept), kxkm-bmu-app/**/build/ (66 MB compiled iOS
  framework), .remember/ (session data)

Impact: the project can now be maintained on the self-hosted Gitea
forge with a clean, secret-free initial history.
2026-07-04 12:32:28 +02:00

1.8 KiB

Sim-Host Tests (PlatformIO)

13 tests Unity host-based, exécutés via pio test -e sim-host. Pas de hardware requis.

Running

pio test -e sim-host                # toutes les suites
pio test -e sim-host -f test_X      # une suite
pio test -e sim-host -vv            # verbose

Suites

Suite Tests Couvre
test_protection 10 V/I/imbalance/lock state machine
test_battery_route_validation - Index bounds + state checks
test_influx_buffer_codec - InfluxDB line-protocol
test_web_mutation_rate_limit 3 Sliding window + multi-IP
test_web_route_security 9 Constant-time token + Bearer
test_ws_auth_flow 7 Auth + rate limit combinés
test_mqtt_influx_codec 3 JSON MQTT + topic parsing
test_emulation_bench - Emulation benchmark

Tests test_tca_ina* : hardware-only, ERRORED en sim-host = normal (ignorer).

CRITICAL: build_src_filter

Le [env:sim-host] dans platformio.ini a un build_src_filter qui liste explicitement les .cpp compilés. Quand tu ajoutes un nouveau module testable, tu DOIS :

  1. Ajouter le .cpp au build_src_filter de [env:sim-host]
  2. Sinon le linker échoue : undefined reference to ...

Exemple :

[env:sim-host]
build_src_filter =
  +<*>
  -<.git/>
  -<.svn/>
  +<../src/MonNouveauModule.cpp>

Pattern

#include <unity.h>
void setUp() {}
void tearDown() {}
void test_my_func() { TEST_ASSERT_EQUAL(42, my_func()); }
int main() { UNITY_BEGIN(); RUN_TEST(test_my_func); return UNITY_END(); }

Anti-Patterns

  • Ne pas dépendre des libs Arduino (Wire, etc.) — stub manuellement
  • Ne pas tester l'I2C réel — mock les handlers
  • Ne pas mélanger code de test et code source dans le même fichier