I would like to use googletest in order to unit test my arduino due code on the native
platform. My platformio.ini
looks like this:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:due]
platform = atmelsam
board = due
framework = arduino
test_framework = unity
test_ignore = native/*
lib_deps =
Wire
SPI
adafruit/Adafruit ADS1X15@^2.4.0
adafruit/Adafruit MCP23017 Arduino Library@^2.3.0
adafruit/Adafruit BusIO@^1.14.1
[env:native]
platform=native
test_framework=googletest
test_ignore = due/*
lib_deps =
Wire
SPI
adafruit/Adafruit ADS1X15@^2.4.0
adafruit/Adafruit MCP23017 Arduino Library@^2.3.0
adafruit/Adafruit BusIO@^1.14.1
Now, the test/native/test_mymodule.cpp
file includes <gtest/gtest.h>
as well as <mymodule.h>
which is located at lib/mymodlue/mymodule.h
. The file mymodule.h
includes <Adafruit_MCP23X08.h>
, which is listed in the lib_deps
for the native environment. However, if I run pio test -e native
, I get the following error:
lib\mymodule/mymodule.h:5:10: fatal error: Adafruit_MCP23X08.h: No such file or directory
Why is this file not found? Also, is it even possible to test code in the native env that includes Arduino libraries?