From: Anton Maklakov Date: Tue, 30 Jul 2019 14:26:43 +0000 (+0700) Subject: tools: Fix the build examples script to run locally X-Git-Tag: v4.1-dev~31^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12403e39b43ead17e97336033407a74649c9fb5d;p=esp-idf tools: Fix the build examples script to run locally --- diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index 7393cb3024..9be1525b3f 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -62,9 +62,12 @@ SDKCONFIG_DEFAULTS_CI=sdkconfig.ci EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/" | sort ) -if [ -z {CI_NODE_TOTAL} ] +if [ -z "${CI_NODE_TOTAL:-}" ] then START_NUM=0 + if [ "${1:-}" ]; then + START_NUM=$1 + fi END_NUM=999 else JOB_NUM=${CI_NODE_INDEX} diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index da15bae725..cc5f3adc00 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -52,7 +52,7 @@ set -o nounset # Exit if variable not set. echo "build_examples running in ${PWD} for target $IDF_TARGET" # only 0 or 1 arguments -[ $# -le 1 ] || die "Have to run as $(basename $0) []" +[ $# -le 1 ] || die "Have to run as $(basename $0) []" export BATCH_BUILD=1 export V=0 # only build verbose if there's an error @@ -67,22 +67,26 @@ touch ${LOG_SUSPECTED} SDKCONFIG_DEFAULTS_CI=sdkconfig.ci EXAMPLE_PATHS=$( get_supported_examples.sh $IDF_TARGET | sed "s#^#${IDF_PATH}\/examples\/#g" | awk '{print $0"/CmakeLists.txt"}' ) +NUM_OF_EXAMPLES=$( echo "${EXAMPLE_PATHS}" | wc -l ) +# just a plausibility check +[ ${NUM_OF_EXAMPLES} -lt 100 ] && die "NUM_OF_EXAMPLES is bad" + echo "All examples found for target $IDF_TARGET:" echo $EXAMPLE_PATHS +echo "Number of examples: $NUM_OF_EXAMPLES" -if [ -z {CI_NODE_TOTAL} ] +if [ -z "${CI_NODE_TOTAL:-}" ] then START_NUM=0 - END_NUM=999 + if [ "${1:-}" ]; then + START_NUM=$1 + fi + END_NUM=${NUM_OF_EXAMPLES} else JOB_NUM=${CI_NODE_INDEX} # count number of the jobs NUM_OF_JOBS=${CI_NODE_TOTAL} - # count number of examples - NUM_OF_EXAMPLES=$( echo "${EXAMPLE_PATHS}" | wc -l ) - [ ${NUM_OF_EXAMPLES} -lt 100 ] && die "NUM_OF_EXAMPLES is bad" - # separate intervals #57 / 5 == 12 NUM_OF_EX_PER_JOB=$(( (${NUM_OF_EXAMPLES} + ${NUM_OF_JOBS} - 1) / ${NUM_OF_JOBS} ))