test(cmakev2): add pytest scripts for cmakev2 build system examples

Add pytest test coverage for cmakev2 build system examples that had
none.

CMakeLists.txt fixes required to enable testing:

conditional_component and plugins: added idf_build_generate_flasher_args()
since these use the low-level build API (idf_build_executable /
idf_flash_binary) which unlike idf_project_default() does not call it
automatically. Without it, flasher_args.json was missing from the build
output and pytest-embedded could not initialize the DUT.

multi_binary: both app1 and app2 were registered in the global flash
target via idf_flash_binary(...FLASH), creating a duplicate key at offset
0x10000 in the flasher_args.json generator expression and preventing the
file from being generated. Fixed by removing FLASH from app2's call so
only app1 is registered in the global flash target. idf_build_generate_flasher_args()
now produces a valid flasher_args.json with app1 as the default app binary.
The test patches the binary path to app2.bin when testing the second app.
This commit is contained in:
Sudeep Mohanty
2026-04-10 13:49:56 +02:00
parent 321896bde6
commit e364a60769
18 changed files with 202 additions and 5 deletions
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded_idf.utils import idf_parametrize
from pytest_embedded_qemu.dut import QemuDut
@pytest.mark.qemu
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
def test_cmakev2_import_lib(dut: QemuDut) -> None:
dut.expect_exact('Initializing the filesystem')
dut.expect_exact('Read XML data:')
dut.expect_exact('Parsed XML data:')
dut.expect_exact('To: Tove')
dut.expect_exact('From: Jani')
dut.expect_exact('Heading: Reminder')
dut.expect_exact("Body: Don't forget me this weekend!")
dut.expect_exact('Example end', timeout=20)