Browse Source

Test: move travis boards outside of hardware header (#1943)

* travis: move build flags tests outside of hardware header

* mqtt: fix typo

* travis: use files instead of bundling test cases into script

* fixup! travis: use files instead of bundling test cases into script

* fix variable expansion, remove custom h at the end

* add ade7953 to sensors list

* custom.h path as variable

* shellcheck

* fix printf syntax, silent again

* fix bash 4.3 treating empty array as unset variable
master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
d0a137ce94
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 213 additions and 236 deletions
  1. +4
    -7
      .travis.yml
  2. +53
    -0
      code/espurna/config/defaults.h
  3. +15
    -0
      code/espurna/config/dependencies.h
  4. +0
    -206
      code/espurna/config/hardware.h
  5. +11
    -10
      code/espurna/config/sensors.h
  6. +1
    -1
      code/espurna/mqtt.ino
  7. +7
    -12
      code/platformio.ini
  8. +1
    -0
      code/test/.gitignore
  9. +5
    -0
      code/test/build/basic.h
  10. +10
    -0
      code/test/build/emon.h
  11. +10
    -0
      code/test/build/light_dimmer.h
  12. +11
    -0
      code/test/build/light_my92xx.h
  13. +10
    -0
      code/test/build/nondefault.h
  14. +2
    -0
      code/test/build/secure_client.h
  15. +23
    -0
      code/test/build/sensor.h
  16. +39
    -0
      code/test_build.sh
  17. +11
    -0
      travis_script.sh

+ 4
- 7
.travis.yml View File

@ -1,8 +1,6 @@
language: python language: python
python: python:
- '2.7' - '2.7'
sudo: false
conditions: v1
cache: cache:
directories: directories:
- "~/.npm" - "~/.npm"
@ -18,7 +16,7 @@ env:
- ESPURNA_PIO_PATCH_ISSUE_1610=y - ESPURNA_PIO_PATCH_ISSUE_1610=y
- ESPURNA_PIO_SHARED_LIBRARIES=y - ESPURNA_PIO_SHARED_LIBRARIES=y
script: script:
- cd code && ./build.sh -p && cd ..
- ./travis_script.sh
stages: stages:
- name: Test - name: Test
- name: Release - name: Release
@ -26,10 +24,9 @@ stages:
jobs: jobs:
include: include:
- stage: Test - stage: Test
script: cd code && ./build.sh travis01
- script: cd code && ./build.sh travis02
- script: cd code && ./build.sh travis03
- script: cd code && ./build.sh travis04
env: BUILDER_ENV=travis-2_3_0
- env: BUILDER_ENV=travis-latest
- env: BUILDER_ENV=travis-git BUILDER_EXTRA=secure_client
- stage: Release - stage: Release
env: BUILDER_THREAD=0 env: BUILDER_THREAD=0
- env: BUILDER_THREAD=1 - env: BUILDER_THREAD=1


+ 53
- 0
code/espurna/config/defaults.h View File

@ -552,6 +552,31 @@
#define LED8_RELAY 8 #define LED8_RELAY 8
#endif #endif
#ifndef LED1_PIN_INVERSE
#define LED1_PIN_INVERSE 0
#endif
#ifndef LED2_PIN_INVERSE
#define LED2_PIN_INVERSE 0
#endif
#ifndef LED3_PIN_INVERSE
#define LED3_PIN_INVERSE 0
#endif
#ifndef LED4_PIN_INVERSE
#define LED4_PIN_INVERSE 0
#endif
#ifndef LED5_PIN_INVERSE
#define LED5_PIN_INVERSE 0
#endif
#ifndef LED6_PIN_INVERSE
#define LED6_PIN_INVERSE 0
#endif
#ifndef LED7_PIN_INVERSE
#define LED7_PIN_INVERSE 0
#endif
#ifndef LED8_PIN_INVERSE
#define LED8_PIN_INVERSE 0
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Digital Inputs // Digital Inputs
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -610,6 +635,34 @@
#define EVENTS8_PIN GPIO_NONE #define EVENTS8_PIN GPIO_NONE
#endif #endif
// -----------------------------------------------------------------------------
// Lights
// -----------------------------------------------------------------------------
#ifndef LIGHT_CHANNELS
#define LIGHT_CHANNELS 0
#endif
#ifndef LIGHT_CH1_INVERSE
#define LIGHT_CH1_INVERSE 0
#endif
#ifndef LIGHT_CH2_INVERSE
#define LIGHT_CH2_INVERSE 0
#endif
#ifndef LIGHT_CH3_INVERSE
#define LIGHT_CH3_INVERSE 0
#endif
#ifndef LIGHT_CH4_INVERSE
#define LIGHT_CH4_INVERSE 0
#endif
#ifndef LIGHT_CH5_INVERSE
#define LIGHT_CH5_INVERSE 0
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// General // General
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 15
- 0
code/espurna/config/dependencies.h View File

@ -91,3 +91,18 @@
#undef TELNET_SERVER_ASYNC_BUFFERED #undef TELNET_SERVER_ASYNC_BUFFERED
#define TELNET_SERVER_ASYNC_BUFFERED 1 // enable buffered telnet by default on latest Cores #define TELNET_SERVER_ASYNC_BUFFERED 1 // enable buffered telnet by default on latest Cores
#endif #endif
#if LLMNR_SUPPORT && defined(ARDUINO_ESP8266_RELEASE_2_3_0)
#undef LLMNR_SUPPORT
#define LLMNR_SUPPORT 0
#endif
#if NETBIOS_SUPPORT && defined(ARDUINO_ESP8266_RELEASE_2_3_0)
#undef NETBIOS_SUPPORT
#define NETBIOS_SUPPORT 0
#endif
#if SSDP_SUPPORT && defined(ARDUINO_ESP8266_RELEASE_2_3_0)
#undef SSDP_SUPPORT
#define SSDP_SUPPORT 0
#endif

+ 0
- 206
code/espurna/config/hardware.h View File

@ -4010,212 +4010,6 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// TEST boards (do not use!!)
// -----------------------------------------------------------------------------
#elif defined(TRAVIS01)
// Info
#define MANUFACTURER "TravisCI"
#define DEVICE "Virtual board 01"
// Some buttons - pin 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Some relays - pin 1
#define RELAY1_PIN 1
#define RELAY1_TYPE RELAY_TYPE_NORMAL
// Some LEDs - pin 2
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// A bit of I2C - pins 3,4
#define I2C_SDA_PIN 3
#define I2C_SCL_PIN 4
// And, as they say in "From Dusk till Dawn":
// This is a sensor blow out!
// Alright, we got white sensor, black sensor, spanish sensor, yellow sensor. We got hot sensor, cold sensor.
// We got wet sensor. We got smelly sensor. We got hairy sensor, bloody sensor. We got snapping sensor.
// We got silk sensor, velvet sensor, naugahyde sensor. We even got horse sensor, dog sensor, chicken sensor.
// C'mon, you want sensor, come on in sensor lovers!
// If we dont got it, you don't want it!
#define AM2320_SUPPORT 1
#define BH1750_SUPPORT 1
#define BMP180_SUPPORT 1
#define BMX280_SUPPORT 1
#define SHT3X_I2C_SUPPORT 1
#define EMON_ADC121_SUPPORT 1
#define EMON_ADS1X15_SUPPORT 1
#define SHT3X_I2C_SUPPORT 1
#define SI7021_SUPPORT 1
#define PMSX003_SUPPORT 1
#define SENSEAIR_SUPPORT 1
#define VL53L1X_SUPPORT 1
#define MAX6675_SUPPORT 1
// A bit of lights - pin 5
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
#define LIGHT_CHANNELS 1
#define LIGHT_CH1_PIN 5
#define LIGHT_CH1_INVERSE 0
#define ENCODER_SUPPORT 1
// A bit of HLW8012 - pins 6,7,8
#ifndef HLW8012_SUPPORT
#define HLW8012_SUPPORT 1
#endif
#define HLW8012_SEL_PIN 6
#define HLW8012_CF1_PIN 7
#define HLW8012_CF_PIN 8
// A bit of Dallas - pin 9
#ifndef DALLAS_SUPPORT
#define DALLAS_SUPPORT 1
#endif
#define DALLAS_PIN 9
// A bit of ECH1560 - pins 10,11, 12
#ifndef ECH1560_SUPPORT
#define ECH1560_SUPPORT 1
#endif
#define ECH1560_CLK_PIN 10
#define ECH1560_MISO_PIN 11
#define ECH1560_INVERTED 12
// MICS-2710 & MICS-5525 test
#define MICS2710_SUPPORT 1
#define MICS5525_SUPPORT 1
// MAX6675 14 11 10
#ifndef MAX6675_SUPPORT
#define MAX6675_SUPPORT 1
#endif
#define MAX6675_CS_PIN 14
#define MAX6675_SO_PIN 11
#define MAX6675_SCK_PIN 10
#elif defined(TRAVIS02)
// Relay provider dual
#define MANUFACTURER "TravisCI"
#define DEVICE "Virtual board 02"
// Some buttons - pin 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// A bit of CSE7766 - pin 1
#ifndef CSE7766_SUPPORT
#define CSE7766_SUPPORT 1
#endif
#define CSE7766_PIN 1
// Relay type dual - pins 2,3
#define RELAY_PROVIDER RELAY_PROVIDER_DUAL
#define RELAY1_PIN 2
#define RELAY2_PIN 3
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// IR - pin 4
#define IR_SUPPORT 1
#define IR_RX_PIN 4
#define IR_BUTTON_SET 1
// A bit of DHT - pin 5
#ifndef DHT_SUPPORT
#define DHT_SUPPORT 1
#endif
#define DHT_PIN 5
// A bit of TMP3X (analog)
#define TMP3X_SUPPORT 1
// A bit of EVENTS - pin 10
#define EVENTS_SUPPORT 1
#define EVENTS1_PIN 6
// Sonar
#define SONAR_SUPPORT 1
#define SONAR_TRIGGER 7
#define SONAR_ECHO 8
// MHZ19
#define MHZ19_SUPPORT 1
#define MHZ19_RX_PIN 9
#define MHZ19_TX_PIN 10
// PZEM004T
#define PZEM004T_SUPPORT 1
#define PZEM004T_RX_PIN 11
#define PZEM004T_TX_PIN 12
// V9261F
#define V9261F_SUPPORT 1
#define V9261F_PIN 13
// GUVAS12SD
#define GUVAS12SD_SUPPORT 1
#define GUVAS12SD_PIN 14
// Test non-default modules
#define MDNS_CLIENT_SUPPORT 1
#define NOFUSS_SUPPORT 1
#define UART_MQTT_SUPPORT 1
#define INFLUXDB_SUPPORT 1
#define IR_SUPPORT 1
#define RF_SUPPORT 1
#define OTA_MQTT_SUPPORT 1
#define RFB_DIRECT 1
#define RFB_RX_PIN 4
#elif defined(TRAVIS03)
// Relay provider light/my92XX
#define MANUFACTURER "TravisCI"
#define DEVICE "Virtual board 03"
// Some buttons - pin 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// MY9231 Light - pins 1,2
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
#define DUMMY_RELAY_COUNT 1
#define LIGHT_CHANNELS 5
#define MY92XX_MODEL MY92XX_MODEL_MY9231
#define MY92XX_CHIPS 2
#define MY92XX_DI_PIN 1
#define MY92XX_DCKI_PIN 2
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 4, 3, 5, 0, 1
// A bit of analog,
// will not work on real life since they all share GPIO
// but it's OK to test build
#define EMON_ANALOG_SUPPORT 1
#define NTC_SUPPORT 1
#define LDR_SUPPORT 1
#define PULSEMETER_SUPPORT 1
// Test non-default modules
#define LLMNR_SUPPORT 1
#define NETBIOS_SUPPORT 1
#define SSDP_SUPPORT 1
#define RF_SUPPORT 1
#else #else
#error "UNSUPPORTED HARDWARE!!" #error "UNSUPPORTED HARDWARE!!"


+ 11
- 10
code/espurna/config/sensors.h View File

@ -1198,10 +1198,12 @@
EMON_ADS1X15_SUPPORT || \ EMON_ADS1X15_SUPPORT || \
EMON_ANALOG_SUPPORT || \ EMON_ANALOG_SUPPORT || \
EVENTS_SUPPORT || \ EVENTS_SUPPORT || \
EZOPH_SUPPORT || \
GEIGER_SUPPORT || \ GEIGER_SUPPORT || \
GUVAS12SD_SUPPORT || \ GUVAS12SD_SUPPORT || \
HLW8012_SUPPORT || \ HLW8012_SUPPORT || \
LDR_SUPPORT || \ LDR_SUPPORT || \
MAX6675_SUPPORT || \
MICS2710_SUPPORT || \ MICS2710_SUPPORT || \
MICS5525_SUPPORT || \ MICS5525_SUPPORT || \
MHZ19_SUPPORT || \ MHZ19_SUPPORT || \
@ -1218,8 +1220,7 @@
V9261F_SUPPORT || \ V9261F_SUPPORT || \
VEML6075_SUPPORT || \ VEML6075_SUPPORT || \
VL53L1X_SUPPORT || \ VL53L1X_SUPPORT || \
MAX6675_SUPPORT || \
EZOPH_SUPPORT \
ADE7953_SUPPORT \
) )
#endif #endif
@ -1354,10 +1355,6 @@
#include "../sensors/MAX6675Sensor.h" #include "../sensors/MAX6675Sensor.h"
#endif #endif
#if MHZ19_SUPPORT
#include "../sensors/MHZ19Sensor.h"
#endif
#if MICS2710_SUPPORT #if MICS2710_SUPPORT
#include "../sensors/MICS2710Sensor.h" #include "../sensors/MICS2710Sensor.h"
#endif #endif
@ -1366,6 +1363,10 @@
#include "../sensors/MICS5525Sensor.h" #include "../sensors/MICS5525Sensor.h"
#endif #endif
#if MHZ19_SUPPORT
#include "../sensors/MHZ19Sensor.h"
#endif
#if NTC_SUPPORT #if NTC_SUPPORT
#include "../sensors/NTCSensor.h" #include "../sensors/NTCSensor.h"
#endif #endif
@ -1390,14 +1391,14 @@
#include "../sensors/PZEM004TSensor.h" #include "../sensors/PZEM004TSensor.h"
#endif #endif
#if SI7021_SUPPORT
#include "../sensors/SI7021Sensor.h"
#endif
#if SHT3X_I2C_SUPPORT #if SHT3X_I2C_SUPPORT
#include "../sensors/SHT3XI2CSensor.h" #include "../sensors/SHT3XI2CSensor.h"
#endif #endif
#if SI7021_SUPPORT
#include "../sensors/SI7021Sensor.h"
#endif
#if SONAR_SUPPORT #if SONAR_SUPPORT
#include "../sensors/SonarSensor.h" #include "../sensors/SonarSensor.h"
#endif #endif


+ 1
- 1
code/espurna/mqtt.ino View File

@ -160,7 +160,7 @@ void _mqttSetupAsyncClient(bool secure = false) {
WiFiClient& _mqttGetClient(bool secure) { WiFiClient& _mqttGetClient(bool secure) {
#if SECURE_CLIENT != SECURE_CLIENT_NONE #if SECURE_CLIENT != SECURE_CLIENT_NONE
return (secure ? _mqtt_client_secure->get() : _mqtt_client)
return (secure ? _mqtt_client_secure->get() : _mqtt_client);
#else #else
return _mqtt_client; return _mqtt_client;
#endif #endif


+ 7
- 12
code/platformio.ini View File

@ -204,25 +204,20 @@ upload_flags = ${common.ota_upload_flags}
# SPECIAL BUILDS - DO. NOT. USE. ever --- # SPECIAL BUILDS - DO. NOT. USE. ever ---
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:travis01]
platform = ${common.platform}
board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DTRAVIS01
[env:travis02]
platform = ${common.platform_latest}
[env:travis-2_3_0]
platform = ${common.arduino_core_2_3_0}
board = ${common.board_4m} board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DTRAVIS02
build_flags = ${common.build_flags_4m1m}
[env:travis03]
[env:travis-latest]
platform = ${common.platform_latest} platform = ${common.platform_latest}
board = ${common.board_4m} board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DTRAVIS03 -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
build_flags = ${common.build_flags_4m1m}
[env:travis04]
[env:travis-git]
platform = ${common.arduino_core_git} platform = ${common.arduino_core_git}
board = ${common.board_4m} board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DTRAVIS03 -DNOWSAUTH
build_flags = ${common.build_flags_4m1m}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# DEVELOPMENT BOARDS # DEVELOPMENT BOARDS


+ 1
- 0
code/test/.gitignore View File

@ -0,0 +1 @@
pio_cache

+ 5
- 0
code/test/build/basic.h View File

@ -0,0 +1,5 @@
#define LED1_PIN 0
#define RELAY1_PIN 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON
#define BUTTON1_RELAY 1

+ 10
- 0
code/test/build/emon.h View File

@ -0,0 +1,10 @@
#define EMON_ADC121_SUPPORT 1
#define EMON_ADS1X15_SUPPORT 1
#define CSE7766_SUPPORT 1
#define PZEM004T_SUPPORT 1
#define HLW8012_SUPPORT 1
#define ECH1560_SUPPORT 1
#define PULSEMETER_SUPPORT 1
#define V9261F_SUPPORT 1
#define ADE7953_SUPPORT 1
#define EMON_ANALOG_SUPPORT 1

+ 10
- 0
code/test/build/light_dimmer.h View File

@ -0,0 +1,10 @@
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
#define LIGHT_CHANNELS 5
#define LIGHT_CH1_PIN 5
#define LIGHT_CH2_PIN 4
#define LIGHT_CH3_PIN 12
#define LIGHT_CH4_PIN 13
#define LIGHT_CH5_PIN 14
#define IR_SUPPORT 1

+ 11
- 0
code/test/build/light_my92xx.h View File

@ -0,0 +1,11 @@
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
#define DUMMY_RELAY_COUNT 1
#define LIGHT_CHANNELS 5
#define MY92XX_MODEL MY92XX_MODEL_MY9231
#define MY92XX_CHIPS 2
#define MY92XX_DI_PIN 1
#define MY92XX_DCKI_PIN 2
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 4,3,5,0,1
#define IR_SUPPORT 1

+ 10
- 0
code/test/build/nondefault.h View File

@ -0,0 +1,10 @@
#define LLMNR_SUPPORT 1
#define NETBIOS_SUPPORT 1
#define SSDP_SUPPORT 1
#define RF_SUPPORT 1
#define RFB_DIRECT 1
#define MDNS_CLIENT_SUPPORT 1
#define NOFUSS_SUPPORT 1
#define UART_MQTT_SUPPORT 1
#define INFLUXDB_SUPPORT 1
#define OTA_MQTT_SUPPORT 1

+ 2
- 0
code/test/build/secure_client.h View File

@ -0,0 +1,2 @@
#define SECURE_CLIENT SECURE_CLIENT_BEARSSL
#define MQTT_LIBRARY MQTT_LIBRARY_ARDUINOMQTT

+ 23
- 0
code/test/build/sensor.h View File

@ -0,0 +1,23 @@
#define AM2320_SUPPORT 1
#define BH1750_SUPPORT 1
#define BMP180_SUPPORT 1
#define BMX280_SUPPORT 1
#define SHT3X_I2C_SUPPORT 1
#define SHT3X_I2C_SUPPORT 1
#define SI7021_SUPPORT 1
#define PMSX003_SUPPORT 1
#define SENSEAIR_SUPPORT 1
#define VL53L1X_SUPPORT 1
#define DALLAS_SUPPORT 1
#define MICS2710_SUPPORT 1
#define MICS5525_SUPPORT 1
#define MAX6675_SUPPORT 1
#define DHT_SUPPORT 1
#define TMP3X_SUPPORT 1
#define EVENTS_SUPPORT 1
#define DIGITAL_SUPPORT 1
#define SONAR_SUPPORT 1
#define MHZ19_SUPPORT 1
#define NTC_SUPPORT 1
#define LDR_SUPPORT 1
#define GUVAS12SD_SUPPORT 1

+ 39
- 0
code/test_build.sh View File

@ -0,0 +1,39 @@
#!/bin/bash
set -eu -o pipefail
CUSTOM_HEADER="espurna/config/custom.h"
TARGET_ENVIRONMENT=${1:?"pio env name"}
shift 1
CONFIGURATIONS=(
basic
sensor
emon
light_my92xx
light_dimmer
nondefault
)
if [ $# > 0 ] ; then
CONFIGURATIONS=("${CONFIGURATIONS[@]}" "$@")
fi
trap 'rm -f ${CUSTOM_HEADER}' EXIT
for cfg in "${CONFIGURATIONS[@]}" ; do
echo "travis_fold:start:build_${cfg}"
echo "- building ${cfg}"
printf "#define MANUFACTURER \"%s\"\n" "TEST_BUILD" \
| tee ${CUSTOM_HEADER}
printf "#define DEVICE \"%s\"\n" "${cfg^^}" \
| tee --append ${CUSTOM_HEADER}
tee --append ${CUSTOM_HEADER} < "test/build/${cfg}.h"
export PLATFORMIO_SRC_BUILD_FLAGS="-DUSE_CUSTOM_H"
export PLATFORMIO_BUILD_CACHE_DIR="test/pio_cache"
time pio run -s -e "$TARGET_ENVIRONMENT"
echo "travis_fold:end:build_${cfg}"
done

+ 11
- 0
travis_script.sh View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e -v
cd code
if [ ${TRAVIS_BUILD_STAGE_NAME} = "Test" ]; then
./test_build.sh $BUILDER_ENV $BUILDER_EXTRA
else
./build.sh -p
fi

Loading…
Cancel
Save