ci: add idf_as_lib to patterns-build_system rules

The `idf_as_lib` example is used and tested in
`tools/test_build_system/test_cmake.py`. Include `idf_as_lib` in the
build_system rules to ensure the tests are executed whenever there is a
modification in the `idf_as_lib` example.

Expand the `test_build_custom_cmake_project` test to cover all supported
targets, including host build.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-02-21 12:22:47 +01:00
parent 3b28818ba4
commit 54cb6636ec

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import logging import logging
import os import os
@@ -16,14 +16,17 @@ from test_build_system_helpers import run_cmake_and_build
def test_build_custom_cmake_project(test_app_copy: Path) -> None: def test_build_custom_cmake_project(test_app_copy: Path) -> None:
# Test is compatible with any target. Random targets in the list are selected for performance reasons # Test is compatible with any target. Random targets in the list are selected for performance reasons
for target in ['esp32', 'esp32s3', 'esp32c6', 'esp32h2']: idf_path = Path(os.environ['IDF_PATH'])
for target in ['esp32','esp32c2','esp32c3','esp32c6','esp32h2','esp32p4','esp32s2','esp32s3']:
logging.info(f'Test build ESP-IDF as a library to a custom CMake projects for {target}') logging.info(f'Test build ESP-IDF as a library to a custom CMake projects for {target}')
idf_path = Path(os.environ['IDF_PATH'])
run_cmake_and_build(str(idf_path / 'examples' / 'build_system' / 'cmake' / 'idf_as_lib'), '-G', 'Ninja', run_cmake_and_build(str(idf_path / 'examples' / 'build_system' / 'cmake' / 'idf_as_lib'), '-G', 'Ninja',
'-DCMAKE_TOOLCHAIN_FILE={}'.format(idf_path / 'tools' / 'cmake' / f'toolchain-{target}.cmake'), f'-DTARGET={target}') '-DCMAKE_TOOLCHAIN_FILE={}'.format(idf_path / 'tools' / 'cmake' / f'toolchain-{target}.cmake'), f'-DTARGET={target}')
assert file_contains((test_app_copy / 'build' / 'compile_commands.json'), '"command"') assert file_contains((test_app_copy / 'build' / 'compile_commands.json'), '"command"')
shutil.rmtree(test_app_copy / 'build') shutil.rmtree(test_app_copy / 'build')
logging.info(f'Test build ESP-IDF as a library to a custom CMake projects for host')
run_cmake_and_build(str(idf_path / 'examples' / 'build_system' / 'cmake' / 'idf_as_lib'), '-G', 'Ninja')
def test_build_cmake_library_psram_workaround(test_app_copy: Path) -> None: def test_build_cmake_library_psram_workaround(test_app_copy: Path) -> None:
logging.info('Building a project with CMake library imported and PSRAM workaround, all files compile with workaround') logging.info('Building a project with CMake library imported and PSRAM workaround, all files compile with workaround')