Issue for `platform = native` and `board =`

My platformio.ini looks like

[env]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_ldf_mode = deep
test_build_src = yes
test_framework = googletest
extra_scripts = pre:tools/extra/add_includes.py
lib_deps =
	vovagorodok/ArduinoBleChess@^0.7.2
	vovagorodok/ArduinoBleOTA@^2.0.6
	vovagorodok/ArduinoBleBattery@^1.0.1
	vovagorodok/ArduinoStreamLogger@^1.1.10
	vovagorodok/ArduinoBuzzer@^1.0.1
	vovagorodok/ArduinoPin@^1.2.2
	vovagorodok/ArrayUtils@^1.3.7
	vovagorodok/Servo@^1.0.0
	vovagorodok/PicChess@^0.9.1
	h2zero/NimBLE-Arduino@^1.4.3
	laurb9/StepperDriver@^1.4.1
	fastled/FastLED@^3.10.3
build_flags =
	-std=c++2a
	-std=gnu++2a
	-D LOG_LEVEL_TRACE
build_unflags =
	-std=gnu++11

[env:smart_leds_hardware]
build_flags =
	${env.build_flags}
	-D SMART_LEDS_BOARD
	...

[env:leds_hardware]
build_flags =
	${env.build_flags}
	-D LEDS_BOARD
	...

[env:motors_hardware]
build_flags =
	${env.build_flags}
	-D MOTORS_BOARD
	...

[env:test]
platform = native
board =
framework =
lib_deps =
	fabiobatsilva/ArduinoFake@^0.4.0
	vovagorodok/ArduinoBleChess@^0.7.2
	vovagorodok/ArduinoBleOTA@^2.0.6
	vovagorodok/ArduinoBleBattery@^1.0.1
	vovagorodok/ArduinoStreamLogger@^1.1.10
	vovagorodok/ArrayUtils@^1.3.7
	vovagorodok/PicChess@^0.9.1
...

For env:test I have an issue

Updating metadata for the vscode IDE...
UserSideException: Processing test (platform: native; board: ; framework: )
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Error: BoardConfig: Board is not defined
========================== [FAILED] Took 0.21 seconds ==========================

Line framework = successfully override framework = arduino of [env]. But board = doesn’t override

Don’t want to copy

platform = espressif32
board = esp32dev
framework = arduino

for each hardware, because all use same esp32dev

For native platform you don’t specify a board or a framework. See Native — PlatformIO latest documentation

But board = and framework = inherit from [env]. Will be nice to have possibility do disable board define like for framework in order to prepare environment for unit/module testing

Better use Interpolation of Values — PlatformIO latest documentation and extends — PlatformIO latest documentation to avoid this.

Don’t understand how it solve this case. Can You show example of solution?

To avoid the inheritence from [env] use interpolation of values and extends

Examples are included in the links I have posted above.

Changed structure to something like

[env]
lib_ldf_mode = deep
test_build_src = yes
extra_scripts = pre:tools/extra/add_includes.py

[hardware]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
	...
test_filter = test_hardware/*

[env:smart_leds_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D SMART_LEDS_BOARD
	...

[env:leds_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D LEDS_BOARD
	...

[env:motors_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D MOTORS_BOARD
	...

[env:test]
platform = native
lib_deps =
	...
test_filter = test_module/*

Added two filters for hardware tests test_filter = test_hardware/* and for module/unit tests test_filter = test_module/*.

But after adding test_filter line, test don’t want to run

Executing task: platformio test --environment smart_leds_hardware 

Verbosity level can be increased via `-v, -vv, or -vvv` option
Collected 1 tests

================================ 0 test cases: 0 succeeded in 00:00:00.000 ================================
 *  Terminal will be reused by tasks, press any key to close it. 

After removing line with test_filter all works correctly. Folders structure

test
  |_ test_hardware
     |_ main.cpp
  |_ test_module // planed to add
     |_ main.cpp

Looking to test_filter — PlatformIO latest documentation it should work. Same issue with test_ignore

@sivar2311 have You idea why test_filter doesn’t work, maybe here is an PlatformIO issue with that?

Does your test_filter expression and folder structure match the one found in official examples? https://github.com/platformio/platformio-examples/tree/develop/unit-testing/calculator

Looks that rename main.cpp as

test
  |_ test_hardware
     |_ test_hardware.cpp
  |_ test_module
     |_ test_module.cpp

resolve the issue.

How to filter more than one like this

test_filter =
   test_module
   test_module2

?

EDIT: Checked. Yes like this.

Final solution is using Interpolation of Values — PlatformIO latest documentation and extends — PlatformIO latest documentation

[env]
lib_ldf_mode = deep
test_build_src = yes
extra_scripts = pre:tools/extra/add_includes.py

[hardware]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
	...
test_filter = test_hardware

[env:smart_leds_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D SMART_LEDS_BOARD
	...

[env:leds_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D LEDS_BOARD
	...

[env:motors_hardware]
extends = hardware
build_flags =
	${env.build_flags}
	-D MOTORS_BOARD
	...

[env:test]
platform = native
lib_deps =
	...
test_filter =
	test_module
	test_module2

With folders structure as in https://github.com/platformio/platformio-examples/tree/develop/unit-testing/calculator

test
  |_ test_hardware
     |_ test_hardware.cpp
  |_ test_module
     |_ test_module.cpp
  |_ test_module2
     |_ test_module2.cpp

Thanks @sivar2311 @maxgerhardt