From 79d6d9f7019b5d33ff7cb4ebedcbf49457be25c2 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 30 Dec 2016 15:20:49 +1100 Subject: [PATCH 1/3] CI build_examples: Correctly detect example build failures "pipefail" regression when fail-on-warnings was added... --- make/build_examples.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/make/build_examples.sh b/make/build_examples.sh index f1b37b7b4b..dc10d95ab2 100755 --- a/make/build_examples.sh +++ b/make/build_examples.sh @@ -30,10 +30,11 @@ for example in ${IDF_PATH}/examples/*; do # build non-verbose first BUILDLOG=$(mktemp -t examplebuild.XXXX.log) ( + set -o pipefail # so result of make all isn't lost when piping to tee set -e make clean defconfig - make all 2>&1 | tee $BUILDLOG - ) || (RESULT=$?; make V=1) # only build verbose if there's an error + make $* all 2>&1 | tee $BUILDLOG + ) || { RESULT=$?; make V=1; } # only build verbose if there's an error popd EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) From eb8324e2c280837aecde5d454ba52d663d3c77a8 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 30 Dec 2016 16:12:48 +1100 Subject: [PATCH 2/3] examples: Fix build errors that weren't being caught by CI --- examples/12_blufi/components/blufi/blufi.c | 1 + examples/12_blufi/main/demo_main.c | 14 +++++++------- .../{14_ethernet => 17_ethernet}/main/tlk110_phy.h | 0 3 files changed, 8 insertions(+), 7 deletions(-) rename examples/{14_ethernet => 17_ethernet}/main/tlk110_phy.h (100%) diff --git a/examples/12_blufi/components/blufi/blufi.c b/examples/12_blufi/components/blufi/blufi.c index 5a1c543b50..ce473667a4 100644 --- a/examples/12_blufi/components/blufi/blufi.c +++ b/examples/12_blufi/components/blufi/blufi.c @@ -30,6 +30,7 @@ #include "bt_trace.h" #include "bt_types.h" +#include "bta_api.h" #include "blufi.h" diff --git a/examples/12_blufi/main/demo_main.c b/examples/12_blufi/main/demo_main.c index f1c3807741..90992313c2 100644 --- a/examples/12_blufi/main/demo_main.c +++ b/examples/12_blufi/main/demo_main.c @@ -46,15 +46,15 @@ const int CONNECTED_BIT = BIT0; static wifi_config_t sta_config; static char tmp_ssid[33]; -static char tmp_passwd[33]; +static char tmp_passwd[65]; static bool confirm = false; void wifi_set_blue_config(char *ssid, char *passwd) { - memset(tmp_ssid, 0, 33); - memset(tmp_passwd, 0, 33); - strcpy(tmp_ssid, ssid); - strcpy(tmp_passwd, passwd); + memset(tmp_ssid, 0, sizeof(tmp_ssid)); + memset(tmp_passwd, 0, sizeof(tmp_passwd)); + strlcpy(tmp_ssid, ssid, sizeof(tmp_ssid)); + strlcpy(tmp_passwd, passwd, sizeof(tmp_passwd)); confirm = true; LOG_DEBUG("confirm true\n"); } @@ -105,8 +105,8 @@ void wifiTestTask(void *pvParameters) if (confirm) { confirm = false; - strcpy(sta_config.sta.ssid, tmp_ssid); - strcpy(sta_config.sta.password, tmp_passwd); + memcpy(sta_config.sta.ssid, tmp_ssid, sizeof(sta_config.sta.ssid)); + memcpy(sta_config.sta.password, tmp_passwd, sizeof(sta_config.sta.password)); sta_config.sta.bssid_set = 0; ret = esp_wifi_disconnect(); diff --git a/examples/14_ethernet/main/tlk110_phy.h b/examples/17_ethernet/main/tlk110_phy.h similarity index 100% rename from examples/14_ethernet/main/tlk110_phy.h rename to examples/17_ethernet/main/tlk110_phy.h From 6b87419d420427ef4cec012a784b046731b27714 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 30 Dec 2016 16:13:07 +1100 Subject: [PATCH 3/3] CI build_examples: Don't stop on first failed example, print failure summary --- make/build_examples.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/make/build_examples.sh b/make/build_examples.sh index dc10d95ab2..ab59208795 100755 --- a/make/build_examples.sh +++ b/make/build_examples.sh @@ -11,11 +11,10 @@ EXAMPLE_NUM=1 RESULT=0 +FAILED_EXAMPLES="" RESULT_WARNINGS=22 # magic number result code for "warnings found" -set -e - for example in ${IDF_PATH}/examples/*; do [ -f ${example}/Makefile ] || continue echo "Building ${example} as ${EXAMPLE_NUM}..." @@ -34,13 +33,13 @@ for example in ${IDF_PATH}/examples/*; do set -e make clean defconfig make $* all 2>&1 | tee $BUILDLOG - ) || { RESULT=$?; make V=1; } # only build verbose if there's an error + ) || { RESULT=$?; FAILED_EXAMPLES+=" ${example}"; make V=1; } # only build verbose if there's an error popd EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) - if [ $RESULT -eq 0 ] && grep -q ": warning:" $BUILDLOG; then - echo "Build will fail, due to warnings in this example" - RESULT=$RESULT_WARNINGS + if grep -q ": warning:" $BUILDLOG; then + [ $RESULT -eq 0 ] && RESULT=$RESULT_WARNINGS + FAILED_EXAMPLES+=" ${example} (warnings)" fi rm -f $BUILDLOG @@ -50,5 +49,7 @@ if [ $RESULT -eq $RESULT_WARNINGS ]; then echo "Build would have passed, except for warnings." fi +[ $RESULT -eq 0 ] || echo "Failed examples: $FAILED_EXAMPLES" + exit $RESULT