mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
Merge branch 'bugfix/ci_check_blobs_v4.4' into 'release/v4.4'
ci: improve checks for Wi-Fi/PHY libraries (v4.4) See merge request espressif/esp-idf!16659
This commit is contained in:
commit
4f9afec016
@ -39,10 +39,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
|
||||
|
@ -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
|
||||
|
@ -13,6 +13,7 @@ if(IDF_TARGET STREQUAL "esp32h2")
|
||||
else()
|
||||
set(srcs "src/phy_init.c")
|
||||
endif()
|
||||
list(APPEND srcs "src/lib_printf.c")
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2d89c532ccba0bb9988d1d1c6d719bbe1d8b65b8
|
||||
Subproject commit 4779ddaaf29e1d6aa2d26980103a1c1bbaa29462
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file lib_printf.c
|
||||
@ -142,7 +134,7 @@ int wapi_printf(const char* format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
int res = lib_printf("coexist", format, arg);
|
||||
int res = lib_printf("wapi", format, arg);
|
||||
va_end(arg);
|
||||
return res;
|
||||
}
|
@ -18,7 +18,6 @@ if(CONFIG_ESP32_WIFI_ENABLED)
|
||||
|
||||
set(srcs
|
||||
"src/coexist.c"
|
||||
"src/lib_printf.c"
|
||||
"src/mesh_event.c"
|
||||
"src/smartconfig.c"
|
||||
"src/smartconfig_ack.c"
|
||||
|
@ -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
63
tools/ci/check_blobs.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user