Merge branch 'feature/check_public_header_targets' into 'master'

ci: check_public_headers: run the check for all targets

Closes IDF-3698

See merge request espressif/esp-idf!18765
This commit is contained in:
morris 2022-06-30 13:55:19 +08:00
commit 9d87d6ad50
3 changed files with 106 additions and 7 deletions

View File

@ -111,7 +111,11 @@ check_public_headers:
tags:
- build
script:
- python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf-
- IDF_TARGET=esp32 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf-
- IDF_TARGET=esp32s2 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s2-elf-
- IDF_TARGET=esp32s3 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s3-elf-
- IDF_TARGET=esp32c3 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
- IDF_TARGET=esp32c2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
check_chip_support_components:
extends:

View File

@ -88,7 +88,7 @@ class PublicHeaderChecker:
self.error_macro = re.compile(r'#error')
self.error_orphan_kconfig = re.compile(r'#error CONFIG_VARS_USED_WHILE_SDKCONFIG_NOT_INCLUDED')
self.kconfig_macro = re.compile(r'\bCONFIG_[A-Z0-9_]+')
self.assembly_nocode = r'^\s*(\.file|\.text|\.ident).*$'
self.assembly_nocode = r'^\s*(\.file|\.text|\.ident|\.option|\.attribute).*$'
self.check_threads = []
self.job_queue = queue.Queue()
@ -235,8 +235,14 @@ class PublicHeaderChecker:
def list_public_headers(self, ignore_dirs, ignore_files, only_dir=None):
idf_path = os.getenv('IDF_PATH')
project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink')
subprocess.check_call(['idf.py', 'reconfigure'], cwd=project_dir)
build_commands_json = os.path.join(project_dir, 'build', 'compile_commands.json')
build_dir = tempfile.mkdtemp()
sdkconfig = os.path.join(build_dir, 'sdkconfig')
try:
os.unlink(os.path.join(project_dir, 'sdkconfig'))
except FileNotFoundError:
pass
subprocess.check_call(['idf.py', '-B', build_dir, f'-DSDKCONFIG={sdkconfig}', 'reconfigure'], cwd=project_dir)
build_commands_json = os.path.join(build_dir, 'compile_commands.json')
with open(build_commands_json, 'r', encoding='utf-8') as f:
build_command = json.load(f)[0]['command'].split()
include_dir_flags = []
@ -249,13 +255,13 @@ class PublicHeaderChecker:
include_dirs.append(item[2:]) # Removing the leading "-I"
if item.startswith('-D'):
include_dir_flags.append(item.replace('\\','')) # removes escaped quotes, eg: -DMBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\"
include_dir_flags.append('-I' + os.path.join(project_dir, 'build', 'config'))
include_dir_flags.append('-I' + os.path.join(build_dir, 'config'))
include_dir_flags.append('-DCI_HEADER_CHECK')
sdkconfig_h = os.path.join(project_dir, 'build', 'config', 'sdkconfig.h')
sdkconfig_h = os.path.join(build_dir, 'config', 'sdkconfig.h')
# prepares a main_c file for easier sdkconfig checks and avoid compilers warning when compiling headers directly
with open(sdkconfig_h, 'a') as f:
f.write('#define IDF_SDKCONFIG_INCLUDED')
main_c = os.path.join(project_dir, 'build', 'compile.c')
main_c = os.path.join(build_dir, 'compile.c')
with open(main_c, 'w') as f:
f.write('#if defined(IDF_CHECK_SDKCONFIG_INCLUDED) && ! defined(IDF_SDKCONFIG_INCLUDED)\n'
'#error CONFIG_VARS_USED_WHILE_SDKCONFIG_NOT_INCLUDED\n'

View File

@ -3,6 +3,9 @@
components/xtensa/include/xtensa/
components/xtensa/include/
components/xtensa/esp32/include/xtensa/config/
components/xtensa/esp32s2/include/xtensa/config/
components/xtensa/esp32s3/include/xtensa/config/
components/newlib/platform_include/
@ -34,7 +37,12 @@ components/lwip/lwip/src/include/lwip/priv/memp_std.h
components/lwip/include/lwip/sockets.h
components/lwip/lwip/src/include/lwip/prot/nd6.h
## Header produced non-zero object:
components/esp_phy/esp32/include/phy_init_data.h
components/esp_phy/esp32s2/include/phy_init_data.h
components/esp_phy/esp32s3/include/phy_init_data.h
components/esp_phy/esp32c3/include/phy_init_data.h
components/esp_phy/esp32c2/include/phy_init_data.h
components/spi_flash/include/spi_flash_chip_issi.h
components/spi_flash/include/spi_flash_chip_mxic.h
@ -146,3 +154,84 @@ components/ulp/include/ulp_common.h
components/ulp/include/esp32s2/ulp_riscv.h
components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h
components/wifi_provisioning/include/wifi_provisioning/scheme_softap.h
### To be fixed: files which don't compile for esp32s2 target:
components/driver/deprecated/driver/adc_deprecated.h
components/driver/include/driver/can.h
components/driver/include/driver/mcpwm.h
components/efuse/esp32s2/include/esp_efuse_table.h
components/esp_psram/include/esp32/himem.h
components/esp_rom/include/esp32/rom/ets_sys.h
components/esp_rom/include/esp32/rom/rtc.h
components/esp_rom/include/esp32/rom/uart.h
components/soc/esp32s2/include/soc/apb_ctrl_struct.h
components/soc/esp32s2/include/soc/apb_saradc_struct.h
components/soc/esp32s2/include/soc/efuse_struct.h
components/soc/esp32s2/include/soc/gpio_sd_struct.h
components/soc/esp32s2/include/soc/gpio_struct.h
components/soc/esp32s2/include/soc/i2c_struct.h
components/soc/esp32s2/include/soc/i2s_struct.h
components/soc/esp32s2/include/soc/ledc_struct.h
components/soc/esp32s2/include/soc/rtc_i2c_struct.h
components/soc/esp32s2/include/soc/rtc_io_struct.h
components/soc/esp32s2/include/soc/sens_struct.h
components/soc/esp32s2/include/soc/spi_mem_struct.h
components/soc/esp32s2/include/soc/spi_struct.h
components/soc/esp32s2/include/soc/syscon_struct.h
components/soc/esp32s2/include/soc/uart_struct.h
components/soc/esp32s2/include/soc/uhci_struct.h
components/usb/include/esp_private/usb_phy.h
components/usb/include/usb/usb_types_stack.h
### To be fixed: files which don't compile for esp32s3 target:
components/driver/include/driver/dac_common.h
components/efuse/esp32s3/include/esp_efuse_table.h
components/soc/esp32s3/include/soc/world_controller_struct.h
components/soc/esp32s3/usb_periph.h
### To be fixed: files which don't compile for esp32c3 target:
components/driver/include/driver/touch_pad.h
components/efuse/esp32c3/include/esp_efuse_table.h
components/esp_system/port/include/private/esp_private/trax.h
components/espcoredump/include/port/xtensa/esp_core_dump_summary_port.h
components/riscv/include/esp_private/panic_reason.h
components/riscv/include/riscv/interrupt.h
components/riscv/include/riscv/rvruntime-frames.h
components/soc/esp32c3/include/soc/apb_ctrl_struct.h
components/soc/esp32c3/include/soc/apb_saradc_struct.h
components/soc/esp32c3/include/soc/efuse_struct.h
components/soc/esp32c3/include/soc/gpio_sd_struct.h
components/soc/esp32c3/include/soc/i2s_struct.h
components/soc/esp32c3/include/soc/ledc_struct.h
components/soc/esp32c3/include/soc/rtc_cntl_struct.h
components/soc/esp32c3/include/soc/rtc_i2c_struct.h
components/soc/esp32c3/include/soc/spi_mem_struct.h
components/soc/esp32c3/include/soc/spi_struct.h
components/soc/esp32c3/include/soc/syscon_struct.h
components/soc/esp32c3/include/soc/uart_struct.h
components/soc/esp32c3/include/soc/uhci_struct.h
### To be fixed: files which don't compile for esp32c2 target:
components/driver/deprecated/driver/i2s_types_legacy.h
components/driver/deprecated/driver/i2s.h
components/driver/deprecated/driver/rmt_types_legacy.h
components/driver/deprecated/driver/rmt.h
components/driver/include/driver/i2s_common.h
components/driver/include/driver/i2s_pdm.h
components/driver/include/driver/i2s_std.h
components/driver/include/driver/i2s_tdm.h
components/driver/include/driver/rmt_common.h
components/driver/include/driver/rmt_encoder.h
components/driver/include/driver/rmt_rx.h
components/driver/include/driver/rmt_tx.h
components/driver/include/driver/rmt_types.h
components/driver/include/driver/sigmadelta.h
components/efuse/esp32c2/include/esp_efuse_table.h
components/soc/esp32c2/include/soc/rtc_cntl_struct.h
components/soc/esp32c2/include/soc/spi_mem_struct.h
components/soc/esp32c2/include/soc/syscon_struct.h
components/soc/esp32c2/include/soc/uart_struct.h