ci: improve checks for Wi-Fi/PHYlibraries

- add missing Wi-Fi header MD5 checks for esp32c3, esp32s3
- check PHY libraries for references to ets_printf, in addition to
  checking Wi-Fi libraries. This used to happen until libphy.a was
  moved into a separate submodule.

Reported in https://github.com/espressif/esp-phy-lib/issues/3
This commit is contained in:
Ivan Grokhotkov 2022-01-04 00:18:55 +01:00 committed by Jack
parent d83021a6e8
commit 09552fdf68
4 changed files with 77 additions and 8 deletions

View File

@ -34,10 +34,6 @@
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
# Only do the default cmake build for each target, remaining part are done in the build_template_app job
- tools/ci/build_template_app.sh ${BUILD_COMMAND_ARGS}
# Check if there are any stray printf/ets_printf references in WiFi libs
- cd components/esp_wifi/lib
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w printf | wc -l) -eq 0; done;
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w ets_printf | wc -l) -eq 0; done;
# build-related-pre-check-jobs ------------------------------------------------
# Build at least one project for each target at earliest stage to reduce build cost for obvious failing commits

View File

@ -83,15 +83,20 @@ test_check_kconfigs:
script:
- python ${IDF_PATH}/tools/ci/test_check_kconfigs.py
check_wifi_lib_md5:
check_blobs:
extends: .pre_check_base_template
tags:
- build
variables:
SUBMODULES_TO_FETCH: "components/esp_wifi/lib"
SUBMODULES_TO_FETCH: "components/esp_wifi/lib;components/esp_phy/lib"
script:
# Check if Wi-Fi library header files match between IDF and the version used when compiling the libraries
- IDF_TARGET=esp32 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32s2 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32s3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32c3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
# Check if Wi-Fi, PHY, BT blobs contain references to specific symbols
- bash $IDF_PATH/tools/ci/check_blobs.sh
check_fuzzer_compilation:
extends: .pre_check_base_template

View File

@ -15,17 +15,22 @@ fi
case $IDF_TARGET in
esp32)
PREFIX=xtensa-esp32-elf-
LIB_DIR=esp32
;;
esp32s2)
PREFIX=xtensa-esp32s2-elf-
LIB_DIR=esp32s2
;;
esp32s3)
PREFIX=xtensa-esp32s3-elf-
;;
esp32c3)
PREFIX=riscv32-esp-elf-
;;
*)
echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\""
exit 1
;;
esac
LIB_DIR=${IDF_TARGET}
ELF_FILE=test.elf

63
tools/ci/check_blobs.sh Normal file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -euo pipefail
if [ -z "${IDF_PATH:-}" ]; then
echo "IDF_PATH must be set before running this script"
exit 1
fi
failed=""
# check_lib_symbols <libraray path> <symbols to look for...>
#
# If the given library contains references to the listed symbols, prints
# a message and adds the library to "failed" list.
function check_lib_symbols {
lib="$1"
symbols="${@:2}"
syms_file="$(mktemp)"
# for symbols="foo bar" create grep search argument "foo\|bar"
symbols_args="${symbols// /\\|}"
errors=0
nm -A $lib 2>/dev/null | { grep -w "${symbols_args}" > ${syms_file} || true; }
if [ $(wc -l <${syms_file}) != 0 ]; then
echo "${lib}: found illegal symbol references:"
cat ${syms_file} | sed 's/^/\t/'
failed="${failed} ${lib}"
errors=1
fi
if [ $errors == 0 ]; then
echo "${lib}: OK"
fi
rm -f ${syms_file}
}
# Check Wi-Fi, PHY libraries for references to "printf"-like functions:
illegal_symbols="printf ets_printf"
pushd ${IDF_PATH}/components/esp_wifi/lib > /dev/null
wifi_targets=$(find . -type d -name 'esp*' -exec basename {} \; | sort)
for target in ${wifi_targets}; do
for library in ${target}/*.a; do
check_lib_symbols ${library} ${illegal_symbols}
done
done
popd > /dev/null
pushd ${IDF_PATH}/components/esp_phy/lib > /dev/null
phy_targets=$(find . -type d -name 'esp*' -exec basename {} \; | sort)
for target in ${phy_targets}; do
for library in ${target}/*.a; do
check_lib_symbols ${library} ${illegal_symbols}
done
done
popd > /dev/null
# Print summary
if [ -n "${failed}" ]; then
echo "Issues found in the following libraries:"
for lib in $failed; do
echo "- $lib"
done
exit 1
fi