]> granicus.if.org Git - esp-idf/commitdiff
ci: additional Cmake tests for EXTRA_COMPONENT_DIRS
authorRenz Christian Bagaporo <renz@espressif.com>
Thu, 30 May 2019 10:23:00 +0000 (18:23 +0800)
committerRenz Christian Bagaporo <renz@espressif.com>
Tue, 4 Jun 2019 05:37:19 +0000 (13:37 +0800)
Tests from
https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/4253

tools/ci/test_build_system_cmake.sh

index 133afe2ab80ae5d28fbbca5aecf6721324984625..12f3a40f197b282aee8cd2d2904ed92250e3af99 100755 (executable)
@@ -423,6 +423,41 @@ endmenu\n" >> ${IDF_PATH}/Kconfig;
         || failure "Custom bootloader source files should be built instead of the original's"
     rm -rf components
 
+    print_status "Empty directory not treated as a component"
+    clean_build_dir
+    mkdir -p components/esp32 && idf.py reconfigure
+    ! grep "$PWD/components/esp32"  $PWD/build/project_description.json || failure "Failed to build with empty esp32 directory in components"
+    rm -rf components
+
+    print_status "If a component directory is added to COMPONENT_DIRS, its subdirectories are not added"
+    clean_build_dir
+    mkdir -p main/test
+    echo "idf_component_register()" > main/test/CMakeLists.txt
+    idf.py reconfigure
+    ! grep "$PWD/main/test" $PWD/build/project_description.json || failure "COMPONENT_DIRS has added component subdirectory to the build"
+    grep "$PWD/main" $PWD/build/project_description.json || failure "COMPONENT_DIRS parent component directory should be included in the build"
+    rm -rf main/test
+
+    print_status "If a component directory is added to COMPONENT_DIRS, its sibling directories are not added"
+    clean_build_dir
+    mkdir -p mycomponents/mycomponent 
+    echo "idf_component_register()" > mycomponents/mycomponent/CMakeLists.txt
+    # first test by adding single component directory to EXTRA_COMPONENT_DIRS
+    mkdir -p mycomponents/esp32
+    echo "idf_component_register()" > mycomponents/esp32/CMakeLists.txt
+    idf.py reconfigure -DEXTRA_COMPONENT_DIRS=$PWD/mycomponents/mycomponent 
+    ! grep "$PWD/mycomponents/esp32" $PWD/build/project_description.json || failure "EXTRA_COMPONENT_DIRS has added a sibling directory"
+    grep "$PWD/mycomponents/mycomponent" $PWD/build/project_description.json || failure "EXTRA_COMPONENT_DIRS valid sibling directory should be in the build"
+    rm -rf mycomponents/esp32
+    # now the same thing, but add a components directory
+    mkdir -p esp32
+    echo "idf_component_register()" > esp32/CMakeLists.txt
+    idf.py reconfigure -DEXTRA_COMPONENT_DIRS=$PWD/mycomponents 
+    ! grep "$PWD/esp32" $PWD/build/project_description.json || failure "EXTRA_COMPONENT_DIRS has added a sibling directory"
+    grep "$PWD/mycomponents/mycomponent" $PWD/build/project_description.json || failure "EXTRA_COMPONENT_DIRS valid sibling directory should be in the build"
+    rm -rf esp32
+    rm -rf mycomponents
+
     print_status "All tests completed"
     if [ -n "${FAILURES}" ]; then
         echo "Some failures were detected:"