Merge branch 'bugfix/fix_test_cmake_warning_full' into 'master'

CI: Fix the test "smallest partition is nearly full"

See merge request espressif/esp-idf!19156
This commit is contained in:
Roland Dobai
2022-07-21 19:09:29 +08:00

View File

@@ -38,6 +38,14 @@ export PATH="$IDF_PATH/tools:$PATH" # for idf.py
# Some tests assume that ccache is not enabled # Some tests assume that ccache is not enabled
unset IDF_CCACHE_ENABLE unset IDF_CCACHE_ENABLE
function get_file_size() {
if [[ $OSTYPE == 'darwin'* ]]; then
BINSIZE=$(stat -f "%z" ${1})
else
BINSIZE=$(stat -c "%s" ${1})
fi
}
function run_tests() function run_tests()
{ {
FAILURES= FAILURES=
@@ -816,14 +824,20 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
print_status "Warning is given if smallest partition is nearly full" print_status "Warning is given if smallest partition is nearly full"
clean_build_dir clean_build_dir
# Build a first time to get the binary size and to check that no warning is issued.
( idf.py build 2>&1 | grep "partition is nearly full" ) && failure "Warning for nearly full smallest partition was given when the condition is not fulfilled"
# Get the size of the binary, in KB. Add 1 to the total.
# The goal is to create an app partition which is slightly bigger than the binary itself
get_file_size "build/app-template.bin"
# Put the returned size ($BINSIZE) in a new variable, convert it to KB and add 1
let size=${BINSIZE}/1024+1
cp ${IDF_PATH}/components/partition_table/partitions_singleapp.csv partitions.csv cp ${IDF_PATH}/components/partition_table/partitions_singleapp.csv partitions.csv
${SED} -i "s/factory, app, factory, , 1M/factory, app, factory, , 170K/" partitions.csv ${SED} -i "s/factory, app, factory, , 1M/factory, app, factory, , ${size}K/" partitions.csv
echo "CONFIG_PARTITION_TABLE_CUSTOM=y" > sdkconfig echo "CONFIG_PARTITION_TABLE_CUSTOM=y" > sdkconfig
# don't use FreeRTOS SMP build for this test - follow up ticket: IDF-5386 # don't use FreeRTOS SMP build for this test - follow up ticket: IDF-5386
echo "CONFIG_FREERTOS_SMP=n" >> sdkconfig echo "CONFIG_FREERTOS_SMP=n" >> sdkconfig
( idf.py build 2>&1 | grep "partition is nearly full" ) || failure "No warning for nearly full smallest partition was given when the condition is fulfilled" ( idf.py build 2>&1 | grep "partition is nearly full" ) || failure "No warning for nearly full smallest partition was given when the condition is fulfilled"
rm -f partitions.csv sdkconfig rm -f partitions.csv sdkconfig
( idf.py build 2>&1 | grep "partition is nearly full" ) && failure "Warning for nearly full smallest partition was given when the condition is not fulfilled"
print_status "Flash size is correctly set in the bootloader image header" print_status "Flash size is correctly set in the bootloader image header"
# Build with the default 2MB setting # Build with the default 2MB setting