Merge branch 'feature/example_defconfig_ci' into 'master'

ci, examples: use sdkconfig.ci as an extra defaults file, if present

See merge request idf/esp-idf!3934
This commit is contained in:
Ivan Grokhotkov 2018-12-21 12:14:57 +08:00
commit 88dc626fd7
8 changed files with 55 additions and 11 deletions

View File

@ -1 +0,0 @@

View File

@ -0,0 +1,2 @@
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_BROKER_URL="FROM_STDIN"

View File

@ -1,7 +0,0 @@
CONFIG_BROKER_URL="FROM_STDIN"
CONFIG_LOG_DEFAULT_LEVEL_NONE=
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
CONFIG_LOG_DEFAULT_LEVEL_WARN=
CONFIG_LOG_DEFAULT_LEVEL_INFO=
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=

View File

@ -61,6 +61,7 @@ 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} touch ${LOG_SUSPECTED}
SDKCONFIG_DEFAULTS_CI=sdkconfig.ci
EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/" | sort ) EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/" | sort )
@ -132,6 +133,16 @@ build_example () {
export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS} export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
# sdkconfig files are normally not checked into git, but may be present when
# a developer runs this script locally
rm -f sdkconfig
# If sdkconfig.ci file is present, append it to sdkconfig.defaults,
# replacing environment variables
if [[ -f "$SDKCONFIG_DEFAULTS_CI" ]]; then
cat $SDKCONFIG_DEFAULTS_CI | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults
fi
# 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} touch ${BUILDLOG}

View File

@ -64,6 +64,7 @@ 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} touch ${LOG_SUSPECTED}
SDKCONFIG_DEFAULTS_CI=sdkconfig.ci
EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/" | sort ) EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/" | sort )
@ -122,6 +123,16 @@ build_example () {
export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS} export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
# sdkconfig files are normally not checked into git, but may be present when
# a developer runs this script locally
rm -f sdkconfig
# If sdkconfig.ci file is present, append it to sdkconfig.defaults,
# replacing environment variables
if [[ -f "$SDKCONFIG_DEFAULTS_CI" ]]; then
cat $SDKCONFIG_DEFAULTS_CI | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults
fi
# 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} touch ${BUILDLOG}
@ -130,7 +141,7 @@ build_example () {
idf.py fullclean >>${BUILDLOG} 2>&1 && idf.py fullclean >>${BUILDLOG} 2>&1 &&
idf.py build >>${BUILDLOG} 2>&1 idf.py build >>${BUILDLOG} 2>&1
else else
rm -rf build sdkconfig && rm -rf build &&
./build.sh >>${BUILDLOG} 2>&1 ./build.sh >>${BUILDLOG} 2>&1
fi && fi &&
cp build/flash_project_args build/download.config || # backwards compatible download.config filename cp build/flash_project_args build/download.config || # backwards compatible download.config filename

27
tools/ci/envsubst.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python
#
# A script similar to GNU envsubst, but filters out
# some CI related variables.
import os
import sys
def main():
# Sanitize environment variables
vars_to_remove = []
for var_name in os.environ.iterkeys():
if var_name.startswith('CI_'):
vars_to_remove.append(var_name)
for var_name in vars_to_remove:
del os.environ[var_name]
for line in sys.stdin:
if not line:
break
sys.stdout.write(os.path.expandvars(line))
sys.stdout.flush()
if __name__ == '__main__':
main()

View File

@ -21,6 +21,7 @@ tools/ci/build_examples_cmake.sh
tools/ci/check-executable.sh tools/ci/check-executable.sh
tools/ci/check-line-endings.sh tools/ci/check-line-endings.sh
tools/ci/checkout_project_ref.py tools/ci/checkout_project_ref.py
tools/ci/envsubst.py
tools/ci/get-full-sources.sh tools/ci/get-full-sources.sh
tools/ci/mirror-submodule-update.sh tools/ci/mirror-submodule-update.sh
tools/ci/mirror-synchronize.sh tools/ci/mirror-synchronize.sh

View File

@ -107,8 +107,8 @@ function(kconfig_process_config)
set(defaults_arg --defaults "${IDF_SDKCONFIG_DEFAULTS}") set(defaults_arg --defaults "${IDF_SDKCONFIG_DEFAULTS}")
endif() endif()
if(EXISTS "${SDKCONFIG_DEFAULTS}.${IDF_TARGET}") if(EXISTS "${IDF_SDKCONFIG_DEFAULTS}.${IDF_TARGET}")
list(APPEND defaults_arg --defaults "${SDKCONFIG_DEFAULTS}.${IDF_TARGET}") list(APPEND defaults_arg --defaults "${IDF_SDKCONFIG_DEFAULTS}.${IDF_TARGET}")
endif() endif()
# Set these in the parent scope, so that they can be written to project_description.json # Set these in the parent scope, so that they can be written to project_description.json