diff --git a/components/esp_wifi/test_md5/test_md5.sh b/components/esp_wifi/test_md5/test_md5.sh new file mode 100755 index 0000000000..28a72beada --- /dev/null +++ b/components/esp_wifi/test_md5/test_md5.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -euo pipefail + +if [ -z "${IDF_PATH:-}" ]; then + echo "IDF_PATH must be set before running this script" + exit 1 +fi + +if [ -z "${IDF_TARGET:-}" ]; then + echo "IDF_TARGET must be set before running this script" + exit 1 +fi + +case $IDF_TARGET in + esp32) + PREFIX=xtensa-esp32-elf- + LIB_DIR=esp32 + ;; + esp32s2beta) + PREFIX=xtensa-esp32s2-elf- + LIB_DIR=esp32s2beta + ;; + *) + echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\"" + exit 1 + ;; +esac + +ELF_FILE=test.elf + +${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \ + -u g_esp_wifi_md5 \ + -u g_wifi_crypto_funcs_md5 \ + -u g_wifi_type_md5 \ + -u g_wifi_osi_funcs_md5 \ + -u g_coex_adapter_funcs_md5 \ + -u g_wifi_supplicant_funcs_md5 \ + ${IDF_PATH}/components/esp_wifi/lib/${LIB_DIR}/*.a + +FAILURES=0 + +function check_md5() +{ + FILENAME=$1 + SYMBOL=$2 + + GDB_COMMAND="printf \"%s\\n\", (const char*) ${SYMBOL}" + MD5_FROM_LIB=$(${PREFIX}gdb -n -batch ${ELF_FILE} -ex "${GDB_COMMAND}") + MD5_FROM_HEADER=$(md5sum ${FILENAME} | cut -c 1-7) + + echo "Checking ${FILENAME}:" + echo " ${MD5_FROM_HEADER} - from header file" + echo " ${MD5_FROM_LIB} - from library" + if [ "${MD5_FROM_LIB}" != "${MD5_FROM_HEADER}" ]; then + echo " error: MD5 mismatch!" + FAILURES=$(($FAILURES+1)) + fi +} + +echo "Checking libraries for target ${IDF_TARGET}..." +check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi.h g_esp_wifi_md5 +check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h g_wifi_osi_funcs_md5 +check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h g_wifi_crypto_funcs_md5 +check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_types.h g_wifi_type_md5 +check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_coexist_adapter.h g_coex_adapter_funcs_md5 +check_md5 ${IDF_PATH}/components/wpa_supplicant/src/esp_supplicant/esp_wifi_driver.h g_wifi_supplicant_funcs_md5 + +if [ $FAILURES -gt 0 ]; then + exit 1 +fi diff --git a/tools/ci/config/check.yml b/tools/ci/config/check.yml index 7498b54cb4..23746404ba 100644 --- a/tools/ci/config/check.yml +++ b/tools/ci/config/check.yml @@ -114,6 +114,17 @@ check_submodule_sync: - git submodule update --recursive - echo "IDF was cloned from ${PUBLIC_IDF_URL} completely" +check_wifi_lib_md5: + extends: .check_job_template + tags: + - build + dependencies: [] + script: + - tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" + - git submodule update --init components/esp_wifi/lib + - IDF_TARGET=esp32 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh + - IDF_TARGET=esp32s2beta $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh + check_artifacts_expire_time: extends: .check_job_template script: diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index 8c7f1f5878..53795a4899 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -1,6 +1,7 @@ components/app_update/otatool.py components/efuse/efuse_table_gen.py components/efuse/test_efuse_host/efuse_tests.py +components/esp_wifi/test_md5/test_md5.sh components/espcoredump/espcoredump.py components/espcoredump/test/test_espcoredump.py components/espcoredump/test/test_espcoredump.sh