feat(test_build_system): enable test_build.py to be executed using cmakev2

Three tests are disabled for cmakev2:
* test_build_dfu
* test_build_uf2
* test_build_loadable_elf

and one is modified:
* test_build_skdconfig_phy_init_data

the other 14 tests should pass.

The tests, test_build_dfu and test_build_uf2, are temporarily disabled
because cmakev2 currently does not include the dfu and uf2 targets.
These tests should be re-enabled once support is added to cmakev2.

The test_build_loadable_elf is disabled because the bootloader_support
component determines its requirements based on the sdkconfig values,
specifically the CONFIG_APP_BUILD_TYPE_RAM used in this test. When
CONFIG_APP_BUILD_TYPE_RAM is set, bootloader_support declares a
dependency on micro-ecc. This is wrong even in cmakev1 and should be
fixed.

The test_build_skdconfig_phy_init_data test requires the esp_phy
component but does not specify it in its requirements. It relies on the
cmakev1 behavior, where all components are included in the build by
default. This approach does not work for cmakev2. To resolve this, make
the dependency on esp_phy explicit, ensuring compatibility with both
versions.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-09-11 13:12:24 +02:00
parent a8e8a0ad8e
commit dce6fca6f4

View File

@@ -114,6 +114,15 @@ def test_build_skdconfig_phy_init_data(idf_py: IdfPyFunc, test_app_copy: Path) -
logging.info('can build with phy_init_data')
(test_app_copy / 'sdkconfig.defaults').touch()
(test_app_copy / 'sdkconfig.defaults').write_text('CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION=y')
# The phy_init_data.bin file is generated in the esp_phy component, so it
# should be added to the requirements.
replace_in_file(
test_app_copy / 'main' / 'CMakeLists.txt',
search='# placeholder_inside_idf_component_register',
replace='PRIV_REQUIRES esp_phy',
)
idf_py('reconfigure')
idf_py('build')
assert_built(BOOTLOADER_BINS + APP_BINS + PARTITION_BIN + ['build/phy_init_data.bin'])
@@ -163,6 +172,7 @@ def test_build_fail_on_build_time(idf_py: IdfPyFunc, test_app_copy: Path) -> Non
idf_py('build')
@pytest.mark.buildv2_skip('dfu target not yet added in buildv2')
@pytest.mark.usefixtures('test_app_copy')
def test_build_dfu(idf_py: IdfPyFunc) -> None:
logging.info('DFU build works')
@@ -178,6 +188,7 @@ def test_build_dfu(idf_py: IdfPyFunc) -> None:
assert_built(BOOTLOADER_BINS + APP_BINS + PARTITION_BIN + ['build/dfu.bin'])
@pytest.mark.buildv2_skip('uf2 target not yet added in buildv2')
@pytest.mark.usefixtures('test_app_copy')
def test_build_uf2(idf_py: IdfPyFunc) -> None:
logging.info('UF2 build works')
@@ -199,6 +210,11 @@ def test_build_uf2(idf_py: IdfPyFunc) -> None:
assert_built(BOOTLOADER_BINS + APP_BINS + PARTITION_BIN + ['build/uf2.bin'])
# The bootloader_support component defines its requirements based on the
# sdkconfig values, specifically the CONFIG_APP_BUILD_TYPE_RAM used in this
# test. If CONFIG_APP_BUILD_TYPE_RAM is set, bootloader_support declares a
# dependency on micro-ecc.
@pytest.mark.buildv2_skip('bootloader_support component CMakeLists.txt is broken')
def test_build_loadable_elf(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
logging.info('Loadable ELF build works')
(test_app_copy / 'sdkconfig').write_text(