CI: Fix an occasional error caused by reordering the commands along with 'tee' in the script

This commit is contained in:
Anton Maklakov 2018-01-05 12:38:44 +08:00
parent 30aacb79d5
commit b902d00fa0

View file

@ -44,6 +44,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" [ -z ${LOG_PATH} ] && die "LOG_PATH is not set"
[ -d ${LOG_PATH} ] || mkdir -p ${LOG_PATH}
echo "build_examples running in ${PWD}" echo "build_examples running in ${PWD}"
@ -59,6 +60,7 @@ RESULT=0
FAILED_EXAMPLES="" FAILED_EXAMPLES=""
RESULT_ISSUES=22 # magic number result code for issues found RESULT_ISSUES=22 # magic number result code for issues found
LOG_SUSPECTED=${LOG_PATH}/common_log.txt LOG_SUSPECTED=${LOG_PATH}/common_log.txt
touch ${LOG_SUSPECTED}
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
@ -116,14 +118,17 @@ build_example () {
# build non-verbose first # build non-verbose first
local BUILDLOG=${LOG_PATH}/ex_${ID}_log.txt local BUILDLOG=${LOG_PATH}/ex_${ID}_log.txt
( touch ${BUILDLOG}
make clean &&
make defconfig && make clean >>${BUILDLOG} 2>&1 &&
make all && make defconfig >>${BUILDLOG} 2>&1 &&
make print_flash_cmd | tail -n 1 > build/download.config make all >>${BUILDLOG} 2>&1 &&
) &> >(tee -a "${BUILDLOG}") || { ( make print_flash_cmd | tail -n 1 >build/download.config ) >>${BUILDLOG} 2>&1 ||
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" {
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" ;
} }
cat ${BUILDLOG}
popd popd
grep -i "error\|warning" "${BUILDLOG}" 2>&1 >> "${LOG_SUSPECTED}" || : grep -i "error\|warning" "${BUILDLOG}" 2>&1 >> "${LOG_SUSPECTED}" || :