Merge branch 'feature/trim_idf_ver_to_fit_32bit_field_v3.3' into 'release/v3.3'

tools/test_build_system: Trim IDF_VER to fit a 32-bit field (backport v3.3)

See merge request idf/esp-idf!4497
This commit is contained in:
Angus Gratton 2019-03-15 11:38:32 +08:00
commit d6b316c375
4 changed files with 10 additions and 5 deletions

View File

@ -270,10 +270,11 @@ endif
# If we have `version.txt` then prefer that for extracting IDF version # If we have `version.txt` then prefer that for extracting IDF version
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","") ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty) IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty)
else else
IDF_VER := `cat ${IDF_PATH}/version.txt` IDF_VER_T := `cat ${IDF_PATH}/version.txt`
endif endif
IDF_VER := $(shell echo "$(IDF_VER_T)" | cut -c 1-31)
# Set default LDFLAGS # Set default LDFLAGS
EXTRA_LDFLAGS ?= EXTRA_LDFLAGS ?=

View File

@ -223,7 +223,7 @@ function run_tests()
print_status "Can build without git installed on system" print_status "Can build without git installed on system"
clean_build_dir clean_build_dir
# Make provision for getting IDF version # Make provision for getting IDF version
echo "custom-version-x.y" > ${IDF_PATH}/version.txt echo "IDF_VER_0123456789_0123456789_0123456789" > ${IDF_PATH}/version.txt
echo "project-version-w.z" > ${TESTDIR}/template/version.txt echo "project-version-w.z" > ${TESTDIR}/template/version.txt
# Hide .gitmodules so that submodule check is avoided # Hide .gitmodules so that submodule check is avoided
[ -f ${IDF_PATH}/.gitmodules ] && mv ${IDF_PATH}/.gitmodules ${IDF_PATH}/.gitmodules_backup [ -f ${IDF_PATH}/.gitmodules ] && mv ${IDF_PATH}/.gitmodules ${IDF_PATH}/.gitmodules_backup

View File

@ -99,6 +99,7 @@ function run_tests()
print_status "Rebuild when app version was changed" print_status "Rebuild when app version was changed"
clean_build_dir clean_build_dir
# App version # App version
echo "IDF_VER_0123456789_0123456789_0123456789" > ${IDF_PATH}/version.txt
echo "project-version-1.0" > ${TESTDIR}/template/version.txt echo "project-version-1.0" > ${TESTDIR}/template/version.txt
idf.py build || failure "Failed to build with app version" idf.py build || failure "Failed to build with app version"
print_status "Change app version" print_status "Change app version"
@ -112,6 +113,7 @@ function run_tests()
take_build_snapshot take_build_snapshot
idf.py build idf.py build
assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
rm -f ${IDF_PATH}/version.txt
rm -f ${TESTDIR}/template/version.txt rm -f ${TESTDIR}/template/version.txt
print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit." print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit."

View File

@ -223,11 +223,13 @@ endfunction()
function(idf_get_git_revision) function(idf_get_git_revision)
git_describe(IDF_VER_GIT "${IDF_PATH}") git_describe(IDF_VER_GIT "${IDF_PATH}")
if(EXISTS "${IDF_PATH}/version.txt") if(EXISTS "${IDF_PATH}/version.txt")
file(STRINGS "${IDF_PATH}/version.txt" IDF_VER) file(STRINGS "${IDF_PATH}/version.txt" IDF_VER_T)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${IDF_PATH}/version.txt") set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${IDF_PATH}/version.txt")
else() else()
set(IDF_VER ${IDF_VER_GIT}) set(IDF_VER_T ${IDF_VER_GIT})
endif() endif()
# cut IDF_VER to required 32 characters.
string(SUBSTRING "${IDF_VER_T}" 0 31 IDF_VER)
message(STATUS "IDF_VER: ${IDF_VER}") message(STATUS "IDF_VER: ${IDF_VER}")
add_definitions(-DIDF_VER=\"${IDF_VER}\") add_definitions(-DIDF_VER=\"${IDF_VER}\")
git_submodule_check("${IDF_PATH}") git_submodule_check("${IDF_PATH}")