From f1f0bd4b1c4efde5ea2447db3ebf4c3e7c15ff73 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Wed, 7 Nov 2018 15:19:56 +0800 Subject: [PATCH] ci: update for running cmake examples --- .flake8 | 1 + tools/ci/build_examples.sh | 11 ++++---- tools/ci/build_examples_cmake.sh | 9 +++++-- tools/ci/check_examples_cmake_make.sh | 4 +-- tools/ci/executable-list.txt | 3 ++- tools/ci/mirror-list.txt | 39 ++++++++++++++------------- tools/ci/test_build_system_cmake.sh | 19 ++++++------- 7 files changed, 48 insertions(+), 38 deletions(-) diff --git a/.flake8 b/.flake8 index db94eed6fe..be4d0fd62b 100644 --- a/.flake8 +++ b/.flake8 @@ -33,6 +33,7 @@ exclude = components/mbedtls/mbedtls, components/expat/expat, components/unity/unity, + examples/build_system/cmake/import_lib/main/lib/tinyxml2 # temporary list (should be empty) components/app_update/dump_otadata.py, components/app_update/gen_empty_partition.py, diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index b17e5625e8..9ab8fee578 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -62,6 +62,8 @@ RESULT_ISSUES=22 # magic number result code for issues found LOG_SUSPECTED=${LOG_PATH}/common_log.txt touch ${LOG_SUSPECTED} +EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/" | sort ) + if [ $# -eq 0 ] then START_NUM=0 @@ -84,7 +86,7 @@ else [ -z ${NUM_OF_JOBS} ] && die "NUM_OF_JOBS is bad" # count number of examples - NUM_OF_EXAMPLES=$( find ${IDF_PATH}/examples/ -type f -name Makefile | wc -l ) + NUM_OF_EXAMPLES=$( echo "${EXAMPLE_PATHS}" | wc -l ) [ -z ${NUM_OF_EXAMPLES} ] && die "NUM_OF_EXAMPLES is bad" # separate intervals @@ -155,17 +157,16 @@ build_example () { EXAMPLE_NUM=0 -find ${IDF_PATH}/examples -type f -name Makefile | sort | \ -while read FN +for EXAMPLE_PATH in ${EXAMPLE_PATHS} do if [[ $EXAMPLE_NUM -lt $START_NUM || $EXAMPLE_NUM -ge $END_NUM ]] then EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) continue fi - echo ">>> example [ ${EXAMPLE_NUM} ] - $FN" + echo ">>> example [ ${EXAMPLE_NUM} ] - $EXAMPLE_PATH" - build_example "${EXAMPLE_NUM}" "${FN}" + build_example "${EXAMPLE_NUM}" "${EXAMPLE_PATH}" EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) done diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index 50ce7f1e61..8686219814 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -126,8 +126,13 @@ build_example () { local BUILDLOG=${LOG_PATH}/ex_${ID}_log.txt touch ${BUILDLOG} - idf.py fullclean >>${BUILDLOG} 2>&1 && - idf.py build >>${BUILDLOG} 2>&1 && + if [ "$EXAMPLE_NAME" != "idf_as_lib" ]; then + idf.py fullclean >>${BUILDLOG} 2>&1 && + idf.py build >>${BUILDLOG} 2>&1 + else + rm -rf build sdkconfig && + ./build.sh >>${BUILDLOG} 2>&1 + fi && cp build/flash_project_args build/download.config || # backwards compatible download.config filename { RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" ; diff --git a/tools/ci/check_examples_cmake_make.sh b/tools/ci/check_examples_cmake_make.sh index 28b5a5b245..64463ab214 100755 --- a/tools/ci/check_examples_cmake_make.sh +++ b/tools/ci/check_examples_cmake_make.sh @@ -2,8 +2,8 @@ # While we support GNU Make & CMake together, check the same examples are present for both -CMAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/") -MAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile ) +CMAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/main/" | grep -v "/build_system/cmake/") +MAKE_EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/") CMAKE_EXAMPLE_PATHS="$(/usr/bin/dirname $CMAKE_EXAMPLE_PATHS | sort -n)" MAKE_EXAMPLE_PATHS="$(/usr/bin/dirname $MAKE_EXAMPLE_PATHS | sort -n)" diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index 65f765fe2e..6c3756fe6f 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -66,4 +66,5 @@ components/espcoredump/test/test_espcoredump.py components/espcoredump/test/test_espcoredump.sh tools/ldgen/ldgen.py tools/ldgen/test/test_fragments.py -tools/ldgen/test/test_generation.py \ No newline at end of file +tools/ldgen/test/test_generation.py +examples/build_system/cmake/idf_as_lib/build.sh diff --git a/tools/ci/mirror-list.txt b/tools/ci/mirror-list.txt index 6c55df1733..9b9ac550a5 100644 --- a/tools/ci/mirror-list.txt +++ b/tools/ci/mirror-list.txt @@ -1,19 +1,20 @@ -components/esp32/lib @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git -components/bt/lib @GENERAL_MIRROR_SERVER@/idf/esp32-bt-lib.git -components/aws_iot/aws-iot-device-sdk-embedded-C @GENERAL_MIRROR_SERVER@/idf/aws-iot-device-sdk-embedded-C.git ALLOW_TO_SYNC_FROM_PUBLIC -components/coap/libcoap @GENERAL_MIRROR_SERVER@/idf/libcoap.git ALLOW_TO_SYNC_FROM_PUBLIC -components/esptool_py/esptool @GENERAL_MIRROR_SERVER@/idf/esptool.git ALLOW_TO_SYNC_FROM_PUBLIC -components/json/cJSON @GENERAL_MIRROR_SERVER@/idf/cJSON.git ALLOW_TO_SYNC_FROM_PUBLIC -components/libsodium/libsodium @GENERAL_MIRROR_SERVER@/idf/libsodium.git ALLOW_TO_SYNC_FROM_PUBLIC -components/mbedtls/mbedtls @GENERAL_MIRROR_SERVER@/idf/mbedtls.git ALLOW_TO_SYNC_FROM_PUBLIC -components/expat/expat @GENERAL_MIRROR_SERVER@/idf/libexpat.git ALLOW_TO_SYNC_FROM_PUBLIC -components/micro-ecc/micro-ecc @GENERAL_MIRROR_SERVER@/idf/micro-ecc.git ALLOW_TO_SYNC_FROM_PUBLIC -components/nghttp/nghttp2 @GENERAL_MIRROR_SERVER@/idf/nghttp2.git ALLOW_TO_SYNC_FROM_PUBLIC -components/spiffs/spiffs @GENERAL_MIRROR_SERVER@/idf/spiffs.git ALLOW_TO_SYNC_FROM_PUBLIC -components/asio/asio @GENERAL_MIRROR_SERVER@/idf/asio.git -components/lwip/lwip @GENERAL_MIRROR_SERVER@/idf/esp-lwip.git -third-party/mruby @GENERAL_MIRROR_SERVER@/idf/mruby.git ALLOW_TO_SYNC_FROM_PUBLIC -third-party/neverbleed @GENERAL_MIRROR_SERVER@/idf/neverbleed.git ALLOW_TO_SYNC_FROM_PUBLIC -components/mqtt/esp-mqtt @GENERAL_MIRROR_SERVER@/idf/esp-mqtt.git ALLOW_TO_SYNC_FROM_PUBLIC -components/protobuf-c/protobuf-c @GENERAL_MIRROR_SERVER@/idf/protobuf-c.git ALLOW_TO_SYNC_FROM_PUBLIC -components/unity/unity @GENERAL_MIRROR_SERVER@/idf/Unity.git ALLOW_TO_SYNC_FROM_PUBLIC \ No newline at end of file +components/esp32/lib @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git +components/bt/lib @GENERAL_MIRROR_SERVER@/idf/esp32-bt-lib.git +components/aws_iot/aws-iot-device-sdk-embedded-C @GENERAL_MIRROR_SERVER@/idf/aws-iot-device-sdk-embedded-C.git ALLOW_TO_SYNC_FROM_PUBLIC +components/coap/libcoap @GENERAL_MIRROR_SERVER@/idf/libcoap.git ALLOW_TO_SYNC_FROM_PUBLIC +components/esptool_py/esptool @GENERAL_MIRROR_SERVER@/idf/esptool.git ALLOW_TO_SYNC_FROM_PUBLIC +components/json/cJSON @GENERAL_MIRROR_SERVER@/idf/cJSON.git ALLOW_TO_SYNC_FROM_PUBLIC +components/libsodium/libsodium @GENERAL_MIRROR_SERVER@/idf/libsodium.git ALLOW_TO_SYNC_FROM_PUBLIC +components/mbedtls/mbedtls @GENERAL_MIRROR_SERVER@/idf/mbedtls.git ALLOW_TO_SYNC_FROM_PUBLIC +components/expat/expat @GENERAL_MIRROR_SERVER@/idf/libexpat.git ALLOW_TO_SYNC_FROM_PUBLIC +components/micro-ecc/micro-ecc @GENERAL_MIRROR_SERVER@/idf/micro-ecc.git ALLOW_TO_SYNC_FROM_PUBLIC +components/nghttp/nghttp2 @GENERAL_MIRROR_SERVER@/idf/nghttp2.git ALLOW_TO_SYNC_FROM_PUBLIC +components/spiffs/spiffs @GENERAL_MIRROR_SERVER@/idf/spiffs.git ALLOW_TO_SYNC_FROM_PUBLIC +components/asio/asio @GENERAL_MIRROR_SERVER@/idf/asio.git +components/lwip/lwip @GENERAL_MIRROR_SERVER@/idf/esp-lwip.git +third-party/mruby @GENERAL_MIRROR_SERVER@/idf/mruby.git ALLOW_TO_SYNC_FROM_PUBLIC +third-party/neverbleed @GENERAL_MIRROR_SERVER@/idf/neverbleed.git ALLOW_TO_SYNC_FROM_PUBLIC +components/mqtt/esp-mqtt @GENERAL_MIRROR_SERVER@/idf/esp-mqtt.git ALLOW_TO_SYNC_FROM_PUBLIC +components/protobuf-c/protobuf-c @GENERAL_MIRROR_SERVER@/idf/protobuf-c.git ALLOW_TO_SYNC_FROM_PUBLIC +components/unity/unity @GENERAL_MIRROR_SERVER@/idf/Unity.git ALLOW_TO_SYNC_FROM_PUBLIC +examples/build_system/cmake/import_lib/main/lib/tinyxml2 @GENERAL_MIRROR_SERVER@/idf/tinyxml2.git ALLOW_TO_SYNC_FROM_PUBLIC diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index 1e38e18900..1a73c16e63 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -58,6 +58,7 @@ function run_tests() BOOTLOADER_BINS="bootloader/bootloader.elf bootloader/bootloader.bin" APP_BINS="app-template.elf app-template.bin" PARTITION_BIN="partition_table/partition-table.bin" + IDF_COMPONENT_PREFIX="idf_component" print_status "Initial clean build" # if build fails here, everything fails @@ -71,14 +72,14 @@ function run_tests() take_build_snapshot touch ${IDF_PATH}/components/esp32/cpu_start.c idf.py build || failure "Failed to partial build" - assert_rebuilt ${APP_BINS} esp32/libesp32.a esp32/CMakeFiles/esp32.dir/cpu_start.c.obj - assert_not_rebuilt lwip/liblwip.a freertos/libfreertos.a ${BOOTLOADER_BINS} ${PARTITION_BIN} + assert_rebuilt ${APP_BINS} esp-idf/esp32/libesp32.a esp-idf/esp32/CMakeFiles/${IDF_COMPONENT_PREFIX}_esp32.dir/cpu_start.c.obj + assert_not_rebuilt esp-idf/lwip/liblwip.a esp-idf/freertos/libfreertos.a ${BOOTLOADER_BINS} ${PARTITION_BIN} print_status "Bootloader source file rebuilds bootloader" take_build_snapshot touch ${IDF_PATH}/components/bootloader/subproject/main/bootloader_start.c idf.py build || failure "Failed to partial build bootloader" - assert_rebuilt ${BOOTLOADER_BINS} bootloader/main/CMakeFiles/main.dir/bootloader_start.c.obj + assert_rebuilt ${BOOTLOADER_BINS} bootloader/esp-idf/main/CMakeFiles/${IDF_COMPONENT_PREFIX}_main.dir/bootloader_start.c.obj assert_not_rebuilt ${APP_BINS} ${PARTITION_BIN} print_status "Partition CSV file rebuilds partitions" @@ -172,9 +173,9 @@ function run_tests() assert_rebuilt config/sdkconfig.h # pick one each of .c, .cpp, .S that #includes sdkconfig.h # and therefore should rebuild - assert_rebuilt newlib/CMakeFiles/newlib.dir/syscall_table.c.obj - assert_rebuilt nvs_flash/CMakeFiles/nvs_flash.dir/src/nvs_api.cpp.obj - assert_rebuilt freertos/CMakeFiles/freertos.dir/xtensa_vectors.S.obj + assert_rebuilt esp-idf/newlib/CMakeFiles/${IDF_COMPONENT_PREFIX}_newlib.dir/syscall_table.c.obj + assert_rebuilt esp-idf/nvs_flash/CMakeFiles/${IDF_COMPONENT_PREFIX}_nvs_flash.dir/src/nvs_api.cpp.obj + assert_rebuilt esp-idf/freertos/CMakeFiles/${IDF_COMPONENT_PREFIX}_freertos.dir/xtensa_vectors.S.obj print_status "Updating project CMakeLists.txt triggers full recompile" clean_build_dir @@ -186,9 +187,9 @@ function run_tests() idf.py build || failure "Build failed" mv CMakeLists.bak CMakeLists.txt # similar to previous test - assert_rebuilt newlib/CMakeFiles/newlib.dir/syscall_table.c.obj - assert_rebuilt nvs_flash/CMakeFiles/nvs_flash.dir/src/nvs_api.cpp.obj - assert_rebuilt freertos/CMakeFiles/freertos.dir/xtensa_vectors.S.obj + assert_rebuilt esp-idf/newlib/CMakeFiles/${IDF_COMPONENT_PREFIX}_newlib.dir/syscall_table.c.obj + assert_rebuilt esp-idf/nvs_flash/CMakeFiles/${IDF_COMPONENT_PREFIX}_nvs_flash.dir/src/nvs_api.cpp.obj + assert_rebuilt esp-idf/freertos/CMakeFiles/${IDF_COMPONENT_PREFIX}_freertos.dir/xtensa_vectors.S.obj print_status "Can build with Ninja (no idf.py)" clean_build_dir