test(lp_core): extend LP UART multi-device test coverage

Refactor the LP UART multi-device tests to use a single parameterised
helper pair (test_lp_uart_write_cfg / test_lp_uart_read_cfg) instead of
one-off functions per config, and extend coverage to:

- write and read tests for 5-, 6-, 7-bit and even-parity configurations
- negative tests: word-length mismatch (FRAM_ERR recovery on LP side,
  garbled receive on HP side)
- LP GPIO Matrix routing tests (SOC_LP_GPIO_MATRIX_SUPPORTED chips only):
  swaps the default TX/RX GPIO numbers so both pins go through the LP GPIO
  Matrix, covering the lp_gpio_connect_in/out_signal() branch of
  lp_uart_config_io() that was previously untested at the data-transfer
  level; the same physical cross-wiring as all other LP UART tests is reused

Add rtc_gpio_deinit() cleanup at the end of single-board LP UART tests
so configured pins are returned to HP/digital mode and do not interfere
with subsequent tests that may reuse the same GPIOs.
This commit is contained in:
Sudeep Mohanty
2026-04-13 12:40:17 +02:00
parent b211749924
commit b8d99436a5
2 changed files with 693 additions and 494 deletions

View File

@@ -48,7 +48,53 @@ def test_lp_vad(dut: Dut) -> None:
@pytest.mark.generic_multi_device
@pytest.mark.parametrize('count', [2], indirect=True)
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
def test_lp_core_multi_device(case_tester) -> None: # type: ignore
for case in case_tester.test_menu:
if case.attributes.get('test_env', 'generic_multi_device') == 'generic_multi_device':
case_tester.run_multi_dev_case(case=case, reset=True)
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.
non_uart_cases = [case for case in case_tester.test_menu if 'uart' not in case.groups]
for case in non_uart_cases:
case_tester.run_multi_dev_case(case=case, reset=True)
@pytest.mark.generic_multi_device
@pytest.mark.parametrize('count', [2], indirect=True)
@pytest.mark.parametrize(
'config',
[
'defaults',
],
indirect=True,
)
@idf_parametrize('target', soc_filtered_targets('SOC_ULP_LP_UART_SUPPORTED == 1'), indirect=['target'])
def test_lp_uart_multi_device(case_tester: CaseTester) -> None:
uart_cases = [case for case in case_tester.test_menu if 'uart' in case.groups and 'wakeup' not in case.groups]
for case in uart_cases:
case_tester.run_multi_dev_case(case=case, reset=True)
@pytest.mark.generic_multi_device
@pytest.mark.parametrize(
'target',
[
'esp32c5',
'esp32c6',
'esp32p4',
],
indirect=True,
)
@pytest.mark.parametrize(
'config',
[
'defaults',
],
indirect=True,
)
@pytest.mark.parametrize('count', [2], indirect=True)
def test_lp_uart_wakeup_modes(case_tester: CaseTester) -> None:
relevant_cases = [case for case in case_tester.test_menu if {'wakeup', 'uart'}.issubset(case.groups)]
assert len(relevant_cases) == 12, (
f"Expected 12 test cases with groups 'wakeup' and 'uart', but found {len(relevant_cases)}."
)
for case in relevant_cases:
case_tester.run_multi_dev_case(case=case, reset=True)