From bdeb4136038e04a298287d025f052053d63a6284 Mon Sep 17 00:00:00 2001 From: "sonika.rathi" Date: Tue, 21 Jul 2026 09:49:05 +0200 Subject: [PATCH] fix(storage): mark storage pytest apps flaky in CI --- .../test_apps/pytest_wear_levelling.py | 3 ++- examples/storage/emmc/pytest_emmc_example.py | 1 + .../pytest_partition_find_example.py | 5 +++-- examples/storage/spiffs/pytest_spiffs_example.py | 14 ++++++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/wear_levelling/test_apps/pytest_wear_levelling.py b/components/wear_levelling/test_apps/pytest_wear_levelling.py index 0ef1fcecbcf..4b93e51d842 100644 --- a/components/wear_levelling/test_apps/pytest_wear_levelling.py +++ b/components/wear_levelling/test_apps/pytest_wear_levelling.py @@ -6,6 +6,7 @@ from pytest_embedded_idf.utils import idf_parametrize @pytest.mark.generic +@pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.parametrize( 'config', [ @@ -18,4 +19,4 @@ from pytest_embedded_idf.utils import idf_parametrize ) @idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) def test_wear_levelling(dut: Dut) -> None: - dut.expect_unity_test_output() + dut.expect_unity_test_output(timeout=120) diff --git a/examples/storage/emmc/pytest_emmc_example.py b/examples/storage/emmc/pytest_emmc_example.py index 57341f105c4..504e56b7e4d 100644 --- a/examples/storage/emmc/pytest_emmc_example.py +++ b/examples/storage/emmc/pytest_emmc_example.py @@ -8,6 +8,7 @@ from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize +@pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.emmc @pytest.mark.parametrize( 'config', diff --git a/examples/storage/partition_api/partition_find/pytest_partition_find_example.py b/examples/storage/partition_api/partition_find/pytest_partition_find_example.py index b3ecc0a0212..6f509b9942c 100644 --- a/examples/storage/partition_api/partition_find/pytest_partition_find_example.py +++ b/examples/storage/partition_api/partition_find/pytest_partition_find_example.py @@ -7,18 +7,19 @@ from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize +@pytest.mark.flaky(reruns=2, reruns_delay=5) @pytest.mark.generic @idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target']) def test_partition_find_example(dut: Dut) -> None: def expect_partition(name: str, offset: int, size: int) -> None: dut.expect( - re.compile(str.encode("found partition '{}' at offset {:#x} with size {:#x}".format(name, offset, size))), + re.compile(str.encode(f"found partition '{name}' at offset {offset:#x} with size {size:#x}")), timeout=5, ) def expect_find_partition(_type: str, subtype: str, label: str, name: str, offset: int, size: int) -> None: dut.expect( - re.compile(str.encode('Find partition with type {}, subtype {}, label {}'.format(_type, subtype, label))), + re.compile(str.encode(f'Find partition with type {_type}, subtype {subtype}, label {label}')), timeout=5, ) expect_partition(name, offset, size) diff --git a/examples/storage/spiffs/pytest_spiffs_example.py b/examples/storage/spiffs/pytest_spiffs_example.py index 59cd7ae39e5..4a9eb30f49e 100644 --- a/examples/storage/spiffs/pytest_spiffs_example.py +++ b/examples/storage/spiffs/pytest_spiffs_example.py @@ -21,5 +21,15 @@ def test_examples_spiffs(dut: Dut) -> None: rb'example: SPIFFS unmounted', ) - for msg in message_list: - dut.expect(re.compile(msg), timeout=60) + # Startup is fail-fast (Initializing SPIFFS appears quickly). + # First-boot format of ~960KB SPIFFS can exceed 120s on esp32c3 CI UART runners, + # so allow up to 240s for format/remount; remaining expects use 120s. + dut.expect(re.compile(message_list[0]), timeout=30) + + spiffs_format = rb'SPIFFS: mount failed, -10025\. formatting\.\.\.' + format_or_partition = re.compile(rb'(?:' + spiffs_format + rb'|' + message_list[1] + rb')') + if dut.expect(format_or_partition, timeout=240) == 0: + dut.expect(re.compile(message_list[1]), timeout=240) + + for msg in message_list[2:]: + dut.expect(re.compile(msg), timeout=120)