My “production” code (i.e. the stuff that isn’t unit tests) is designed to run on an esp32dev board with a TFT connected via SPI using the TFT_eSPI library. It happens to send a bunch of circles flying across the screen, but that probably isn’t relevant. The key point is (I think) that the production code interacts with the TFT correctly.
I added a unit test (the only one in this project) for a class I’m developing. The unit tests won’t build, though. The build error says there’s a problem with an SPI library which I’m not even using.
platformio.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps = bodmer/TFT_eSPI@^2.5.33
lib_ldf_mode = chain
build_flags =
-Os
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
...
my test file
#include <unity.h>
#include <waves.h>
void setUp(void) {
// set stuff up here
}
void tearDown(void) {
// clean stuff up here
}
void interpolate_gives_correct_result()
{
Interpolator sut;
double result = sut.Interpolate(0, 100, 0.9);
TEST_ASSERT_EQUAL_DOUBLE(90, result);
}
int main( int argc, char **argv) {
UNITY_BEGIN();
UNITY_END();
}
the build error
Verbosity level can be increased via `-v, -vv, or -vvv` option
Collected 1 tests
Processing * in esp32dev environment
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building & Uploading...
In file included from .pio/libdeps/esp32dev/TFT_eSPI/TFT_eSPI.cpp:16:
.pio/libdeps/esp32dev/TFT_eSPI/TFT_eSPI.h:33:12: fatal error: SPI.h: No such file or directory
*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:SPI.h"
* Web > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************
#include <SPI.h>
^~~~~~~
compilation terminated.
*** [.pio/build/esp32dev/lib274/TFT_eSPI/TFT_eSPI.cpp.o] Error 1
Uploading stage has failed, see errors above. Use `pio test -vvv` option to enable verbose output.