mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
test: add native Unity env with Utils tests
Adds an [env:native] for host-side unit tests (pio test -e native) with a minimal Arduino.h stub, and covers the Utils helpers: _trim, toBoolean, SETCHARPROP, sortArray and the Timestamp conversions. The firmware envs now extend a shared [esp32] section instead of [env] so the native env doesn't inherit the Arduino framework, the ESP32 libraries or the build scripts. The half-hour calcTZOffset cases fail: +05:30 comes back as 2300. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1f394ca9df
commit
52c67b12f8
3 changed files with 242 additions and 4 deletions
|
|
@ -12,9 +12,13 @@
|
|||
default_envs = esp32devdbg
|
||||
src_dir = src
|
||||
|
||||
[env]
|
||||
; Shared by every firmware env (they extend it). Kept out of [env] so the
|
||||
; native test env doesn't inherit the Arduino framework and ESP32 libraries.
|
||||
[esp32]
|
||||
platform = espressif32 @ 6.13.0
|
||||
framework = arduino
|
||||
; Unit tests only run on the PC: pio test -e native
|
||||
test_ignore = *
|
||||
lib_deps =
|
||||
bblanchon/ArduinoJson@^7.2.2
|
||||
lsatan/SmartRC-CC1101-Driver-Lib@^2.5.7
|
||||
|
|
@ -43,35 +47,40 @@ monitor_filters =
|
|||
; task on core 1 (with loop()) never competes with network handling.
|
||||
[dualcore]
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${esp32.build_flags}
|
||||
-DCONFIG_ASYNC_TCP_RUNNING_CORE=0
|
||||
|
||||
[env:esp32dev]
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
board_build.partitions = esp32_3MB.csv
|
||||
build_flags = ${dualcore.build_flags}
|
||||
|
||||
[env:esp32devdbg]
|
||||
extends = esp32
|
||||
board = esp32dev
|
||||
build_type = debug
|
||||
board_build.partitions = esp32_3MB.csv
|
||||
build_flags = ${dualcore.build_flags}
|
||||
|
||||
[env:esp32c3]
|
||||
extends = esp32
|
||||
board = esp32-c3-devkitm-1
|
||||
board_build.partitions = esp32_3MB.csv
|
||||
|
||||
[env:esp32s3]
|
||||
extends = esp32
|
||||
board = esp32-s3-devkitc-1
|
||||
build_flags = ${dualcore.build_flags}
|
||||
|
||||
[env:esp32c6]
|
||||
extends = esp32
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
board = seeed_xiao_esp32c6
|
||||
build_type = debug
|
||||
board_build.partitions = esp32_huge_app.csv
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
build_flags =
|
||||
${esp32.build_flags}
|
||||
-DCONFIG_FREERTOS_HZ=1000
|
||||
-include "driver/gpio.h"
|
||||
lib_deps =
|
||||
|
|
@ -86,3 +95,15 @@ lib_deps =
|
|||
; High-level wrappers/servers
|
||||
ESP32Async/ESPAsyncWebServer
|
||||
|
||||
; Host-side unit tests: pio test -e native (needs gcc/g++ on PATH).
|
||||
; Only the sources the tests cover are built; test/stubs stands in for Arduino.h.
|
||||
[env:native]
|
||||
platform = native
|
||||
test_framework = unity
|
||||
test_build_src = yes
|
||||
build_src_filter = -<*> +<Utils.cpp>
|
||||
build_flags =
|
||||
-std=gnu++17
|
||||
-Isrc
|
||||
-Itest/stubs
|
||||
-D_POSIX_THREAD_SAFE_FUNCTIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue