From 327108842843ea27ef7cd9683c889f3ab229f0b7 Mon Sep 17 00:00:00 2001 From: "radek.tandler" Date: Fri, 8 Jul 2022 11:34:03 +0200 Subject: [PATCH] storage examples migrated to pytest --- .../storage/ext_flash_fatfs/example_test.py | 19 --- .../main/ext_flash_fatfs_example_main.c | 8 +- .../ext_flash_fatfs/pytest_ext_flash_fatfs.py | 19 +++ .../storage/fatfsgen/fatfsgen_example_test.py | 95 --------------- .../fatfsgen/pytest_fatfsgen_example.py | 109 ++++++++++++++++++ .../nvs_rw_blob/nvs_rw_blob_example_test.py | 44 ------- .../storage/nvs_rw_blob/pytest_nvs_rw_blob.py | 41 +++++++ .../nvs_rw_value/nvs_rw_value_example_test.py | 29 ----- .../nvs_rw_value/pytest_nvs_rw_value.py | 21 ++++ .../nvs_rw_value_cxx_example_test.py | 29 ----- .../pytest_nvs_rw_value_cxx.py | 21 ++++ ...st.py => pytest_partition_find_example.py} | 37 +++--- .../partition_mmap_example_test.py | 23 ---- .../pytest_partition_mmap_example.py | 22 ++++ .../partition_ops_example_test.py | 19 --- .../pytest_partition_ops_example.py | 20 ++++ examples/storage/parttool/example_test.py | 36 ------ .../parttool/pytest_parttool_example.py | 28 +++++ .../sdmmc/pytest_sdmmc_card_example.py | 37 ++++++ .../sd_card/sdmmc/sd_card_example_test.py | 36 ------ .../sdspi/pytest_sdspi_card_example.py | 39 +++++++ .../sd_card/sdspi/sd_card_example_test.py | 36 ------ .../storage/spiffs/pytest_spiffs_example.py | 23 ++++ .../storage/spiffs/spiffs_example_test.py | 23 ---- ...le_test.py => pytest_spiffsgen_example.py} | 18 ++- .../pytest_wear_levelling_example.py | 24 ++++ .../wear_levelling_example_test.py | 22 ---- pytest.ini | 3 + 28 files changed, 441 insertions(+), 440 deletions(-) delete mode 100644 examples/storage/ext_flash_fatfs/example_test.py create mode 100644 examples/storage/ext_flash_fatfs/pytest_ext_flash_fatfs.py delete mode 100644 examples/storage/fatfsgen/fatfsgen_example_test.py create mode 100644 examples/storage/fatfsgen/pytest_fatfsgen_example.py delete mode 100644 examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py create mode 100644 examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py delete mode 100644 examples/storage/nvs_rw_value/nvs_rw_value_example_test.py create mode 100644 examples/storage/nvs_rw_value/pytest_nvs_rw_value.py delete mode 100644 examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py create mode 100644 examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py rename examples/storage/partition_api/partition_find/{partition_find_example_test.py => pytest_partition_find_example.py} (60%) delete mode 100644 examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py create mode 100644 examples/storage/partition_api/partition_mmap/pytest_partition_mmap_example.py delete mode 100644 examples/storage/partition_api/partition_ops/partition_ops_example_test.py create mode 100644 examples/storage/partition_api/partition_ops/pytest_partition_ops_example.py delete mode 100644 examples/storage/parttool/example_test.py create mode 100644 examples/storage/parttool/pytest_parttool_example.py create mode 100644 examples/storage/sd_card/sdmmc/pytest_sdmmc_card_example.py delete mode 100644 examples/storage/sd_card/sdmmc/sd_card_example_test.py create mode 100644 examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py delete mode 100644 examples/storage/sd_card/sdspi/sd_card_example_test.py create mode 100644 examples/storage/spiffs/pytest_spiffs_example.py delete mode 100644 examples/storage/spiffs/spiffs_example_test.py rename examples/storage/spiffsgen/{example_test.py => pytest_spiffsgen_example.py} (65%) create mode 100644 examples/storage/wear_levelling/pytest_wear_levelling_example.py delete mode 100644 examples/storage/wear_levelling/wear_levelling_example_test.py diff --git a/examples/storage/ext_flash_fatfs/example_test.py b/examples/storage/ext_flash_fatfs/example_test.py deleted file mode 100644 index 3fa133bb51..0000000000 --- a/examples/storage/ext_flash_fatfs/example_test.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import print_function - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_ExtFlash') -def test_examples_storage_ext_flash_fatfs(env, extra_data): - dut = env.get_dut('ext_flash_fatfs', 'examples/storage/ext_flash_fatfs', dut_class=ttfw_idf.ESP32DUT) - dut.start_app() - - dut.expect('Initialized external Flash') - dut.expect('partition \'nvs\'') - dut.expect('partition \'storage\'') - dut.expect('File written') - dut.expect('Read from file: \'Written using ESP-IDF') - - -if __name__ == '__main__': - test_examples_storage_ext_flash_fatfs() diff --git a/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c b/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c index a333419dc1..b7b7a90d03 100644 --- a/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c +++ b/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c @@ -13,6 +13,7 @@ #include #include #include + #include "esp_flash.h" #include "esp_flash_spi_init.h" #include "esp_partition.h" @@ -165,7 +166,12 @@ static const esp_partition_t* example_add_partition(esp_flash_t* ext_flash, cons { ESP_LOGI(TAG, "Adding external Flash as a partition, label=\"%s\", size=%d KB", partition_label, ext_flash->size / 1024); const esp_partition_t* fat_partition; - ESP_ERROR_CHECK(esp_partition_register_external(ext_flash, 0, ext_flash->size, partition_label, ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, &fat_partition)); + const size_t offset = 0; + ESP_ERROR_CHECK(esp_partition_register_external(ext_flash, offset, ext_flash->size, partition_label, ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, &fat_partition)); + + // Erase space of partition on the external flash chip + ESP_LOGI(TAG, "Erasing partition range, offset=%d size=%d KB", offset, ext_flash->size / 1024); + ESP_ERROR_CHECK(esp_partition_erase_range(fat_partition, offset, ext_flash->size)); return fat_partition; } diff --git a/examples/storage/ext_flash_fatfs/pytest_ext_flash_fatfs.py b/examples/storage/ext_flash_fatfs/pytest_ext_flash_fatfs.py new file mode 100644 index 0000000000..8b85b85d2d --- /dev/null +++ b/examples/storage/ext_flash_fatfs/pytest_ext_flash_fatfs.py @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.external_flash +def test_ext_flash_fatfs(dut: Dut) -> None: + message_list = ('Initialized external Flash', + 'partition \'nvs\'', + 'partition \'storage\'', + 'File written', + 'Read from file: \'Written using ESP-IDF') + + for msg in message_list: + dut.expect(msg, timeout=20) diff --git a/examples/storage/fatfsgen/fatfsgen_example_test.py b/examples/storage/fatfsgen/fatfsgen_example_test.py deleted file mode 100644 index fbcb9acc87..0000000000 --- a/examples/storage/fatfsgen/fatfsgen_example_test.py +++ /dev/null @@ -1,95 +0,0 @@ -# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: CC0-1.0 -import os -from datetime import datetime -from pathlib import Path -from typing import Optional - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') -def test_examples_fatfsgen(env: ttfw_idf.TinyFW.Env, _: Optional[list]) -> None: - tag = 'fatfsgen' - test_path = 'examples/storage/fatfsgen' - timeout = 20 - filename_ln = 'sublongnames/testlongfilenames.txt' - filename_sn = 'sub/test.txt' - dir_ln = os.path.join(os.path.dirname(__file__), 'fatfs_long_name_image') - dir_sn = os.path.join(os.path.dirname(__file__), 'fatfs_image') - Path(os.path.join(dir_ln, filename_ln)).touch() - Path(os.path.join(dir_sn, filename_sn)).touch() - date_modified = datetime.today().strftime('%Y-%m-%d') - date_default = '1980-01-01' - - for test_name in ['test_read_write_partition_gen', 'test_read_write_partition_gen_default_dt']: - filename = filename_sn - filename_expected = f'/spiflash/{filename}' - date_ = date_default if test_name == 'test_read_write_partition_gen_default_dt' else date_modified - dut = env.get_dut(tag, test_path, app_config_name=test_name) - dut.start_app() - dut.expect_all('example: Mounting FAT filesystem', - 'example: Opening file', - 'example: File written', - 'example: Reading file', - 'example: Read from file: \'This is written by the device\'', - 'example: Reading file', - f'The file \'{filename_expected}\' was modified at date: {date_}', - 'example: Read from file: \'This is generated on the host\'', - 'example: Unmounting FAT filesystem', - 'example: Done', - timeout=timeout) - env.close_dut(dut.name) - - for test_name in ['test_read_only_partition_gen', 'test_read_only_partition_gen_default_dt']: - filename = filename_sn - filename_expected = f'/spiflash/{filename}' - date_ = date_default if test_name == 'test_read_only_partition_gen_default_dt' else date_modified - dut = env.get_dut(tag, test_path, app_config_name=test_name) - dut.start_app() - dut.expect_all('example: Mounting FAT filesystem', - 'example: Reading file', - f'The file \'{filename_expected}\' was modified at date: {date_}', - 'example: Read from file: \'this is test\'', - 'example: Unmounting FAT filesystem', - 'example: Done', - timeout=timeout) - env.close_dut(dut.name) - - for test_name in ['test_read_write_partition_gen_ln', 'test_read_write_partition_gen_ln_default_dt']: - filename = filename_ln - filename_expected = f'/spiflash/{filename}' - date_ = date_default if test_name == 'test_read_write_partition_gen_ln_default_dt' else date_modified - dut = env.get_dut(tag, test_path, app_config_name=test_name) - dut.start_app() - dut.expect_all('example: Mounting FAT filesystem', - 'example: Opening file', - 'example: File written', - 'example: Reading file', - 'example: Read from file: \'This is written by the device\'', - 'example: Reading file', - f'The file \'{filename_expected}\' was modified at date: {date_}', - 'example: Read from file: \'This is generated on the host; long name it has\'', - 'example: Unmounting FAT filesystem', - 'example: Done', - timeout=timeout) - env.close_dut(dut.name) - - for test_name in ['test_read_only_partition_gen_ln', 'test_read_only_partition_gen_ln_default_dt']: - filename = filename_ln - filename_expected = f'/spiflash/{filename}' - date_ = date_default if test_name == 'test_read_only_partition_gen_ln_default_dt' else date_modified - dut = env.get_dut(tag, test_path, app_config_name=test_name) - dut.start_app() - dut.expect_all('example: Mounting FAT filesystem', - 'example: Reading file', - f'The file \'{filename_expected}\' was modified at date: {date_}', - 'example: Read from file: \'this is test; long name it has\'', - 'example: Unmounting FAT filesystem', - 'example: Done', - timeout=timeout) - env.close_dut(dut.name) - - -if __name__ == '__main__': - test_examples_fatfsgen() diff --git a/examples/storage/fatfsgen/pytest_fatfsgen_example.py b/examples/storage/fatfsgen/pytest_fatfsgen_example.py new file mode 100644 index 0000000000..a6778d249b --- /dev/null +++ b/examples/storage/fatfsgen/pytest_fatfsgen_example.py @@ -0,0 +1,109 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import re +from datetime import datetime +from typing import List + +import pytest +from pytest_embedded import Dut + + +# Example_GENERIC +@pytest.mark.esp32 +@pytest.mark.parametrize('config', ['test_read_only_partition_gen', + 'test_read_only_partition_gen_default_dt', + 'test_read_only_partition_gen_ln', + 'test_read_only_partition_gen_ln_default_dt', + 'test_read_write_partition_gen', + 'test_read_write_partition_gen_default_dt', + 'test_read_write_partition_gen_ln', + 'test_read_write_partition_gen_ln_default_dt', + ], indirect=True) +def test_examples_fatfsgen(config: str, dut: Dut) -> None: + # Expects list of strings sequentially + def expect_all(msg_list: List[str], to: int) -> None: + for msg in msg_list: + dut.expect(msg, timeout=to) + + # Expects prefix string followed by date in the format 'yyyy-mm-dd' + def expect_date(prefix: str, to: int) -> datetime: + expect_str = prefix + '(\\d+)-(\\d+)-(\\d+)' + match_ = dut.expect(re.compile(str.encode(expect_str)), timeout=to) + year_ = int(match_[1].decode()) + month_ = int(match_[2].decode()) + day_ = int(match_[3].decode()) + return datetime(year_, month_, day_) + + # Calculates absolute difference in days between date_reference and date_actual. + # Raises exception if difference exceeds tolerance + def evaluate_dates(date_reference: datetime, date_actual: datetime, days_tolerance: int) -> None: + td = date_actual - date_reference + if abs(td.days) > days_tolerance: + raise Exception(f'Too big date difference. Actual: {date_actual}, reference: {date_reference}, tolerance: {days_tolerance} day(s)') + + # Expect timeout + timeout = 20 + + # We tolerate 30 days difference between actual file creation and date when test was executed. + tolerance = 30 + filename_ln = 'sublongnames/testlongfilenames.txt' + filename_sn = 'sub/test.txt' + date_modified = datetime.today() + date_default = datetime(1980, 1, 1) + + if config in ['test_read_write_partition_gen', 'test_read_write_partition_gen_default_dt']: + filename = filename_sn + filename_expected = f'/spiflash/{filename}' + date_ref = date_default if config == 'test_read_write_partition_gen_default_dt' else date_modified + expect_all(['example: Mounting FAT filesystem', + 'example: Opening file', + 'example: File written', + 'example: Reading file', + 'example: Read from file: \'This is written by the device\'', + 'example: Reading file'], timeout) + date_act = expect_date(f'The file \'{filename_expected}\' was modified at date: ', timeout) + evaluate_dates(date_ref, date_act, tolerance) + expect_all(['example: Read from file: \'This is generated on the host\'', + 'example: Unmounting FAT filesystem', + 'example: Done'], timeout) + + elif config in ['test_read_only_partition_gen', 'test_read_only_partition_gen_default_dt']: + filename = filename_sn + filename_expected = f'/spiflash/{filename}' + date_ref = date_default if config == 'test_read_only_partition_gen_default_dt' else date_modified + expect_all(['example: Mounting FAT filesystem', + 'example: Reading file'], timeout) + date_act = expect_date(f'The file \'{filename_expected}\' was modified at date: ', timeout) + evaluate_dates(date_ref, date_act, tolerance) + expect_all(['example: Read from file: \'this is test\'', + 'example: Unmounting FAT filesystem', + 'example: Done'], timeout) + + elif config in ['test_read_write_partition_gen_ln', 'test_read_write_partition_gen_ln_default_dt']: + filename = filename_ln + filename_expected = f'/spiflash/{filename}' + date_ref = date_default if config == 'test_read_write_partition_gen_ln_default_dt' else date_modified + expect_all(['example: Mounting FAT filesystem', + 'example: Opening file', + 'example: File written', + 'example: Reading file', + 'example: Read from file: \'This is written by the device\'', + 'example: Reading file'], timeout) + date_act = expect_date(f'The file \'{filename_expected}\' was modified at date: ', timeout) + evaluate_dates(date_ref, date_act, tolerance) + expect_all(['example: Read from file: \'This is generated on the host; long name it has\'', + 'example: Unmounting FAT filesystem', + 'example: Done'], timeout) + + elif config in ['test_read_only_partition_gen_ln', 'test_read_only_partition_gen_ln_default_dt']: + filename = filename_ln + filename_expected = f'/spiflash/{filename}' + date_ref = date_default if config == 'test_read_only_partition_gen_ln_default_dt' else date_modified + expect_all(['example: Mounting FAT filesystem', + 'example: Reading file'], timeout) + date_act = expect_date(f'The file \'{filename_expected}\' was modified at date: ', timeout) + evaluate_dates(date_ref, date_act, tolerance) + expect_all(['example: Read from file: \'this is test; long name it has\'', + 'example: Unmounting FAT filesystem', + 'example: Done'], timeout) diff --git a/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py b/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py deleted file mode 100644 index b715a781ce..0000000000 --- a/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py +++ /dev/null @@ -1,44 +0,0 @@ -import random -import re -import time - -import ttfw_idf -from tiny_test_fw import Utility - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_nvs_rw_blob(env, extra_data): - - dut = env.get_dut('nvs_rw_blob', 'examples/storage/nvs_rw_blob') - dut.start_app() - - def expect_start_msg(index): - dut.expect_all('Restart counter = {}'.format(index), - 'Run time:', - timeout=10) - - expect_start_msg(0) - dut.expect('Nothing saved yet!', timeout=5) - - nvs_store = [] - for i in range(1, 10): - time.sleep(random.uniform(0.1, 2)) # in order to randomize the runtimes stored in NVS - try: - # Pulling pin low using DTR - dut.port_inst.setDTR(True) - dut.expect('Restarting...', timeout=5) # the application waits for a second - finally: - dut.port_inst.setDTR(False) - - expect_start_msg(i) - - dut.expect_all(*nvs_store, timeout=10) - Utility.console_log('Received: {}'.format(', '.join(nvs_store))) - - new_runtime = dut.expect(re.compile(r'{}: (\d+)'.format(i)), timeout=10)[0] - nvs_store.append('{}: {}'.format(i, new_runtime)) - Utility.console_log('loop {} has finished with runtime {}'.format(i, new_runtime)) - - -if __name__ == '__main__': - test_examples_nvs_rw_blob() diff --git a/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py b/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py new file mode 100644 index 0000000000..23430e76d1 --- /dev/null +++ b/examples/storage/nvs_rw_blob/pytest_nvs_rw_blob.py @@ -0,0 +1,41 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import logging +import random +import re +import time +from typing import List + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_examples_nvs_rw_blob(dut: Dut) -> None: + def expect_start_msg(index: int) -> None: + dut.expect('Restart counter = {}'.format(index), timeout=10) + dut.expect('Run time:', timeout=10) + + expect_start_msg(0) + dut.expect('Nothing saved yet!', timeout=5) + nvs_store: List[str] = [] + for i in range(1, 10): + time.sleep(random.uniform(0.1, 2)) # in order to randomize the runtimes stored in NVS + try: + # Pulling pin low using DTR + dut.serial.proc.setDTR(True) + dut.expect('Restarting...', timeout=5) # the application waits for a second + finally: + dut.serial.proc.setDTR(False) + + expect_start_msg(i) + + for store_item in nvs_store: + dut.expect(store_item.encode(), timeout=10) + + logging.info('Received: {}'.format(', '.join(nvs_store))) + new_runtime = (dut.expect(re.compile(str.encode('{}: (\\d+)'.format(i))), timeout=10)[0]).decode() + nvs_store.append(new_runtime) + logging.info('loop {} has finished with runtime {}'.format(i, new_runtime)) diff --git a/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py b/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py deleted file mode 100644 index 096908292e..0000000000 --- a/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py +++ /dev/null @@ -1,29 +0,0 @@ -import ttfw_idf -from tiny_test_fw import Utility - -try: - from itertools import izip_longest as zip_longest -except ImportError: - # Python 3 - from itertools import zip_longest - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_nvs_rw_value(env, extra_data): - - dut = env.get_dut('nvs_rw_value', 'examples/storage/nvs_rw_value') - dut.start_app() - - for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!', ), fillvalue='Done'): - dut.expect_all('Opening Non-Volatile Storage (NVS) handle... Done', - 'Reading restart counter from NVS ... {}'.format(counter_state), - 'Restart counter = {}'.format(i) if i > 0 else '', - 'Updating restart counter in NVS ... Done', - 'Committing updates in NVS ... Done', - 'Restarting in 10 seconds...', - timeout=20) - Utility.console_log('loop {} has finished'.format(i)) - - -if __name__ == '__main__': - test_examples_nvs_rw_value() diff --git a/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py new file mode 100644 index 0000000000..f42756d6f4 --- /dev/null +++ b/examples/storage/nvs_rw_value/pytest_nvs_rw_value.py @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import logging +from itertools import zip_longest + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +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('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) + logging.info('loop {} has finished'.format(i)) diff --git a/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py b/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py deleted file mode 100644 index 3b3e243297..0000000000 --- a/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py +++ /dev/null @@ -1,29 +0,0 @@ -import ttfw_idf -from tiny_test_fw import Utility - -try: - from itertools import izip_longest as zip_longest -except ImportError: - # Python 3 - from itertools import zip_longest - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_nvs_rw_value_cxx(env, extra_data): - - dut = env.get_dut('nvs_rw_value_cxx', 'examples/storage/nvs_rw_value_cxx') - dut.start_app() - - for i, counter_state in zip_longest(range(4), ('The value is not initialized yet!', ), fillvalue='Done'): - dut.expect_all('Opening Non-Volatile Storage (NVS) handle... Done', - 'Reading restart counter from NVS ... {}'.format(counter_state), - 'Restart counter = {}'.format(i) if i > 0 else '', - 'Updating restart counter in NVS ... Done', - 'Committing updates in NVS ... Done', - 'Restarting in 10 seconds...', - timeout=20) - Utility.console_log('loop {} has finished'.format(i)) - - -if __name__ == '__main__': - test_examples_nvs_rw_value_cxx() 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 new file mode 100644 index 0000000000..f42756d6f4 --- /dev/null +++ b/examples/storage/nvs_rw_value_cxx/pytest_nvs_rw_value_cxx.py @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import logging +from itertools import zip_longest + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +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('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) + logging.info('loop {} has finished'.format(i)) diff --git a/examples/storage/partition_api/partition_find/partition_find_example_test.py b/examples/storage/partition_api/partition_find/pytest_partition_find_example.py similarity index 60% rename from examples/storage/partition_api/partition_find/partition_find_example_test.py rename to examples/storage/partition_api/partition_find/pytest_partition_find_example.py index 7e6b0ca5d9..1bd7d5a22a 100644 --- a/examples/storage/partition_api/partition_find/partition_find_example_test.py +++ b/examples/storage/partition_api/partition_find/pytest_partition_find_example.py @@ -1,20 +1,24 @@ -import ttfw_idf +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import re + +import pytest +from pytest_embedded import Dut -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_partition_find(env, extra_data): +@pytest.mark.esp32 +@pytest.mark.esp32c3 +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))), timeout=5) - dut = env.get_dut('partition_find', 'examples/storage/partition_api/partition_find') - dut.start_app() - - def expect_partition(name, offset, size): - dut.expect("found partition '{}' at offset {:#x} with size {:#x}".format(name, offset, size), timeout=5) - - def expect_find_partition(_type, subtype, label, name, offset, size): - dut.expect('Find partition with type {}, subtype {}, label {}'.format(_type, subtype, label), 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))), timeout=5) expect_partition(name, offset, size) dut.expect('----------------Find partitions---------------', timeout=20) + expect_find_partition('ESP_PARTITION_TYPE_DATA', 'ESP_PARTITION_SUBTYPE_DATA_NVS', 'NULL', 'nvs', 0x9000, 0x6000) expect_find_partition('ESP_PARTITION_TYPE_DATA', 'ESP_PARTITION_SUBTYPE_DATA_PHY', 'NULL', @@ -25,21 +29,20 @@ def test_examples_partition_find(env, extra_data): 'storage1', 0x110000, 0x40000) dut.expect('Find second FAT partition by specifying the label', timeout=5) + expect_find_partition('ESP_PARTITION_TYPE_DATA', 'ESP_PARTITION_SUBTYPE_DATA_FAT', 'storage2', 'storage2', 0x150000, 0x40000) - dut.expect_all('----------------Iterate through partitions---------------', - 'Iterating through app partitions...', timeout=5) + dut.expect('----------------Iterate through partitions---------------',timeout=5) + dut.expect('Iterating through app partitions...', timeout=5) + expect_partition('factory', 0x10000, 0x100000) dut.expect('Iterating through data partitions...', timeout=5) + expect_partition('nvs', 0x9000, 0x6000) expect_partition('phy_init', 0xf000, 0x1000) expect_partition('storage1', 0x110000, 0x40000) expect_partition('storage2', 0x150000, 0x40000) dut.expect('Example end', timeout=5) - - -if __name__ == '__main__': - test_examples_partition_find() diff --git a/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py b/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py deleted file mode 100644 index 8521907752..0000000000 --- a/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py +++ /dev/null @@ -1,23 +0,0 @@ -import re - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_partition_mmap(env, extra_data): - - dut = env.get_dut('partition_mmap', 'examples/storage/partition_api/partition_mmap') - dut.start_app() - - # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received - dut.expect_all('Written sample data to partition: ESP-IDF Partition Memory Map Example', - re.compile(r'Mapped partition to data memory address \S+'), - 'Read sample data from partition using mapped memory: ESP-IDF Partition Memory Map Example', - 'Data matches', - 'Unmapped partition from data memory', - 'Example end', - timeout=20) - - -if __name__ == '__main__': - test_examples_partition_mmap() diff --git a/examples/storage/partition_api/partition_mmap/pytest_partition_mmap_example.py b/examples/storage/partition_api/partition_mmap/pytest_partition_mmap_example.py new file mode 100644 index 0000000000..e77d29fe5b --- /dev/null +++ b/examples/storage/partition_api/partition_mmap/pytest_partition_mmap_example.py @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_partition_mmap_example(dut: Dut) -> None: + # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received + message_list = (rb'Written sample data to partition: ESP-IDF Partition Memory Map Example', + rb'Mapped partition to data memory address \S+', + rb'Read sample data from partition using mapped memory: ESP-IDF Partition Memory Map Example', + rb'Data matches', + rb'Unmapped partition from data memory', + rb'Example end') + + for msg in message_list: + dut.expect(re.compile(msg), timeout=20) diff --git a/examples/storage/partition_api/partition_ops/partition_ops_example_test.py b/examples/storage/partition_api/partition_ops/partition_ops_example_test.py deleted file mode 100644 index debadfc1d4..0000000000 --- a/examples/storage/partition_api/partition_ops/partition_ops_example_test.py +++ /dev/null @@ -1,19 +0,0 @@ -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_partition_ops(env, extra_data): - - dut = env.get_dut('partition_ops', 'examples/storage/partition_api/partition_ops') - dut.start_app() - - # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received - dut.expect_all('Written data: ESP-IDF Partition Operations Example (Read, Erase, Write)', - 'Read data: ESP-IDF Partition Operations Example (Read, Erase, Write)', - 'Erased data', - 'Example end', - timeout=20) - - -if __name__ == '__main__': - test_examples_partition_ops() diff --git a/examples/storage/partition_api/partition_ops/pytest_partition_ops_example.py b/examples/storage/partition_api/partition_ops/pytest_partition_ops_example.py new file mode 100644 index 0000000000..c5f031a703 --- /dev/null +++ b/examples/storage/partition_api/partition_ops/pytest_partition_ops_example.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_partition_ops_example(dut: Dut) -> None: + # ESP_ERROR_CHECK or assert will cause abort on error and "Example end" won't be received + message_list = (rb'Written data: ESP-IDF Partition Operations Example \(Read, Erase, Write\)', + rb'Read data: ESP-IDF Partition Operations Example \(Read, Erase, Write\)', + rb'Erased data', + rb'Example end') + + for msg in message_list: + dut.expect(re.compile(msg), timeout=20) diff --git a/examples/storage/parttool/example_test.py b/examples/storage/parttool/example_test.py deleted file mode 100644 index 358383f837..0000000000 --- a/examples/storage/parttool/example_test.py +++ /dev/null @@ -1,36 +0,0 @@ -from __future__ import print_function - -import os -import subprocess -import sys - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_parttool(env, extra_data): - dut = env.get_dut('parttool', 'examples/storage/parttool') - dut.start_app(False) - - # Verify factory firmware - dut.expect('Partitions Tool Example') - dut.expect('Example end') - - # Close connection to DUT - dut.receive_thread.exit() - dut.port_inst.close() - - # Run the example python script - script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'storage', 'parttool', 'parttool_example.py') - - binary_path = '' - for flash_file in dut.app.flash_files: - if 'parttool.bin' in flash_file[1]: - binary_path = flash_file[1] - break - - subprocess.check_call([sys.executable, script_path, '--binary', binary_path, '--port', dut.port]) - - -if __name__ == '__main__': - test_examples_parttool() diff --git a/examples/storage/parttool/pytest_parttool_example.py b/examples/storage/parttool/pytest_parttool_example.py new file mode 100644 index 0000000000..a53ba47103 --- /dev/null +++ b/examples/storage/parttool/pytest_parttool_example.py @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import os +import subprocess +import sys + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_examples_parttool(dut: Dut) -> None: + # Verify factory firmware + dut.expect('Partitions Tool Example') + dut.expect('Example end') + + # Close connection to DUT + dut.pexpect_proc.terminate() + dut.serial.stop_redirect_thread() + + # Run the example python script + idf_path = os.getenv('IDF_PATH') + assert idf_path is not None + script_path = os.path.join(idf_path, 'examples', 'storage', 'parttool', 'parttool_example.py') + binary_path = os.path.join(dut.app.binary_path, 'parttool.bin') + subprocess.check_call([sys.executable, script_path, '--binary', binary_path, '--port', dut.serial.port]) diff --git a/examples/storage/sd_card/sdmmc/pytest_sdmmc_card_example.py b/examples/storage/sd_card/sdmmc/pytest_sdmmc_card_example.py new file mode 100644 index 0000000000..7d502b2fc7 --- /dev/null +++ b/examples/storage/sd_card/sdmmc/pytest_sdmmc_card_example.py @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + + +import logging +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.sdcard_sdmode +def test_examples_sd_card_sdmmc(dut: Dut) -> None: + dut.expect('example: Initializing SD card', timeout=20) + dut.expect('example: Using SDMMC peripheral', timeout=10) + + # Provide enough time for possible SD card formatting + dut.expect('Filesystem mounted', timeout=60) + + # These lines are matched separately because of ASCII color codes in the output + name = dut.expect(re.compile(rb'Name: (\w+)\r'), timeout=10).group(1).decode() + _type = dut.expect(re.compile(rb'Type: (\S+)'), timeout=10).group(1).decode() + speed = dut.expect(re.compile(rb'Speed: (\S+)'), timeout=10).group(1).decode() + size = dut.expect(re.compile(rb'Size: (\S+)'), timeout=10).group(1).decode() + + logging.info('Card {} {} {}MHz {} found'.format(name, _type, speed, size)) + + message_list = ('Opening file /sdcard/hello.txt', + 'File written', + 'Renaming file /sdcard/hello.txt to /sdcard/foo.txt', + 'Reading file /sdcard/foo.txt', + "Read from file: 'Hello {}!'".format(name), + 'Card unmounted') + + for msg in message_list: + dut.expect(msg, timeout=10) diff --git a/examples/storage/sd_card/sdmmc/sd_card_example_test.py b/examples/storage/sd_card/sdmmc/sd_card_example_test.py deleted file mode 100644 index 7251aed5a0..0000000000 --- a/examples/storage/sd_card/sdmmc/sd_card_example_test.py +++ /dev/null @@ -1,36 +0,0 @@ -import re - -import ttfw_idf -from tiny_test_fw import Utility - - -@ttfw_idf.idf_example_test(env_tag='UT_T1_SDMODE') -def test_examples_sd_card_sdmmc(env, extra_data): # type: (ttfw_idf.Env.Env, None ) -> None - - dut = env.get_dut('sd_card', 'examples/storage/sd_card/sdmmc') - dut.start_app() - dut.expect('example: Initializing SD card', timeout=20) - dut.expect('example: Using SDMMC peripheral', timeout=10) - - # Provide enough time for possible SD card formatting - dut.expect('Filesystem mounted', timeout=60) - - # These lines are matched separately because of ASCII color codes in the output - name = dut.expect(re.compile(r'Name: (\w+)\r'), timeout=10)[0] - _type = dut.expect(re.compile(r'Type: (\S+)'), timeout=10)[0] - speed = dut.expect(re.compile(r'Speed: (\S+)'), timeout=10)[0] - size = dut.expect(re.compile(r'Size: (\S+)'), timeout=10)[0] - - Utility.console_log('Card {} {} {}MHz {} found'.format(name, _type, speed, size)) - - dut.expect_all('Opening file /sdcard/hello.txt', - 'File written', - 'Renaming file /sdcard/hello.txt to /sdcard/foo.txt', - 'Reading file /sdcard/foo.txt', - "Read from file: 'Hello {}!'".format(name), - 'Card unmounted', - timeout=10) - - -if __name__ == '__main__': - test_examples_sd_card_sdmmc() diff --git a/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py b/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py new file mode 100644 index 0000000000..4090ea23d7 --- /dev/null +++ b/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py @@ -0,0 +1,39 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + + +import logging +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 # no runner available at the moment +@pytest.mark.esp32s2 +@pytest.mark.sdcard_spimode +def test_examples_sd_card_sdmmc(dut: Dut) -> None: + dut.expect('example: Initializing SD card', timeout=20) + dut.expect('example: Using SPI peripheral', timeout=20) + + # Provide enough time for possible SD card formatting + dut.expect('Filesystem mounted', timeout=60) + + # These lines are matched separately because of ASCII color codes in the output + name = dut.expect(re.compile(rb'Name: (\w+)\r'), timeout=20).group(1).decode() + _type = dut.expect(re.compile(rb'Type: (\S+)'), timeout=20).group(1).decode() + speed = dut.expect(re.compile(rb'Speed: (\S+)'), timeout=20).group(1).decode() + size = dut.expect(re.compile(rb'Size: (\S+)'), timeout=20).group(1).decode() + + logging.info('Card {} {} {}MHz {} found'.format(name, _type, speed, size)) + + message_list = ('Opening file /sdcard/hello.txt', + 'File written', + 'Renaming file /sdcard/hello.txt to /sdcard/foo.txt', + 'Reading file /sdcard/foo.txt', + "Read from file: 'Hello {}!'".format(name), + 'Card unmounted') + + for msg in message_list: + dut.expect(msg, timeout=20) diff --git a/examples/storage/sd_card/sdspi/sd_card_example_test.py b/examples/storage/sd_card/sdspi/sd_card_example_test.py deleted file mode 100644 index 2777599d36..0000000000 --- a/examples/storage/sd_card/sdspi/sd_card_example_test.py +++ /dev/null @@ -1,36 +0,0 @@ -import re - -import ttfw_idf -from tiny_test_fw import Utility - - -@ttfw_idf.idf_example_test(env_tag='UT_T1_SPIMODE', target=['esp32', 'esp32s2', 'esp32c3']) -def test_examples_sd_card_sdspi(env, extra_data): # type: (ttfw_idf.Env.Env, None ) -> None - - dut = env.get_dut('sd_card', 'examples/storage/sd_card/sdspi') - dut.start_app() - dut.expect('example: Initializing SD card', timeout=20) - dut.expect('example: Using SPI peripheral', timeout=20) - - # Provide enough time for possible SD card formatting - dut.expect('Filesystem mounted', timeout=60) - - # These lines are matched separately because of ASCII color codes in the output - name = dut.expect(re.compile(r'Name: (\w+)\r'), timeout=20)[0] - _type = dut.expect(re.compile(r'Type: (\S+)'), timeout=20)[0] - speed = dut.expect(re.compile(r'Speed: (\S+)'), timeout=20)[0] - size = dut.expect(re.compile(r'Size: (\S+)'), timeout=20)[0] - - Utility.console_log('Card {} {} {}MHz {} found'.format(name, _type, speed, size)) - - dut.expect_all('Opening file /sdcard/hello.txt', - 'File written', - 'Renaming file /sdcard/hello.txt to /sdcard/foo.txt', - 'Reading file /sdcard/foo.txt', - "Read from file: 'Hello {}!'".format(name), - 'Card unmounted', - timeout=20) - - -if __name__ == '__main__': - test_examples_sd_card_sdspi() diff --git a/examples/storage/spiffs/pytest_spiffs_example.py b/examples/storage/spiffs/pytest_spiffs_example.py new file mode 100644 index 0000000000..70e1540ecd --- /dev/null +++ b/examples/storage/spiffs/pytest_spiffs_example.py @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_examples_spiffs(dut: Dut) -> None: + message_list = (rb'example: Initializing SPIFFS', + rb'example: Partition size: total: \d+, used: \d+', + rb'example: Opening file', + rb'example: File written', + rb'example: Renaming file', + rb'example: Reading file', + rb'example: Read from file: \'Hello World!\'', + rb'example: SPIFFS unmounted') + + for msg in message_list: + dut.expect(re.compile(msg), timeout=60) diff --git a/examples/storage/spiffs/spiffs_example_test.py b/examples/storage/spiffs/spiffs_example_test.py deleted file mode 100644 index 1922a070c6..0000000000 --- a/examples/storage/spiffs/spiffs_example_test.py +++ /dev/null @@ -1,23 +0,0 @@ -import re - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_spiffs(env, extra_data): - - dut = env.get_dut('spiffs', 'examples/storage/spiffs') - dut.start_app() - dut.expect_all('example: Initializing SPIFFS', - re.compile(r'example: Partition size: total: \d+, used: \d+'), - 'example: Opening file', - 'example: File written', - 'example: Renaming file', - 'example: Reading file', - 'example: Read from file: \'Hello World!\'', - 'example: SPIFFS unmounted', - timeout=60) - - -if __name__ == '__main__': - test_examples_spiffs() diff --git a/examples/storage/spiffsgen/example_test.py b/examples/storage/spiffsgen/pytest_spiffsgen_example.py similarity index 65% rename from examples/storage/spiffsgen/example_test.py rename to examples/storage/spiffsgen/pytest_spiffsgen_example.py index 400706e7dc..a4c9a7976f 100644 --- a/examples/storage/spiffsgen/example_test.py +++ b/examples/storage/spiffsgen/pytest_spiffsgen_example.py @@ -1,17 +1,17 @@ -from __future__ import print_function +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 import hashlib import os -import ttfw_idf +import pytest +from pytest_embedded import Dut -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_spiffsgen(env, extra_data): +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_spiffsgen_example(dut: Dut) -> None: # Test with default build configurations - dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen') - dut.start_app() - base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image') # Expect hello.txt is read successfully @@ -22,7 +22,3 @@ def test_examples_spiffsgen(env, extra_data): with open(os.path.join(base_dir, 'sub', 'alice.txt'), 'rb') as alice_txt: alice_md5 = hashlib.md5(alice_txt.read()).hexdigest() dut.expect('Computed MD5 hash of alice.txt: ' + alice_md5) - - -if __name__ == '__main__': - test_examples_spiffsgen() diff --git a/examples/storage/wear_levelling/pytest_wear_levelling_example.py b/examples/storage/wear_levelling/pytest_wear_levelling_example.py new file mode 100644 index 0000000000..8edfd1aa00 --- /dev/null +++ b/examples/storage/wear_levelling/pytest_wear_levelling_example.py @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + + +import re + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c3 +def test_wear_levelling_example(dut: Dut) -> None: + + message_list = ('example: Mounting FAT filesystem', + 'example: Opening file', + 'example: File written', + 'example: Reading file', + re.compile(str.encode('example: Read from file: \'written using ESP-IDF \\S+\'')), + 'example: Unmounting FAT filesystem', + 'example: Done') + + for msg in message_list: + dut.expect(msg, timeout=20) diff --git a/examples/storage/wear_levelling/wear_levelling_example_test.py b/examples/storage/wear_levelling/wear_levelling_example_test.py deleted file mode 100644 index f8cae1b9a0..0000000000 --- a/examples/storage/wear_levelling/wear_levelling_example_test.py +++ /dev/null @@ -1,22 +0,0 @@ -import re - -import ttfw_idf - - -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) -def test_examples_wear_levelling(env, extra_data): - - dut = env.get_dut('wear_levelling', 'examples/storage/wear_levelling') - dut.start_app() - dut.expect_all('example: Mounting FAT filesystem', - 'example: Opening file', - 'example: File written', - 'example: Reading file', - re.compile(r'example: Read from file: \'written using ESP-IDF \S+\''), - 'example: Unmounting FAT filesystem', - 'example: Done', - timeout=20) - - -if __name__ == '__main__': - test_examples_wear_levelling() diff --git a/pytest.ini b/pytest.ini index 0602680510..e1043e19f7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -51,6 +51,9 @@ markers = wifi_high_traffic: wifi high traffic runners wifi_wlan: wifi runner with a wireless NIC xtal_26mhz: runner with 26MHz xtal on board + external_flash: external flash memory connected via VSPI (FSPI) + sdcard_sdmode: sdcard running in SD mode + sdcard_spimode: sdcard running in SPI mode # multi-dut markers multi_dut_generic: tests should be run on generic runners, at least have two duts connected.