mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
add new command to idf
This commit is contained in:
@@ -758,7 +758,7 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
|
||||
clean_build_dir
|
||||
mkdir -p components/esp32
|
||||
echo "idf_component_get_property(overriden_dir \${COMPONENT_NAME} COMPONENT_OVERRIDEN_DIR)" >> components/esp32/CMakeLists.txt
|
||||
echo "message(STATUS overriden_dir:\${overriden_dir})" >> components/esp32/CMakeLists.txt
|
||||
echo "message(STATUS overriden_dir:\${overriden_dir})" >> components/esp32/CMakeLists.txt
|
||||
(idf.py reconfigure | grep "overriden_dir:$IDF_PATH/components/esp32") || failure "Failed to get overriden dir" # no registration, overrides registration as well
|
||||
print_status "Overriding Kconfig"
|
||||
echo "idf_component_register(KCONFIG \${overriden_dir}/Kconfig)" >> components/esp32/CMakeLists.txt
|
||||
@@ -767,6 +767,44 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
|
||||
(idf.py reconfigure | grep "kconfig:$IDF_PATH/components/esp32/Kconfig") || failure "Failed to verify original `main` directory"
|
||||
rm -rf components
|
||||
|
||||
print_status "Create project using idf.py and build it"
|
||||
echo "Trying to create project."
|
||||
(idf.py -C projects create-project temp_test_project) || failure "Failed to create the project."
|
||||
cd "$IDF_PATH/projects/temp_test_project"
|
||||
echo "Building the project temp_test_project . . ."
|
||||
idf.py build || failure "Failed to build the project."
|
||||
cd "$IDF_PATH"
|
||||
rm -rf "$IDF_PATH/projects/temp_test_project"
|
||||
|
||||
print_status "Create component using idf.py, create project using idf.py."
|
||||
print_status "Add the component to the created project and build the project."
|
||||
echo "Trying to create project . . ."
|
||||
(idf.py -C projects create-project temp_test_project) || failure "Failed to create the project."
|
||||
echo "Trying to create component . . ."
|
||||
(idf.py -C components create-component temp_test_component) || failure "Failed to create the component."
|
||||
${SED} -i '5i\\tfunc();' "$IDF_PATH/projects/temp_test_project/main/temp_test_project.c"
|
||||
${SED} -i '5i#include "temp_test_component.h"' "$IDF_PATH/projects/temp_test_project/main/temp_test_project.c"
|
||||
cd "$IDF_PATH/projects/temp_test_project"
|
||||
idf.py build || failure "Failed to build the project."
|
||||
cd "$IDF_PATH"
|
||||
rm -rf "$IDF_PATH/projects/temp_test_project"
|
||||
rm -rf "$IDF_PATH/components/temp_test_component"
|
||||
|
||||
print_status "Check that command for creating new project will fail if the target folder is not empty."
|
||||
mkdir "$IDF_PATH/example_proj/"
|
||||
touch "$IDF_PATH/example_proj/tmp_130698"
|
||||
EXPECTED_EXIT_VALUE=3
|
||||
expected_failure $EXPECTED_EXIT_VALUE idf.py create-project --path "$IDF_PATH/example_proj/" temp_test_project || failure "Command exit value is wrong."
|
||||
rm -rf "$IDF_PATH/example_proj/"
|
||||
|
||||
print_status "Check that command for creating new project will fail if the target path is file."
|
||||
touch "$IDF_PATH/example_proj"
|
||||
EXPECTED_EXIT_VALUE=4
|
||||
expected_failure $EXPECTED_EXIT_VALUE idf.py create-project --path "$IDF_PATH/example_proj" temp_test_project || failure "Command exit value is wrong."
|
||||
rm -rf "$IDF_PATH/example_proj"
|
||||
|
||||
|
||||
|
||||
print_status "All tests completed"
|
||||
if [ -n "${FAILURES}" ]; then
|
||||
echo "Some failures were detected:"
|
||||
@@ -791,6 +829,15 @@ function failure()
|
||||
FAILURES="${FAILURES}${STATUS} :: $1\n"
|
||||
}
|
||||
|
||||
function expected_failure() {
|
||||
"${@:2}"
|
||||
EXIT_VALUE=$?
|
||||
if [ $EXIT_VALUE != "$1" ]; then
|
||||
echo "[ERROR] Exit value of executed command is $EXIT_VALUE (expected $1)"; return 1
|
||||
else return 0
|
||||
fi
|
||||
}
|
||||
|
||||
TESTDIR=${PWD}/build_system_tests_$$
|
||||
mkdir -p ${TESTDIR}
|
||||
# set NOCLEANUP=1 if you want to keep the test directory around
|
||||
|
Reference in New Issue
Block a user