Merge branch 'bugfix/ci_build_examples_more' into 'master'

CI build_examples: Fix build flakiness

See merge request !1191
This commit is contained in:
Angus Gratton 2017-09-04 16:02:12 +08:00
commit f487bb19d7
6 changed files with 44 additions and 22 deletions

View file

@ -142,6 +142,7 @@ build_esp_idf_tests:
script:
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
- rm -rf build_examples
- mkdir build_examples
- cd build_examples
# build some of examples
@ -162,6 +163,12 @@ build_examples_03:
build_examples_04:
<<: *build_examples_template
build_examples_05:
<<: *build_examples_template
build_examples_06:
<<: *build_examples_template
build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env
@ -228,8 +235,11 @@ test_build_system:
- build_test
dependencies: []
script:
- ./tools/ci/test_configure_ci_environment.sh
- ./tools/ci/test_build_system.sh
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
- rm -rf test_build_system
- mkdir test_build_system
- cd test_build_system
- ${IDF_PATH}/tools/ci/test_build_system.sh
test_report:
stage: test_report

View file

@ -118,6 +118,6 @@ ifndef CONFIG_SECURE_BOOT_ENABLED
all_binaries: $(BOOTLOADER_BIN)
endif
bootloader-clean:
bootloader-clean: $(SDKCONFIG_MAKEFILE)
$(BOOTLOADER_MAKE) app-clean
rm -f $(SECURE_BOOTLOADER_KEY) $(BOOTLOADER_DIGEST_BIN)

View file

@ -45,10 +45,18 @@ help:
# dependency checks
ifndef MAKE_RESTARTS
ifeq ("$(filter 4.% 3.81 3.82,$(MAKE_VERSION))","")
$(warning "esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.")
$(warning esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.)
endif
endif
# can't run 'clean' along with any non-clean targets
ifneq ("$(filter clean% %clean,$(MAKECMDGOALS))" ,"")
ifneq ("$(filter-out clean% %clean,$(MAKECMDGOALS))", "")
$(error esp-idf build system doesn't support running 'clean' targets along with any others. Run 'make clean' and then run other targets separately.)
endif
endif
# make IDF_PATH a "real" absolute path
# * works around the case where a shell character is embedded in the environment variable value.
# * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah
@ -361,10 +369,10 @@ endef
define GenerateComponentTargets
.PHONY: component-$(2)-build component-$(2)-clean
component-$(2)-build: check-submodules
component-$(2)-build: check-submodules $(call prereq_if_explicit, component-$(2)-clean) | $(BUILD_DIR_BASE)/$(2)
$(call ComponentMake,$(1),$(2)) build
component-$(2)-clean:
component-$(2)-clean: | $(BUILD_DIR_BASE)/$(2) $(BUILD_DIR_BASE)/$(2)/component_project_vars.mk
$(call ComponentMake,$(1),$(2)) clean
$(BUILD_DIR_BASE)/$(2):
@ -404,10 +412,11 @@ size-files: $(APP_ELF)
size-components: $(APP_ELF)
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP)
# NB: this ordering is deliberate (app-clean before config-clean),
# so config remains valid during all component clean targets
config-clean: app-clean
clean: config-clean
# NB: this ordering is deliberate (app-clean & bootloader-clean before
# _config-clean), so config remains valid during all component clean
# targets
config-clean: app-clean bootloader-clean
clean: app-clean bootloader-clean config-clean
# phony target to check if any git submodule listed in COMPONENT_SUBMODULES are missing
# or out of date, and exit if so. Components can add paths to this variable.

View file

@ -21,9 +21,9 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
$(MAKE) -C $(KCONFIG_TOOL_DIR)
ifeq ("$(wildcard $(SDKCONFIG))","")
ifeq ("$(filter defconfig, $(MAKECMDGOALS))","")
# if no configuration file is present and defconfig is not a named
# target, run defconfig then menuconfig to get the initial config
ifeq ("$(filter defconfig clean% %clean, $(MAKECMDGOALS))","")
# if no configuration file is present and defconfig or clean
# is not a named target, run defconfig then menuconfig to get the initial config
$(SDKCONFIG): menuconfig
menuconfig: defconfig
else

View file

@ -5,7 +5,7 @@
#
# Runs as part of CI process.
#
# Assumes CWD is an out-of-tree build directory, and will copy examples
# Assumes PWD is an out-of-tree build directory, and will copy examples
# to individual subdirectories, one by one.
#
#
@ -44,6 +44,8 @@ die() {
[ -z ${IDF_PATH} ] && die "IDF_PATH is not set"
echo "build_examples running in ${PWD}"
# only 0 or 1 arguments
[ $# -le 1 ] || die "Have to run as $(basename $0) [<JOB_NAME>]"
@ -55,7 +57,7 @@ RESULT=0
FAILED_EXAMPLES=""
RESULT_WARNINGS=22 # magic number result code for "warnings found"
LOG_WARNINGS=$(mktemp -t example_all.XXXX.log)
LOG_WARNINGS=${PWD}/build_warnings.log
if [ $# -eq 0 ]
then
@ -114,9 +116,10 @@ build_example () {
# build non-verbose first
local BUILDLOG=${PWD}/examplebuild.${ID}.log
(
MAKEFLAGS= make clean defconfig &> >(tee -a "${BUILDLOG}") &&
make all &> >(tee -a "${BUILDLOG}")
) || {
make MAKEFLAGS= clean &&
make MAKEFLAGS= defconfig &&
make all
) &> >(tee -a "${BUILDLOG}") || {
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"
make MAKEFLAGS= V=1 clean defconfig && make V=1 # verbose output for errors
}

View file

@ -3,11 +3,12 @@
# Test the build system for basic consistency
#
# A bash script that tests some likely make failure scenarios in a row
# Creates its own test build directory under TMP and cleans it up when done.
#
# Assumes PWD is an out-of-tree build directory, and will create a
# subdirectory inside it to run build tests in.
#
# Environment variables:
# IDF_PATH - must be set
# TMP - can override /tmp location for build directory
# ESP_IDF_TEMPLATE_GIT - Can override git clone source for template app. Otherwise github.
# NOCLEANUP - Set to '1' if you want the script to leave its temporary directory when done, for post-mortem.
#
@ -26,7 +27,6 @@
# Set up some variables
#
[ -z ${TMP} ] && TMP="/tmp"
# override ESP_IDF_TEMPLATE_GIT to point to a local dir if you're testing and want fast iterations
[ -z ${ESP_IDF_TEMPLATE_GIT} ] && ESP_IDF_TEMPLATE_GIT=https://github.com/espressif/esp-idf-template.git
@ -205,7 +205,7 @@ function failure()
FAILURES="${FAILURES}${STATUS} :: $1\n"
}
TESTDIR=${TMP}/build_system_tests_$$
TESTDIR=${PWD}/build_system_tests_$$
mkdir -p ${TESTDIR}
# set NOCLEANUP=1 if you want to keep the test directory around
# for post-mortem debugging