mirror of
https://github.com/espressif/esp-idf
synced 2025-03-11 18:19:07 -04:00
Merge branch 'bugfix/ci_log_examples' into 'master'
Fix a sporadic bug in building of the examples See merge request !1723
This commit is contained in:
commit
e798957d16
@ -141,15 +141,18 @@ build_esp_idf_tests:
|
|||||||
.build_examples_template: &build_examples_template
|
.build_examples_template: &build_examples_template
|
||||||
<<: *build_template
|
<<: *build_template
|
||||||
artifacts:
|
artifacts:
|
||||||
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- build_examples/*/*/*/build/*.bin
|
- build_examples/*/*/*/build/*.bin
|
||||||
- build_examples/*/*/*/build/*.elf
|
- build_examples/*/*/*/build/*.elf
|
||||||
- build_examples/*/*/*/build/*.map
|
- build_examples/*/*/*/build/*.map
|
||||||
- build_examples/*/*/*/build/download.config
|
- build_examples/*/*/*/build/download.config
|
||||||
- build_examples/*/*/*/build/bootloader/*.bin
|
- build_examples/*/*/*/build/bootloader/*.bin
|
||||||
|
- $LOG_PATH
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
variables:
|
variables:
|
||||||
IDF_CI_BUILD: "1"
|
IDF_CI_BUILD: "1"
|
||||||
|
LOG_PATH: "$CI_PROJECT_DIR/log_examples"
|
||||||
script:
|
script:
|
||||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||||
# mechanism work, but this is the next best thing
|
# mechanism work, but this is the next best thing
|
||||||
@ -157,6 +160,7 @@ build_esp_idf_tests:
|
|||||||
- mkdir build_examples
|
- mkdir build_examples
|
||||||
- cd build_examples
|
- cd build_examples
|
||||||
# build some of examples
|
# build some of examples
|
||||||
|
- mkdir -p ${LOG_PATH}
|
||||||
- ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
|
- ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
|
||||||
|
|
||||||
build_examples_00:
|
build_examples_00:
|
||||||
|
@ -121,4 +121,6 @@ endif
|
|||||||
|
|
||||||
bootloader-clean: $(SDKCONFIG_MAKEFILE)
|
bootloader-clean: $(SDKCONFIG_MAKEFILE)
|
||||||
$(BOOTLOADER_MAKE) app-clean
|
$(BOOTLOADER_MAKE) app-clean
|
||||||
|
ifdef CONFIG_SECURE_BOOTLOADER_REFLASHABLE
|
||||||
rm -f $(SECURE_BOOTLOADER_KEY) $(BOOTLOADER_DIGEST_BIN)
|
rm -f $(SECURE_BOOTLOADER_KEY) $(BOOTLOADER_DIGEST_BIN)
|
||||||
|
endif
|
||||||
|
@ -21,8 +21,7 @@ ifndef PARTITION_TABLE_CSV_PATH
|
|||||||
# Path to partition CSV file is relative to project path for custom
|
# Path to partition CSV file is relative to project path for custom
|
||||||
# partition CSV files, but relative to component dir otherwise.
|
# partition CSV files, but relative to component dir otherwise.
|
||||||
PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(COMPONENT_PATH)))
|
PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(COMPONENT_PATH)))
|
||||||
quote := "
|
PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(call dequote,$(CONFIG_PARTITION_TABLE_FILENAME))))
|
||||||
PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(subst $(quote),,$(CONFIG_PARTITION_TABLE_FILENAME))))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PARTITION_TABLE_CSV_NAME := $(notdir $(PARTITION_TABLE_CSV_PATH))
|
PARTITION_TABLE_CSV_NAME := $(notdir $(PARTITION_TABLE_CSV_PATH))
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files list-components
|
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files list-components
|
||||||
|
|
||||||
|
MAKECMDGOALS ?= all
|
||||||
all: all_binaries
|
all: all_binaries
|
||||||
# see below for recipe of 'all' target
|
# see below for recipe of 'all' target
|
||||||
#
|
#
|
||||||
@ -326,20 +328,19 @@ endif
|
|||||||
|
|
||||||
export CFLAGS CPPFLAGS CXXFLAGS
|
export CFLAGS CPPFLAGS CXXFLAGS
|
||||||
|
|
||||||
|
# Set default values that were not previously defined
|
||||||
|
CC ?= gcc
|
||||||
|
LD ?= ld
|
||||||
|
AR ?= ar
|
||||||
|
OBJCOPY ?= objcopy
|
||||||
|
SIZE ?= size
|
||||||
|
|
||||||
# Set host compiler and binutils
|
# Set host compiler and binutils
|
||||||
HOSTCC := $(CC)
|
HOSTCC := $(CC)
|
||||||
HOSTLD := $(LD)
|
HOSTLD := $(LD)
|
||||||
HOSTAR := $(AR)
|
HOSTAR := $(AR)
|
||||||
ifdef OBJCOPY
|
|
||||||
HOSTOBJCOPY := $(OBJCOPY)
|
HOSTOBJCOPY := $(OBJCOPY)
|
||||||
else
|
|
||||||
HOSTOBJCOPY := objcopy
|
|
||||||
endif
|
|
||||||
ifdef SIZE
|
|
||||||
HOSTSIZE := $(SIZE)
|
HOSTSIZE := $(SIZE)
|
||||||
else
|
|
||||||
HOSTSIZE := size
|
|
||||||
endif
|
|
||||||
export HOSTCC HOSTLD HOSTAR HOSTOBJCOPY SIZE
|
export HOSTCC HOSTLD HOSTAR HOSTOBJCOPY SIZE
|
||||||
|
|
||||||
# Set target compiler. Defaults to whatever the user has
|
# Set target compiler. Defaults to whatever the user has
|
||||||
|
@ -43,6 +43,7 @@ die() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ -z ${IDF_PATH} ] && die "IDF_PATH is not set"
|
[ -z ${IDF_PATH} ] && die "IDF_PATH is not set"
|
||||||
|
[ -z ${LOG_PATH} ] && die "LOG_PATH is not set"
|
||||||
|
|
||||||
echo "build_examples running in ${PWD}"
|
echo "build_examples running in ${PWD}"
|
||||||
|
|
||||||
@ -53,11 +54,11 @@ export BATCH_BUILD=1
|
|||||||
export V=0 # only build verbose if there's an error
|
export V=0 # only build verbose if there's an error
|
||||||
|
|
||||||
shopt -s lastpipe # Workaround for Bash to use variables in loops (http://mywiki.wooledge.org/BashFAQ/024)
|
shopt -s lastpipe # Workaround for Bash to use variables in loops (http://mywiki.wooledge.org/BashFAQ/024)
|
||||||
|
|
||||||
RESULT=0
|
RESULT=0
|
||||||
FAILED_EXAMPLES=""
|
FAILED_EXAMPLES=""
|
||||||
|
RESULT_ISSUES=22 # magic number result code for issues found
|
||||||
RESULT_WARNINGS=22 # magic number result code for "warnings found"
|
LOG_SUSPECTED=${LOG_PATH}/common_log.txt
|
||||||
LOG_WARNINGS=${PWD}/build_warnings.log
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
@ -114,26 +115,18 @@ build_example () {
|
|||||||
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||||
|
|
||||||
# build non-verbose first
|
# build non-verbose first
|
||||||
local BUILDLOG=${PWD}/examplebuild.${ID}.log
|
local BUILDLOG=${LOG_PATH}/ex_${ID}_log.txt
|
||||||
(
|
(
|
||||||
make MAKEFLAGS= clean &&
|
make clean &&
|
||||||
make MAKEFLAGS= defconfig &&
|
make defconfig &&
|
||||||
make all &&
|
make all &&
|
||||||
make print_flash_cmd | tail -n 1 > build/download.config
|
make print_flash_cmd | tail -n 1 > build/download.config
|
||||||
) &> >(tee -a "${BUILDLOG}") || {
|
) &> >(tee -a "${BUILDLOG}") || {
|
||||||
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"
|
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"
|
||||||
make MAKEFLAGS= V=1 clean defconfig && make V=1 # verbose output for errors
|
|
||||||
}
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
if grep ": warning:" "${BUILDLOG}" 2>&1 >> "${LOG_WARNINGS}"; then
|
grep -i "error\|warning" "${BUILDLOG}" 2>&1 >> "${LOG_SUSPECTED}" || :
|
||||||
[ $RESULT -eq 0 ] && RESULT=$RESULT_WARNINGS
|
|
||||||
FAILED_EXAMPLES+=" ${EXAMPLE_NAME} (warnings)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep -i error "${BUILDLOG}" 2>&1 >> "${LOG_WARNINGS}" || :
|
|
||||||
|
|
||||||
rm -f "${BUILDLOG}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXAMPLE_NUM=0
|
EXAMPLE_NUM=0
|
||||||
@ -155,15 +148,17 @@ done
|
|||||||
|
|
||||||
# show warnings
|
# show warnings
|
||||||
echo -e "\nFound issues:"
|
echo -e "\nFound issues:"
|
||||||
# pattern is: not 'error.o' and not '-Werror'
|
|
||||||
grep -v "error.o\|\-Werror" -- "${LOG_WARNINGS}" || echo -e "\tNone"
|
|
||||||
rm -f "${LOG_WARNINGS}"
|
|
||||||
|
|
||||||
if [ $RESULT -eq $RESULT_WARNINGS ]; then
|
# Ignore the next messages:
|
||||||
echo "Build would have passed, except for warnings."
|
# "error.o" or "-Werror" in compiler's command line
|
||||||
fi
|
# "reassigning to symbol" or "changes choice state" in sdkconfig
|
||||||
|
sort -u "${LOG_SUSPECTED}" | \
|
||||||
|
grep -v "library/error.o\|\ -Werror\|reassigning to symbol\|changes choice state" \
|
||||||
|
&& RESULT=$RESULT_ISSUES \
|
||||||
|
|| echo -e "\tNone"
|
||||||
|
|
||||||
[ $RESULT -eq 0 ] || echo "Failed examples: $FAILED_EXAMPLES"
|
[ -z ${FAILED_EXAMPLES} ] || echo -e "\nThere are errors in the next examples: $FAILED_EXAMPLES"
|
||||||
|
[ $RESULT -eq 0 ] || echo -e "\nFix all warnings and errors above to pass the test!"
|
||||||
|
|
||||||
echo -e "\nReturn code = $RESULT"
|
echo -e "\nReturn code = $RESULT"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user