From 0f5073ea2cbc690caf6be76aa15f2221ec8a9ef1 Mon Sep 17 00:00:00 2001 From: "radek.tandler" Date: Tue, 17 Dec 2024 18:35:13 +0100 Subject: [PATCH 1/4] fix(ci): Removed storage related ignore warnings --- components/nvs_flash/test_apps/pytest_nvs_flash.py | 1 + components/vfs/test_apps/pytest_vfs.py | 2 ++ examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py | 2 +- examples/storage/nvs_rw_value/pytest_nvs_rw_value.py | 4 ++-- .../storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py | 4 ++-- .../wear_levelling/main/wear_levelling_example_main.c | 2 +- .../wear_levelling/pytest_wear_levelling_example.py | 7 +++---- .../known_generate_test_child_pipeline_warnings.yml | 9 +-------- 8 files changed, 13 insertions(+), 18 deletions(-) diff --git a/components/nvs_flash/test_apps/pytest_nvs_flash.py b/components/nvs_flash/test_apps/pytest_nvs_flash.py index 02d8e0747c..bfd5bc5941 100644 --- a/components/nvs_flash/test_apps/pytest_nvs_flash.py +++ b/components/nvs_flash/test_apps/pytest_nvs_flash.py @@ -12,6 +12,7 @@ CONFIGS_NVS_ENCR_FLASH_ENC = [ @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.generic @pytest.mark.parametrize('config', ['default'], indirect=True) def test_nvs_flash(dut: IdfDut) -> None: dut.expect_exact('Press ENTER to see the list of tests') diff --git a/components/vfs/test_apps/pytest_vfs.py b/components/vfs/test_apps/pytest_vfs.py index afee5fd2ea..60661554cd 100644 --- a/components/vfs/test_apps/pytest_vfs.py +++ b/components/vfs/test_apps/pytest_vfs.py @@ -8,6 +8,7 @@ from pytest_embedded import Dut @pytest.mark.esp32c3 @pytest.mark.esp32c6 @pytest.mark.esp32h2 +@pytest.mark.generic @pytest.mark.parametrize('config', [ 'default', 'iram', ], indirect=True) @@ -16,6 +17,7 @@ def test_vfs_default(dut: Dut) -> None: @pytest.mark.esp32 +@pytest.mark.generic @pytest.mark.parametrize('config', [ 'ccomp', ], indirect=True) diff --git a/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py b/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py index 01840dcda3..78fe25a3ff 100644 --- a/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py +++ b/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 - import logging import random import re @@ -13,6 +12,7 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.generic def test_examples_nvs_rw_blob(dut: Dut) -> None: def expect_start_msg(index: int) -> None: dut.expect('Restart counter = {}'.format(index), timeout=10) diff --git a/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py index aae3f1e038..a04d33a383 100644 --- a/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py +++ b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 - import logging from itertools import zip_longest @@ -10,11 +9,12 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.generic def test_examples_nvs_rw_value(dut: Dut) -> None: for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!',), fillvalue='Done'): dut.expect('Opening Non-Volatile Storage \\(NVS\\) handle... Done', timeout=20) dut.expect('Reading restart counter from NVS ... {}'.format(counter_state), timeout=20) - dut.expect('Restart counter = {}'.format(i) if i > 0 else '', timeout=20) + dut.expect('Restart counter = {}'.format(i) if int(i) > 0 else '', timeout=20) dut.expect('Updating restart counter in NVS ... Done', timeout=20) dut.expect('Committing updates in NVS ... Done', timeout=20) dut.expect('Restarting in 10 seconds...', timeout=20) diff --git a/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py b/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py index cd1237058c..b085002ae3 100644 --- a/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py +++ b/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 - import logging from itertools import zip_longest @@ -10,11 +9,12 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.generic def test_examples_nvs_rw_value_cxx(dut: Dut) -> None: for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!',), fillvalue='Done'): dut.expect('Opening Non-Volatile Storage \\(NVS\\) handle... Done', timeout=20) dut.expect('Reading restart counter from NVS ... {}'.format(counter_state), timeout=20) - dut.expect('Restart counter = {}'.format(i) if i > 0 else '', timeout=20) + dut.expect('Restart counter = {}'.format(i) if int(i) > 0 else '', timeout=20) dut.expect('Updating restart counter in NVS ... Done', timeout=20) dut.expect('Committing updates in NVS ... Done', timeout=20) dut.expect('Restarting in 10 seconds...', timeout=20) diff --git a/examples/storage/wear_levelling/main/wear_levelling_example_main.c b/examples/storage/wear_levelling/main/wear_levelling_example_main.c index 94eefb8853..ec8eb1949a 100644 --- a/examples/storage/wear_levelling/main/wear_levelling_example_main.c +++ b/examples/storage/wear_levelling/main/wear_levelling_example_main.c @@ -106,7 +106,7 @@ void app_main(void) ESP_LOGI(TAG, "file still exists"); return; } else { - ESP_LOGI(TAG, "file doesnt exist, format done"); + ESP_LOGI(TAG, "file does not exist, format done"); } //Create file and write diff --git a/examples/storage/wear_levelling/pytest_wear_levelling_example.py b/examples/storage/wear_levelling/pytest_wear_levelling_example.py index 51ef1670ac..60b10f5e0b 100644 --- a/examples/storage/wear_levelling/pytest_wear_levelling_example.py +++ b/examples/storage/wear_levelling/pytest_wear_levelling_example.py @@ -1,7 +1,5 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 - - import re import pytest @@ -10,6 +8,7 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.generic def test_wear_levelling_example(dut: Dut) -> None: message_list = ('example: Mounting FAT filesystem', @@ -18,7 +17,7 @@ def test_wear_levelling_example(dut: Dut) -> None: 'example: Reading file', re.compile(str.encode('example: Read from file: \'hello world, from ESP-IDF \\S+\'')), re.compile(str.encode('vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=\\S+')), - 'example: file doesnt exist, format done', + 'example: file does not exist, format done', 'example: Opening file', 'example: File written', 'example: Reading file', diff --git a/tools/ci/dynamic_pipelines/templates/known_generate_test_child_pipeline_warnings.yml b/tools/ci/dynamic_pipelines/templates/known_generate_test_child_pipeline_warnings.yml index b2389060a3..90014e07ae 100644 --- a/tools/ci/dynamic_pipelines/templates/known_generate_test_child_pipeline_warnings.yml +++ b/tools/ci/dynamic_pipelines/templates/known_generate_test_child_pipeline_warnings.yml @@ -2,14 +2,7 @@ # no_env_marker_test_cases: List of test cases that do not have environment markers. # each item shall be the test node id, you may check the error message to get the node id. no_env_marker_test_cases: - - components/nvs_flash/test_apps/pytest_nvs_flash.py::test_nvs_flash[default] - - components/vfs/test_apps/pytest_vfs.py::test_vfs_ccomp[ccomp] - - components/vfs/test_apps/pytest_vfs.py::test_vfs_default[default] - - components/vfs/test_apps/pytest_vfs.py::test_vfs_default[iram] - - examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py::test_examples_nvs_rw_blob - - examples/storage/nvs_rw_value/pytest_nvs_rw_value.py::test_examples_nvs_rw_value - - examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py::test_examples_nvs_rw_value_cxx - - examples/storage/wear_levelling/pytest_wear_levelling_example.py::test_wear_levelling_example + - dummy_test_case # no_runner_tags: List of runner tags that has no test runner set. # each item shall be a comma separated list of runner tags. From f78620853b88387f303b4c076669ac93fcf1dc0a Mon Sep 17 00:00:00 2001 From: "radek.tandler" Date: Fri, 20 Dec 2024 19:07:08 +0100 Subject: [PATCH 2/4] fix(storage/vfs): Fixed failing test cases in test_apps --- components/vfs/test_apps/sdkconfig.defaults | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/vfs/test_apps/sdkconfig.defaults b/components/vfs/test_apps/sdkconfig.defaults index 728b21c79f..a600d2e6c4 100644 --- a/components/vfs/test_apps/sdkconfig.defaults +++ b/components/vfs/test_apps/sdkconfig.defaults @@ -7,3 +7,5 @@ CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" CONFIG_ESP_TASK_WDT_INIT=n + +CONFIG_VFS_MAX_COUNT=10 From b4af220c1eca5b5dd1323c33bf821bd620c3a1f0 Mon Sep 17 00:00:00 2001 From: "radek.tandler" Date: Fri, 20 Dec 2024 19:28:11 +0100 Subject: [PATCH 3/4] fix(storage/nvs): Fixed failing test cases in example folder --- components/nvs_flash/test_apps/pytest_nvs_flash.py | 1 - examples/storage/nvs_rw_value/pytest_nvs_rw_value.py | 2 ++ examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/nvs_flash/test_apps/pytest_nvs_flash.py b/components/nvs_flash/test_apps/pytest_nvs_flash.py index bfd5bc5941..406bba61e0 100644 --- a/components/nvs_flash/test_apps/pytest_nvs_flash.py +++ b/components/nvs_flash/test_apps/pytest_nvs_flash.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 - import pytest from pytest_embedded_idf.dut import IdfDut diff --git a/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py index a04d33a383..6d918b130a 100644 --- a/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py +++ b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py @@ -11,6 +11,8 @@ from pytest_embedded import Dut @pytest.mark.esp32c3 @pytest.mark.generic def test_examples_nvs_rw_value(dut: Dut) -> None: + dut.serial.erase_flash() + dut.serial.flash() for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!',), fillvalue='Done'): dut.expect('Opening Non-Volatile Storage \\(NVS\\) handle... Done', timeout=20) dut.expect('Reading restart counter from NVS ... {}'.format(counter_state), timeout=20) diff --git a/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py b/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py index b085002ae3..1666d62c4d 100644 --- a/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py +++ b/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py @@ -11,6 +11,8 @@ from pytest_embedded import Dut @pytest.mark.esp32c3 @pytest.mark.generic def test_examples_nvs_rw_value_cxx(dut: Dut) -> None: + dut.serial.erase_flash() + dut.serial.flash() for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!',), fillvalue='Done'): dut.expect('Opening Non-Volatile Storage \\(NVS\\) handle... Done', timeout=20) dut.expect('Reading restart counter from NVS ... {}'.format(counter_state), timeout=20) From 11142cffb34f28f06f4b1cea2184a2ded09a9b2f Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Fri, 14 Feb 2025 14:04:18 +0100 Subject: [PATCH 4/4] ci: set app_list to empty list when not None --- tools/ci/idf_pytest/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/idf_pytest/plugin.py b/tools/ci/idf_pytest/plugin.py index 1d58bc6bbd..d3e39ea7d1 100644 --- a/tools/ci/idf_pytest/plugin.py +++ b/tools/ci/idf_pytest/plugin.py @@ -78,7 +78,7 @@ class IdfPytestEmbedded: self.apps_list = ( [os.path.join(idf_relpath(app.app_dir), app.build_dir) for app in apps if app.build_status == BuildStatus.SUCCESS] - if apps + if apps is not None else None )