From aaccfc4d9b4e2b566ff2ea6b48d1c71b80639957 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 17 Sep 2018 18:48:55 -0700 Subject: [PATCH 1/5] Add full debug builds for all tests In order to ensure the -DEBUG builds don't fail with checked-in code, add two jobs which build even/odd with full debug flags to Travis. Fixes #5143 --- .travis.yml | 4 ++++ tests/common.sh | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5d3f2f009..0e96fc0cb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,10 @@ matrix: - BUILD_TYPE=build_even - env: - BUILD_TYPE=build_odd + - env: + - BUILD_TYPE=debug_even + - env: + - BUILD_TYPE=debug_odd - env: - BUILD_TYPE=platformio - env: diff --git a/tests/common.sh b/tests/common.sh index 19f3bd5902..dd024e9d1b 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -103,6 +103,7 @@ function install_ide() { local ide_path=$1 local core_path=$2 + local debug=$3 wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz tar xf arduino.tar.xz mv arduino-nightly $ide_path @@ -110,9 +111,13 @@ function install_ide() mkdir esp8266com cd esp8266com ln -s $core_path esp8266 + local debug_flags="" + if [ "$debug" -eq "debug" ]; then + debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" + fi # Set custom warnings for all builds (i.e. could add -Wextra at some point) - echo "compiler.c.extra_flags=-Wall -Werror" > esp8266/platform.local.txt - echo "compiler.cpp.extra_flags=-Wall -Werror" >> esp8266/platform.local.txt + echo "compiler.c.extra_flags=-Wall -Werror $debug_flags" > esp8266/platform.local.txt + echo "compiler.cpp.extra_flags=-Wall -Werror $debug_flags" >> esp8266/platform.local.txt cd esp8266/tools python get.py export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH" @@ -197,10 +202,11 @@ function build_sketches_with_platformio() function install_arduino() { + local debug=$1 # Install Arduino IDE and required libraries echo -e "travis_fold:start:sketch_test_env_prepare" cd $TRAVIS_BUILD_DIR - install_ide $HOME/arduino_ide $TRAVIS_BUILD_DIR + install_ide $HOME/arduino_ide $TRAVIS_BUILD_DIR $debug which arduino cd $TRAVIS_BUILD_DIR install_libraries @@ -248,13 +254,19 @@ if [ -z "$TRAVIS_BUILD_DIR" ]; then fi if [ "$BUILD_TYPE" = "build" ]; then - install_arduino + install_arduino nodebug build_sketches_with_arduino 1 0 elif [ "$BUILD_TYPE" = "build_even" ]; then - install_arduino + install_arduino nodebug build_sketches_with_arduino 2 0 elif [ "$BUILD_TYPE" = "build_odd" ]; then - install_arduino + install_arduino nodebug + build_sketches_with_arduino 2 1 +elif [ "$BUILD_TYPE" = "debug_even" ]; then + install_arduino debug + build_sketches_with_arduino 2 0 +elif [ "$BUILD_TYPE" = "debug_odd" ]; then + install_arduino debug build_sketches_with_arduino 2 1 elif [ "$BUILD_TYPE" = "platformio" ]; then # PlatformIO From 916d913f44a92a0f6b70ab29c57ca504954a7e90 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 17 Sep 2018 18:58:32 -0700 Subject: [PATCH 2/5] Add in dump of platform.txt to verify build options --- tests/common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/common.sh b/tests/common.sh index dd024e9d1b..2ac4b7bc7f 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -118,6 +118,9 @@ function install_ide() # Set custom warnings for all builds (i.e. could add -Wextra at some point) echo "compiler.c.extra_flags=-Wall -Werror $debug_flags" > esp8266/platform.local.txt echo "compiler.cpp.extra_flags=-Wall -Werror $debug_flags" >> esp8266/platform.local.txt + echo -e "\n----platform.local.txt----" + cat esp8266/platform.local.txt + echo -e "\n----\n" cd esp8266/tools python get.py export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH" From c0f13ca601e943580f71e7e0690deb3e1f86cb70 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Tue, 18 Sep 2018 06:07:35 -0700 Subject: [PATCH 3/5] Fix BASH comparison of strings --- tests/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common.sh b/tests/common.sh index 2ac4b7bc7f..157bd266c3 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -112,7 +112,7 @@ function install_ide() cd esp8266com ln -s $core_path esp8266 local debug_flags="" - if [ "$debug" -eq "debug" ]; then + if [ "$debug" = "debug" ]; then debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" fi # Set custom warnings for all builds (i.e. could add -Wextra at some point) From 7c2ce263668ae0b2aa604175fbb8e9e7d012efac Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Tue, 18 Sep 2018 07:15:42 -0700 Subject: [PATCH 4/5] Fix debug-mode compile error in ESP8266AVRISP --- libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp index 5cc706109d..5742aff729 100644 --- a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp +++ b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp @@ -23,7 +23,13 @@ extern "C" { #include "mem.h" } +#ifdef malloc + #undef malloc +#endif #define malloc os_malloc +#ifdef free + #undef free +#endif #define free os_free // #define AVRISP_DEBUG(fmt, ...) os_printf("[AVRP] " fmt "\r\n", ##__VA_ARGS__ ) From 94941717b6b60f4691cb91730b7c4b367c7b510f Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Tue, 18 Sep 2018 19:06:58 -0700 Subject: [PATCH 5/5] Add -Wextra to CI (matches IDE "All" warnings) --- tests/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/common.sh b/tests/common.sh index 157bd266c3..c9e48309e2 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -116,8 +116,8 @@ function install_ide() debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" fi # Set custom warnings for all builds (i.e. could add -Wextra at some point) - echo "compiler.c.extra_flags=-Wall -Werror $debug_flags" > esp8266/platform.local.txt - echo "compiler.cpp.extra_flags=-Wall -Werror $debug_flags" >> esp8266/platform.local.txt + echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags" > esp8266/platform.local.txt + echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags" >> esp8266/platform.local.txt echo -e "\n----platform.local.txt----" cat esp8266/platform.local.txt echo -e "\n----\n"