2025-02-24 10:18:03 +08:00
|
|
|
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
2023-03-01 12:51:55 +05:30
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
import pytest
|
|
|
|
|
from pytest_embedded_idf.dut import IdfDut
|
2025-02-24 10:18:03 +08:00
|
|
|
from pytest_embedded_idf.utils import idf_parametrize
|
2023-03-01 12:51:55 +05:30
|
|
|
|
2023-04-16 11:41:11 +05:30
|
|
|
CONFIGS_NVS_ENCR_FLASH_ENC = [
|
2025-02-24 10:18:03 +08:00
|
|
|
pytest.param('nvs_encr_flash_enc_esp32', marks=[pytest.mark.esp32]),
|
2023-04-16 11:41:11 +05:30
|
|
|
pytest.param('nvs_encr_flash_enc_esp32c3', marks=[pytest.mark.esp32c3]),
|
|
|
|
|
]
|
|
|
|
|
|
2023-03-01 12:51:55 +05:30
|
|
|
|
2024-12-17 18:35:13 +01:00
|
|
|
@pytest.mark.generic
|
2023-03-01 12:51:55 +05:30
|
|
|
@pytest.mark.parametrize('config', ['default'], indirect=True)
|
2025-02-24 10:18:03 +08:00
|
|
|
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
2023-03-01 12:51:55 +05:30
|
|
|
def test_nvs_flash(dut: IdfDut) -> None:
|
2024-05-06 11:12:04 +08:00
|
|
|
dut.run_all_single_board_cases(group='!nvs_encr_hmac', timeout=120)
|
2023-03-01 12:51:55 +05:30
|
|
|
|
|
|
|
|
|
2023-04-16 11:41:11 +05:30
|
|
|
@pytest.mark.nvs_encr_hmac
|
|
|
|
|
@pytest.mark.parametrize('config', ['nvs_encr_hmac_esp32c3'], indirect=True)
|
2025-02-24 10:18:03 +08:00
|
|
|
@idf_parametrize('target', ['esp32c3'], indirect=['target'])
|
2023-04-16 11:41:11 +05:30
|
|
|
def test_nvs_flash_encr_hmac(dut: IdfDut) -> None:
|
|
|
|
|
dut.run_all_single_board_cases()
|
2023-03-01 12:51:55 +05:30
|
|
|
|
|
|
|
|
|
2023-11-21 11:11:02 +05:30
|
|
|
@pytest.mark.nvs_encr_hmac
|
|
|
|
|
@pytest.mark.parametrize('config', ['nvs_encr_hmac_no_cfg_esp32c3'], indirect=True)
|
2025-02-24 10:18:03 +08:00
|
|
|
@idf_parametrize('target', ['esp32c3'], indirect=['target'])
|
2023-11-21 11:11:02 +05:30
|
|
|
def test_nvs_flash_encr_hmac_no_cfg(dut: IdfDut) -> None:
|
|
|
|
|
dut.run_all_single_board_cases(group='nvs_encr_hmac', timeout=120)
|
|
|
|
|
|
|
|
|
|
|
2023-03-01 12:51:55 +05:30
|
|
|
@pytest.mark.flash_encryption
|
2025-02-24 10:18:03 +08:00
|
|
|
@idf_parametrize(
|
|
|
|
|
'config,target',
|
|
|
|
|
[('nvs_encr_flash_enc_esp32', 'esp32'), ('nvs_encr_flash_enc_esp32c3', 'esp32c3')],
|
|
|
|
|
indirect=['config', 'target'],
|
|
|
|
|
)
|
2023-04-16 11:41:11 +05:30
|
|
|
def test_nvs_flash_encr_flash_enc(dut: IdfDut) -> None:
|
2023-03-01 12:51:55 +05:30
|
|
|
# Erase the nvs_key partition
|
|
|
|
|
dut.serial.erase_partition('nvs_key')
|
|
|
|
|
dut.run_all_single_board_cases()
|
2023-11-02 11:08:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.psram
|
2025-02-24 10:18:03 +08:00
|
|
|
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
2023-11-02 11:08:31 +01:00
|
|
|
def test_nvs_flash_ram(dut: IdfDut) -> None:
|
|
|
|
|
dut.run_all_single_board_cases(group='nvs_ram')
|