From 82c0fe32b0bf49b2005d0b520d563549d613f82c Mon Sep 17 00:00:00 2001 From: James Foster Date: Sat, 14 Nov 2020 20:45:14 -0800 Subject: [PATCH 1/3] Add test for #192: fatal error: 'Adafruit_SPIDevice.h' file not found --- SampleProjects/BusIO/.arduino-ci.yml | 12 ++++++ SampleProjects/BusIO/.gitignore | 1 + SampleProjects/BusIO/Gemfile | 2 + SampleProjects/BusIO/README.md | 4 ++ .../examples/spi_readwrite/spi_readwrite.ino | 39 +++++++++++++++++++ SampleProjects/BusIO/library.properties | 10 +++++ SampleProjects/BusIO/src/BusIO.h | 9 +++++ SampleProjects/BusIO/test/test.cpp | 17 ++++++++ exe/arduino_ci.rb | 0 9 files changed, 94 insertions(+) create mode 100644 SampleProjects/BusIO/.arduino-ci.yml create mode 100644 SampleProjects/BusIO/.gitignore create mode 100644 SampleProjects/BusIO/Gemfile create mode 100644 SampleProjects/BusIO/README.md create mode 100644 SampleProjects/BusIO/examples/spi_readwrite/spi_readwrite.ino create mode 100644 SampleProjects/BusIO/library.properties create mode 100644 SampleProjects/BusIO/src/BusIO.h create mode 100644 SampleProjects/BusIO/test/test.cpp mode change 100644 => 100755 exe/arduino_ci.rb diff --git a/SampleProjects/BusIO/.arduino-ci.yml b/SampleProjects/BusIO/.arduino-ci.yml new file mode 100644 index 00000000..2237cd47 --- /dev/null +++ b/SampleProjects/BusIO/.arduino-ci.yml @@ -0,0 +1,12 @@ +unittest: + platforms: + - mega2560 + libraries: + - "Adafruit BusIO" + # - "Adafruit_BusIO" <= This works if you have the library pre-installed + +compile: + platforms: + - mega2560 + libraries: + - "Adafruit BusIO" diff --git a/SampleProjects/BusIO/.gitignore b/SampleProjects/BusIO/.gitignore new file mode 100644 index 00000000..06de90aa --- /dev/null +++ b/SampleProjects/BusIO/.gitignore @@ -0,0 +1 @@ +.bundle \ No newline at end of file diff --git a/SampleProjects/BusIO/Gemfile b/SampleProjects/BusIO/Gemfile new file mode 100644 index 00000000..b2b3b1fd --- /dev/null +++ b/SampleProjects/BusIO/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'arduino_ci', path: '../../' diff --git a/SampleProjects/BusIO/README.md b/SampleProjects/BusIO/README.md new file mode 100644 index 00000000..86e2e642 --- /dev/null +++ b/SampleProjects/BusIO/README.md @@ -0,0 +1,4 @@ +# BusIO + +This is an example of a library that depends on Adafruit BusIO. +It is provided to help reproduce #192. diff --git a/SampleProjects/BusIO/examples/spi_readwrite/spi_readwrite.ino b/SampleProjects/BusIO/examples/spi_readwrite/spi_readwrite.ino new file mode 100644 index 00000000..6f2c063f --- /dev/null +++ b/SampleProjects/BusIO/examples/spi_readwrite/spi_readwrite.ino @@ -0,0 +1,39 @@ +#include + +#define SPIDEVICE_CS 10 +Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS); + + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("SPI device read and write test"); + + if (!spi_dev.begin()) { + Serial.println("Could not initialize SPI device"); + while (1); + } + + uint8_t buffer[32]; + + // Try to read 32 bytes + spi_dev.read(buffer, 32); + Serial.print("Read: "); + for (uint8_t i=0; i<32; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); + + // read a register by writing first, then reading + buffer[0] = 0x8F; // we'll reuse the same buffer + spi_dev.write_then_read(buffer, 1, buffer, 2, false); + Serial.print("Write then Read: "); + for (uint8_t i=0; i<2; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); +} + +void loop() { + +} diff --git a/SampleProjects/BusIO/library.properties b/SampleProjects/BusIO/library.properties new file mode 100644 index 00000000..964dc329 --- /dev/null +++ b/SampleProjects/BusIO/library.properties @@ -0,0 +1,10 @@ +name=BusIO +version=0.1.0 +author=James Foster +maintainer=James Foster +sentence=Sample BusIO library to validate import of Adafruit BusIO +paragraph=Sample BusIO library to validate import of Adafruit BusIO +category=Other +url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/BusIO +architectures=avr,esp8266 +includes=BusIO.h diff --git a/SampleProjects/BusIO/src/BusIO.h b/SampleProjects/BusIO/src/BusIO.h new file mode 100644 index 00000000..2ec22de0 --- /dev/null +++ b/SampleProjects/BusIO/src/BusIO.h @@ -0,0 +1,9 @@ +#include +#include + +class BusIO { +public: + BusIO() {} + ~BusIO() {} + int answer() { return 42; } +} diff --git a/SampleProjects/BusIO/test/test.cpp b/SampleProjects/BusIO/test/test.cpp new file mode 100644 index 00000000..7acb96a8 --- /dev/null +++ b/SampleProjects/BusIO/test/test.cpp @@ -0,0 +1,17 @@ +/* +bundle config --local path vendor/bundle +bundle install +bundle exec arduino_ci.rb --skip-examples-compilation +*/ + +#include +#include +#include + +unittest(loop) { + // token test + BusIO busIO; + assertEqual(42, busIO.answer())); +} + +unittest_main() diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb old mode 100644 new mode 100755 From 8826161ab75ef701986d4e6559d6df320e853b57 Mon Sep 17 00:00:00 2001 From: James Foster Date: Sat, 14 Nov 2020 22:32:21 -0800 Subject: [PATCH 2/3] Added note to `CHANGELOG.md` --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e3a9ab..1d9bcab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Definitions for Arduino zero - Support for mock EEPROM (but only if board supports it) - Add stubs for `Client.h`, `IPAddress.h`, `Printable.h`, `Server.h`, and `Udp.h` +- Sample project for `BusIO` to show problem finding header file ### Changed - Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci From adb17620ebe8fa44c72251389ca076e7a1fe261a Mon Sep 17 00:00:00 2001 From: James Foster Date: Mon, 16 Nov 2020 08:45:03 -0800 Subject: [PATCH 3/3] Run `BusIO` tests and demonstrate failurew. --- .travis.yml | 3 +++ appveyor.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 36067457..10ad40e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,3 +33,6 @@ script: - cd .. - bundle install - bundle exec arduino_ci.rb + - cd ../BusIO + - bundle install + - bundle exec arduino_ci.rb diff --git a/appveyor.yml b/appveyor.yml index d8576b06..599c36e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,3 +31,6 @@ test_script: - cd .. - bundle install - bundle exec arduino_ci.rb + - cd ../BusIO + - bundle install + - bundle exec arduino_ci.rb