From 08195c3e360fd5fd69af58fa10ebf3274f4f6409 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 13 Apr 2026 12:23:59 +0200 Subject: [PATCH] test(lp_core): use soc_filtered_targets for all LP core pytest parametrization Several LP core pytest files were either hardcoded to specific chip lists or using a less-precise SOC capability filter: - test_lp_core_multi_device: was locked to ['esp32c6'] pending a workaround for LP I2C on esp32p4; all three active LP core chips now have SOC_LP_I2C_SUPPORTED=1, so switch to soc_filtered_targets. - test_lp_uart_wakeup_modes: was using SOC_LP_CORE_SUPPORTED which is semantically wrong for a UART test; change to SOC_ULP_LP_UART_SUPPORTED. - LP core example pytests (build_system, interrupt, gpio_intr_pulse_counter, lp_timer_interrupt): replace hardcoded ['esp32c5', 'esp32c6', 'esp32p4'] with soc_filtered_targets('SOC_LP_CORE_SUPPORTED == 1') so that new chips automatically get coverage when their SOC cap is enabled. --- .../lp_core_basic_tests/pytest_lp_core_basic.py | 9 ++------- .../lp_core/build_system/pytest_lp_core_build_sys.py | 6 ++++-- .../gpio_intr_pulse_counter/pytest_lp_core_pcnt.py | 11 +++++++++-- .../ulp/lp_core/interrupt/pytest_lp_core_intr.py | 3 ++- .../lp_timer_interrupt/pytest_lp_timer_interrupt.py | 3 ++- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/components/ulp/test_apps/lp_core/lp_core_basic_tests/pytest_lp_core_basic.py b/components/ulp/test_apps/lp_core/lp_core_basic_tests/pytest_lp_core_basic.py index d1658c09f79..8b01d09fe0f 100644 --- a/components/ulp/test_apps/lp_core/lp_core_basic_tests/pytest_lp_core_basic.py +++ b/components/ulp/test_apps/lp_core/lp_core_basic_tests/pytest_lp_core_basic.py @@ -46,7 +46,6 @@ def test_lp_vad(dut: Dut) -> None: dut.run_all_single_board_cases(group='lp_vad') -# TODO: Support LP I2C test for esp32p4 (IDF-9581) @pytest.mark.generic_multi_device @pytest.mark.parametrize('count', [2], indirect=True) @pytest.mark.parametrize( @@ -56,7 +55,7 @@ def test_lp_vad(dut: Dut) -> None: ], indirect=True, ) -@idf_parametrize('target', ['esp32c6'], indirect=['target']) +@idf_parametrize('target', soc_filtered_targets('SOC_LP_I2C_SUPPORTED == 1'), indirect=['target']) def test_lp_core_multi_device(case_tester: CaseTester) -> None: # Run only non-UART multi-device cases (e.g. LP I2C); LP UART is covered # by test_lp_uart_multi_device which targets all LP_CORE_SUPPORTED chips. @@ -84,11 +83,7 @@ def test_lp_uart_multi_device(case_tester: CaseTester) -> None: @pytest.mark.generic_multi_device @pytest.mark.parametrize( 'target', - [ - 'esp32c5', - 'esp32c6', - 'esp32p4', - ], + soc_filtered_targets('SOC_ULP_LP_UART_SUPPORTED == 1'), indirect=True, ) @pytest.mark.parametrize( diff --git a/examples/system/ulp/lp_core/build_system/pytest_lp_core_build_sys.py b/examples/system/ulp/lp_core/build_system/pytest_lp_core_build_sys.py index b9089f97eb4..7dafa40bcbc 100644 --- a/examples/system/ulp/lp_core/build_system/pytest_lp_core_build_sys.py +++ b/examples/system/ulp/lp_core/build_system/pytest_lp_core_build_sys.py @@ -1,11 +1,13 @@ -# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 + import pytest from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize +from pytest_embedded_idf.utils import soc_filtered_targets @pytest.mark.generic -@idf_parametrize('target', ['esp32c5', 'esp32c6', 'esp32p4'], indirect=['target']) +@idf_parametrize('target', soc_filtered_targets('SOC_LP_CORE_SUPPORTED == 1'), indirect=['target']) def test_lp_core_build_sys(dut: IdfDut) -> None: dut.expect('Sum calculated by ULP using external library func: 11') diff --git a/examples/system/ulp/lp_core/gpio_intr_pulse_counter/pytest_lp_core_pcnt.py b/examples/system/ulp/lp_core/gpio_intr_pulse_counter/pytest_lp_core_pcnt.py index 8b3e00f60f4..c162225aa5f 100644 --- a/examples/system/ulp/lp_core/gpio_intr_pulse_counter/pytest_lp_core_pcnt.py +++ b/examples/system/ulp/lp_core/gpio_intr_pulse_counter/pytest_lp_core_pcnt.py @@ -1,14 +1,21 @@ -# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import logging import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize +from pytest_embedded_idf.utils import soc_filtered_targets @pytest.mark.generic -@idf_parametrize('target', ['esp32c6', 'esp32p4'], indirect=['target']) +@idf_parametrize( + 'target', + soc_filtered_targets( + 'SOC_LP_CORE_SUPPORTED == 1 and SOC_ULP_LP_UART_SUPPORTED == 1 and SOC_DEEP_SLEEP_SUPPORTED == 1' + ), + indirect=['target'], +) def test_lp_core_pcnt(dut: Dut) -> None: res = dut.expect(r'ULP will wake up processor after every (\d+) pulses') wakeup_limit = res.group(1).decode('utf-8') diff --git a/examples/system/ulp/lp_core/interrupt/pytest_lp_core_intr.py b/examples/system/ulp/lp_core/interrupt/pytest_lp_core_intr.py index 622198c941c..8445700b68b 100644 --- a/examples/system/ulp/lp_core/interrupt/pytest_lp_core_intr.py +++ b/examples/system/ulp/lp_core/interrupt/pytest_lp_core_intr.py @@ -3,9 +3,10 @@ import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize +from pytest_embedded_idf.utils import soc_filtered_targets @pytest.mark.generic -@idf_parametrize('target', ['esp32c5', 'esp32c6', 'esp32p4'], indirect=['target']) +@idf_parametrize('target', soc_filtered_targets('SOC_LP_CORE_SUPPORTED == 1'), indirect=['target']) def test_lp_core_intr(dut: Dut) -> None: dut.expect('Triggered 10 interrupts on the LP-Core, LP-Core received 10 interrupts') diff --git a/examples/system/ulp/lp_core/lp_timer_interrupt/pytest_lp_timer_interrupt.py b/examples/system/ulp/lp_core/lp_timer_interrupt/pytest_lp_timer_interrupt.py index 92f07652d42..0f7297e6f2a 100644 --- a/examples/system/ulp/lp_core/lp_timer_interrupt/pytest_lp_timer_interrupt.py +++ b/examples/system/ulp/lp_core/lp_timer_interrupt/pytest_lp_timer_interrupt.py @@ -5,10 +5,11 @@ import time import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize +from pytest_embedded_idf.utils import soc_filtered_targets @pytest.mark.generic -@idf_parametrize('target', ['esp32c5', 'esp32c6', 'esp32p4'], indirect=['target']) +@idf_parametrize('target', soc_filtered_targets('SOC_LP_CORE_SUPPORTED == 1'), indirect=['target']) def test_lp_timer_interrupt(dut: Dut) -> None: # Wait for LP core to be loaded and running dut.expect_exact('LP core loaded with firmware and running successfully')