I am trying to write a unit test that can be run on both the board and the native platform.
My platformio.ini for the native is:
[env]
framework = arduino
lib_deps =
envirodiy/SDI-12@2.1.4
https://github.com/DPIclimate/dpiclimate-12
monitor_speed = 115200
test_framework = googletest
[env:native]
platform = native
lib_compat_mode = off
lib_deps = googletest
When I try to run the tests I get:
$ pio test -e native
Verbosity level can be increased via `-v, -vv, or -vvv` option
Collected 1 tests
Processing test_utils in native environment
-----------------------------------------------------------------------------------------------
Building...
Please specify `board` in `platformio.ini` to use with 'arduino' framework
Building stage has failed, see errors above. Use `pio test -vvv` option to enable verbose output.
------------------------ native:test_utils [ERRORED] Took 0.22 seconds ------------------------
=========================================== SUMMARY ===========================================
Environment Test Status Duration
------------- ---------- -------- ------------
native test_utils ERRORED 00:00:00.223
========================== 1 test cases: 0 succeeded in 00:00:00.223 ==========================
The native platform has no boards, and doesn’t seem like it should need one.
I have been able to run the test by undefining ARDUINO and having a main() function rather than setup/loop, if I set ‘framework =’ (ie nothing).
What should my platformio.ini look like for the test to run on native under ArduinoFake?
Regards, David.