mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
Merge branch 'ci/missing_config_pre_commit_hook' into 'master'
ci: add pre-commit hook to detect missing configs Closes IDFCI-2653 See merge request espressif/esp-idf!45826
This commit is contained in:
@@ -232,3 +232,8 @@ repos:
|
||||
hooks:
|
||||
- id: check-kconfig-files
|
||||
- id: check-deprecated-kconfig-options
|
||||
- repo: https://github.com/espressif/idf-ci
|
||||
rev: v1.0.0b4
|
||||
hooks:
|
||||
- id: check-tests-missing-config
|
||||
files: 'pytest_.*\.py$|sdkconfig(\..*)?$'
|
||||
|
||||
@@ -8,8 +8,6 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@idf_parametrize(
|
||||
'config,target,markers',
|
||||
[
|
||||
('default', 'esp32', (pytest.mark.generic,)),
|
||||
('default', 'esp32c2', (pytest.mark.generic,)),
|
||||
('iram', 'esp32c2', (pytest.mark.generic,)),
|
||||
('psram', 'esp32', (pytest.mark.psram,)),
|
||||
],
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_esp_tls(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
@@ -399,7 +399,6 @@ def test_esp_eth_dp83848(dut: IdfDut) -> None:
|
||||
'config',
|
||||
[
|
||||
'default_w5500',
|
||||
'poll_w5500',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -418,7 +417,6 @@ def test_esp_eth_w5500(dut: IdfDut) -> None:
|
||||
'config',
|
||||
[
|
||||
'default_ksz8851snl',
|
||||
'poll_ksz8851snl',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -437,7 +435,6 @@ def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
|
||||
'config',
|
||||
[
|
||||
'default_dm9051',
|
||||
'poll_dm9051',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import binascii
|
||||
import os
|
||||
@@ -109,60 +109,6 @@ def test_ecdsa_key(
|
||||
raise
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_crypto(dut: Dut) -> None:
|
||||
# if the env variable IDF_FPGA_ENV is set, we would need a longer timeout
|
||||
# as tests for efuses burning security peripherals would be run
|
||||
timeout = 600 if os.environ.get('IDF_ENV_FPGA') else 60
|
||||
# only expect key manager result if it is supported for the SoC
|
||||
if dut.app.sdkconfig.get('SOC_KEY_MANAGER_SUPPORTED'):
|
||||
print('Key Manager is supported')
|
||||
|
||||
# Test for ECDH0 deployment XTS-AES-128 key
|
||||
dut.expect('Key Manager ECDH0 deployment: XTS_AES_128 key', timeout=timeout)
|
||||
k2_G = dut.expect(r'K2_G: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
plaintext_data = dut.expect(r'Plaintext data: 0x([0-9a-fA-F]+)', timeout=timeout)[1]
|
||||
plaintext_data = binascii.unhexlify(plaintext_data)
|
||||
encrypted_data = dut.expect(r'Encrypted data: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
encrypted_data = binascii.unhexlify(encrypted_data)
|
||||
negotiated_key = calculate_key_manager_ecdh0_negotiated_key(k2_G, 'main/key_manager/k1_ecdsa.pem')
|
||||
test_xts_aes_encryption(negotiated_key, plaintext_data, encrypted_data)
|
||||
|
||||
# Test for ECDH0 deployment XTS-AES-256 key
|
||||
dut.expect('Key Manager ECDH0 deployment: XTS_AES_256 key', timeout=timeout)
|
||||
k2_G_0 = dut.expect(r'K2_G_0: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
k2_G_1 = dut.expect(r'K2_G_1: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
encrypted_data = dut.expect(r'Encrypted data: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
encrypted_data = binascii.unhexlify(encrypted_data)
|
||||
negotiated_key_0 = calculate_key_manager_ecdh0_negotiated_key(k2_G_0, 'main/key_manager/k1_ecdsa.pem')
|
||||
negotiated_key_1 = calculate_key_manager_ecdh0_negotiated_key(k2_G_1, 'main/key_manager/k1_ecdsa.pem')
|
||||
negotiated_key = negotiated_key_0 + negotiated_key_1
|
||||
test_xts_aes_encryption(negotiated_key, plaintext_data, encrypted_data)
|
||||
# Test for ECDH0 deployment ECDSA-256 key
|
||||
dut.expect('Key Manager ECDH0 deployment: ECDSA_256 key', timeout=timeout)
|
||||
k2_G = dut.expect(r'K2_G: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
digest = dut.expect(r'ECDSA message sha256 digest: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
digest = binascii.unhexlify(digest)
|
||||
signature_r_le = dut.expect(r'ECDSA signature r_le: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
signature_r_le = binascii.unhexlify(signature_r_le)
|
||||
signature_s_le = dut.expect(r'ECDSA signature s_le: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
signature_s_le = binascii.unhexlify(signature_s_le)
|
||||
pub_x = dut.expect(r'ECDSA key pubx: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
pub_x = binascii.unhexlify(pub_x)
|
||||
pub_y = dut.expect(r'ECDSA key puby: 0x([0-9a-fA-F]+)', timeout=timeout)[1].decode()
|
||||
pub_y = binascii.unhexlify(pub_y)
|
||||
negotiated_key = calculate_key_manager_ecdh0_negotiated_key(k2_G, 'main/key_manager/k1_ecdsa.pem')
|
||||
test_ecdsa_key(negotiated_key, digest, signature_r_le, signature_s_le, pub_x, pub_y)
|
||||
|
||||
test_numbers = dut.expect(r'(\d+) Tests (\d+) Failures (\d+) Ignored', timeout=timeout)
|
||||
failures = test_numbers.group(2).decode()
|
||||
ignored = test_numbers.group(3).decode()
|
||||
assert failures == '0', f'No of failures must be 0 (is {failures})'
|
||||
assert ignored == '0', f'No of Ignored test must be 0 (is {ignored})'
|
||||
dut.expect('Tests finished', timeout=timeout)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['long_aes_operations'], indirect=True)
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
# SOC_PAU_SUPPORTED == 1
|
||||
retention_targets = ['esp32c6', 'esp32h2', 'esp32p4', 'esp32c5', 'esp32c61']
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c61', 'esp32c5', 'esp32p4', 'esp32h2', 'esp32c6'], indirect=['target'])
|
||||
def test_sleep_retention(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
@@ -1,5 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
@@ -10,7 +10,6 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
'config,target',
|
||||
[
|
||||
('default', 'supported_targets'),
|
||||
('picolibc', 'supported_targets'),
|
||||
('options', 'supported_targets'),
|
||||
('single_core_esp32', 'esp32'),
|
||||
('psram_esp32', 'esp32'),
|
||||
|
||||
@@ -21,6 +21,8 @@ components/esp_wifi/test_apps/:
|
||||
components/esp_wifi/test_apps/wifi_nvs_config:
|
||||
disable:
|
||||
- if: SOC_WIFI_SUPPORTED != 1
|
||||
disable_test:
|
||||
- if: IDF_TARGET != "esp32c2"
|
||||
depends_components:
|
||||
- esp_hw_support
|
||||
- esp_rom
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.unity_tester import CaseTester
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.two_duts
|
||||
@pytest.mark.parametrize('count', [2], indirect=True)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32c61', 'esp32s2', 'esp32s3'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_wifi_nvs_connect_cases(case_tester: CaseTester) -> None: # type: ignore
|
||||
case_tester.run_all_cases()
|
||||
|
||||
|
||||
@pytest.mark.two_duts
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
@@ -19,16 +19,3 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_fatfs_flash_wl_generic(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=240)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'psram',
|
||||
],
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_fatfs_flash_wl_psram(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=180)
|
||||
|
||||
@@ -30,30 +30,3 @@ def test_fatfs_sdcard_generic_sdmmc(dut: Dut) -> None:
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_fatfs_sdcard_generic_sdspi(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(group='sdspi', timeout=180)
|
||||
|
||||
|
||||
@pytest.mark.sdcard_sdmode
|
||||
@pytest.mark.psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'psram',
|
||||
],
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_fatfs_sdcard_psram_sdmmc(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(group='sdmmc', timeout=180)
|
||||
|
||||
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32'], reason='IDFCI-2058, temporary lack runner')
|
||||
@pytest.mark.sdcard_spimode
|
||||
@pytest.mark.psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'psram',
|
||||
],
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_fatfs_sdcard_psram_sdspi(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(group='sdspi', timeout=180)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_lwip(dut: Dut) -> None:
|
||||
dut.expect_unity_test_output()
|
||||
@@ -1,6 +1,6 @@
|
||||
components/spiffs/test_apps:
|
||||
disable_test:
|
||||
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
|
||||
- if: IDF_TARGET not in ["esp32", "esp32c3"]
|
||||
reason: These chips should be sufficient for test coverage (Xtensa and RISC-V, single and dual core)
|
||||
|
||||
depends_components:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
@@ -17,16 +17,3 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_spiffs_generic(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
||||
|
||||
@pytest.mark.quad_psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'psram',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_spiffs_psram(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=120)
|
||||
|
||||
@@ -5,7 +5,7 @@ components/vfs/test_apps:
|
||||
reason: not support yet # TODO: [esp32h21] IDF-11593 [ESP32H4] IDF-12372
|
||||
|
||||
disable_test:
|
||||
- if: IDF_TARGET not in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32s3"]
|
||||
- if: IDF_TARGET not in ["esp32c2", "esp32c3", "esp32c6", "esp32h2"]
|
||||
temporary: true
|
||||
reason: lack of runners
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
@@ -17,29 +17,3 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@idf_parametrize('target', ['esp32c2', 'esp32c3', 'esp32c6', 'esp32h2'], indirect=['target'])
|
||||
def test_vfs_default(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'ccomp',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_vfs_ccomp(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.quad_psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'psram',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_vfs_psram(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import logging
|
||||
import os
|
||||
@@ -6,7 +6,6 @@ import os
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from pytest_embedded_idf.utils import soc_filtered_targets
|
||||
from pytest_embedded_qemu.dut import QemuDut
|
||||
|
||||
|
||||
@@ -68,7 +67,7 @@ def test_examples_efuse_with_virt_flash_enc(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_flash_enc_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_flash_enc_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -127,7 +126,7 @@ def test_examples_efuse_with_virt_flash_enc_aes_256(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_flash_enc_aes_256_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_flash_enc_aes_256_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -247,7 +246,7 @@ def test_examples_efuse_with_virt_flash_enc_release(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_flash_enc_release_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_flash_enc_release_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
dut.serial.erase_flash()
|
||||
|
||||
@@ -303,7 +302,7 @@ def test_examples_efuse_with_virt_secure_boot_v1(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_secure_boot_v1_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_secure_boot_v1_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -415,7 +414,7 @@ def test_examples_efuse_with_virt_secure_boot_v2(dut: Dut) -> None:
|
||||
# only for ESP32 ECO3
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_secure_boot_v2_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_secure_boot_v2_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -593,7 +592,7 @@ def example_efuse_with_virt_secure_boot_v2_esp32xx(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_secure_boot_v2_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_secure_boot_v2_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -609,13 +608,13 @@ def example_efuse_with_virt_secure_boot_v2_esp32xx(dut: Dut) -> None:
|
||||
signed_scheme = 'ECDSA'
|
||||
else:
|
||||
signed_scheme = 'RSA-PSS'
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
|
||||
dut.expect('secure_boot_v2: enabling secure boot v2...')
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Secure boot V2 is not enabled yet and eFuse digest keys are not set')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: Secure boot digests absent, generating..')
|
||||
dut.expect('secure_boot_v2: Digests successfully calculated, 1 valid signatures')
|
||||
@@ -644,7 +643,7 @@ def example_efuse_with_virt_secure_boot_v2_esp32xx(dut: Dut) -> None:
|
||||
dut.serial.hard_reset()
|
||||
dut.expect('Loading virtual efuse blocks from flash')
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: enabling secure boot v2...')
|
||||
dut.expect('secure_boot_v2: secure boot v2 is already enabled, continuing..')
|
||||
@@ -664,14 +663,6 @@ def test_examples_efuse_with_virt_secure_boot_v2_esp32xx(dut: Dut) -> None:
|
||||
example_efuse_with_virt_secure_boot_v2_esp32xx(dut)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['virt_secure_boot_v2_ecdsa_p384'], indirect=True)
|
||||
@pytest.mark.parametrize('skip_autoflash', ['y'], indirect=True)
|
||||
@idf_parametrize('target', soc_filtered_targets('SOC_ECDSA_SUPPORT_CURVE_P384 == 1'), indirect=['target'])
|
||||
def test_examples_efuse_with_virt_secure_boot_v2_ecdsa_p384_esp32xx(dut: Dut) -> None:
|
||||
example_efuse_with_virt_secure_boot_v2_esp32xx(dut)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['virt_secure_boot_v2'], indirect=True)
|
||||
@pytest.mark.parametrize('skip_autoflash', ['y'], indirect=True)
|
||||
@@ -719,7 +710,7 @@ def test_example_efuse_with_virt_secure_boot_v2_esp32xx_pre_loaded(dut: Dut) ->
|
||||
else:
|
||||
signed_scheme = 'RSA-PSS'
|
||||
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: Secure boot digests already present')
|
||||
dut.expect('secure_boot_v2: Using pre-loaded public key digest in eFuse')
|
||||
@@ -742,7 +733,7 @@ def test_example_efuse_with_virt_secure_boot_v2_esp32xx_pre_loaded(dut: Dut) ->
|
||||
dut.serial.hard_reset()
|
||||
dut.expect('Loading virtual efuse blocks from flash')
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: enabling secure boot v2...')
|
||||
dut.expect('secure_boot_v2: secure boot v2 is already enabled, continuing..')
|
||||
@@ -764,7 +755,7 @@ def test_examples_efuse_with_virt_sb_v1_and_fe(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_sb_v1_and_fe_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_sb_v1_and_fe_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -835,7 +826,7 @@ def test_examples_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_sb_v2_and_fe_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_sb_v2_and_fe_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
@@ -1003,7 +994,7 @@ def example_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('{}_bootloader_virt_sb_v2_and_fe_bin_size: {}KB'.format(dut.app.target, bin_size // 1024))
|
||||
logging.info(f'{dut.app.target}_bootloader_virt_sb_v2_and_fe_bin_size: {bin_size // 1024}KB')
|
||||
|
||||
dut.serial.erase_flash()
|
||||
|
||||
@@ -1020,13 +1011,13 @@ def example_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
|
||||
signed_scheme = 'ECDSA'
|
||||
else:
|
||||
signed_scheme = 'RSA-PSS'
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
|
||||
dut.expect('secure_boot_v2: enabling secure boot v2...')
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Secure boot V2 is not enabled yet and eFuse digest keys are not set')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: Secure boot digests absent, generating..')
|
||||
dut.expect('secure_boot_v2: Digests successfully calculated, 1 valid signatures')
|
||||
@@ -1065,20 +1056,20 @@ def example_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
|
||||
dut.expect('boot: Secure boot permanently enabled')
|
||||
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('flash_encrypt: bootloader encrypted successfully')
|
||||
dut.expect('flash_encrypt: partition table encrypted and loaded successfully')
|
||||
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('flash_encrypt: Flash encryption completed', timeout=90)
|
||||
dut.expect('Resetting with flash encryption enabled...')
|
||||
|
||||
dut.expect('Loading virtual efuse blocks from flash')
|
||||
dut.expect('Verifying image signature...')
|
||||
dut.expect('secure_boot_v2: Verifying with %s...' % signed_scheme)
|
||||
dut.expect(f'secure_boot_v2: Verifying with {signed_scheme}...')
|
||||
dut.expect('secure_boot_v2: Signature verified successfully!')
|
||||
dut.expect('secure_boot_v2: enabling secure boot v2...')
|
||||
dut.expect('secure_boot_v2: secure boot v2 is already enabled, continuing..')
|
||||
@@ -1102,11 +1093,3 @@ def example_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
|
||||
)
|
||||
def test_examples_efuse_with_virt_sb_v2_and_fe_esp32xx(dut: Dut) -> None:
|
||||
example_efuse_with_virt_sb_v2_and_fe(dut)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('skip_autoflash', ['y'], indirect=True)
|
||||
@pytest.mark.parametrize('config', ['virt_sb_v2_ecdsa_p384_and_fe'], indirect=True)
|
||||
@idf_parametrize('target', soc_filtered_targets('SOC_ECDSA_SUPPORT_CURVE_P384 == 1'), indirect=['target'])
|
||||
def test_examples_efuse_with_virt_sb_v2_ecdsa_p384_and_fe_esp32xx(dut: Dut) -> None:
|
||||
example_efuse_with_virt_sb_v2_and_fe(dut)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import http.server
|
||||
import itertools
|
||||
import multiprocessing
|
||||
import os
|
||||
import ssl
|
||||
@@ -76,16 +77,19 @@ server_key = (
|
||||
'-----END PRIVATE KEY-----\n'
|
||||
)
|
||||
|
||||
CONFIG_PARTITIONS_OTA = [
|
||||
('on_update_no_sb_ecdsa', 'esp32'),
|
||||
*itertools.product(
|
||||
['on_update_no_sb_rsa', 'virt_sb_v2_and_fe', 'virt_sb_v2_and_fe_2'],
|
||||
['esp32', 'esp32c3', 'esp32s3'],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.wifi_high_traffic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
['on_update_no_sb_ecdsa', 'on_update_no_sb_rsa', 'virt_sb_v2_and_fe', 'virt_sb_v2_and_fe_2'],
|
||||
indirect=True,
|
||||
)
|
||||
@pytest.mark.parametrize('skip_autoflash', ['y'], indirect=True)
|
||||
@pytest.mark.timeout(2400)
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
@idf_parametrize('config, target', CONFIG_PARTITIONS_OTA, indirect=['config', 'target'])
|
||||
def test_examples_partitions_ota(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('config', ['app_in_flash'], indirect=['config'])
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_ld_non_contiguous_memory(dut: Dut) -> None:
|
||||
dut.expect_exact('buf2 placed in low sram')
|
||||
|
||||
@@ -10,6 +10,6 @@ tools/test_apps/security/secure_boot:
|
||||
|
||||
tools/test_apps/security/signed_app_no_secure_boot:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32c2", "esp32c3"]
|
||||
- if: IDF_TARGET in ["esp32c3"]
|
||||
temporary: true
|
||||
reason: No need to test on all targets
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32-C2 | ESP32-C3 |
|
||||
| ----------------- | -------- | -------- |
|
||||
| Supported Targets | ESP32-C3 |
|
||||
| ----------------- | -------- |
|
||||
|
||||
# Secure Signed On Update No Secure Boot
|
||||
|
||||
|
||||
+1
-10
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
|
||||
import pytest
|
||||
@@ -6,15 +6,6 @@ from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c2', 'esp32c3'], indirect=['target'])
|
||||
def test_examples_security_on_update_no_secure_boot(dut: Dut) -> None:
|
||||
dut.expect(
|
||||
"This app is not signed, but check signature on update is enabled in config. It won't be possible to verify any update.", # noqa : E501
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.host_test
|
||||
@pytest.mark.qemu
|
||||
@pytest.mark.parametrize('config', ['secure_update_with_fe'], indirect=True)
|
||||
|
||||
@@ -59,13 +59,6 @@ CONFIG_PANIC = list(itertools.chain(itertools.product(['panic'], ['supported_tar
|
||||
CONFIG_PANIC_DUAL_CORE = list(itertools.chain(itertools.product(['panic'], TARGETS_DUAL_CORE)))
|
||||
CONFIG_PANIC_HALT = list(itertools.chain(itertools.product(['panic_halt'], TARGETS_ALL)))
|
||||
|
||||
CONFIGS_BACKTRACE = list(
|
||||
itertools.chain(
|
||||
# One single-core target and one dual-core target is enough
|
||||
itertools.product(['framepointer'], ['esp32c3', 'esp32p4'])
|
||||
)
|
||||
)
|
||||
|
||||
CONFIGS_DUAL_CORE = list(
|
||||
itertools.chain(
|
||||
itertools.product(
|
||||
@@ -284,25 +277,6 @@ def test_panic_extram_stack(dut: PanicTestDut, config: str) -> None:
|
||||
common_test(dut, config, expected_backtrace=None, expected_coredump=[coredump_pattern])
|
||||
|
||||
|
||||
@pytest.mark.psram
|
||||
@idf_parametrize('config, target', [('coredump_flash_extram_attr_esp32', 'esp32')], indirect=['config', 'target'])
|
||||
def test_panic_extram_attr(dut: PanicTestDut, config: str) -> None:
|
||||
dut.run_test_func('test_panic_extram_attr')
|
||||
regex_pattern = rb'assert failed:[\s\w()]*?\s[.\w/]*\.(?:c|cpp|h|hpp):\d.*$'
|
||||
dut.expect(re.compile(regex_pattern, re.MULTILINE))
|
||||
dut.expect_backtrace()
|
||||
dut.expect_elf_sha256()
|
||||
dut.expect_none(['Guru Meditation', 'Re-entered core dump'])
|
||||
|
||||
expect_coredump_flash_write_logs(dut, config)
|
||||
core_elf_file = dut.process_coredump_flash()
|
||||
|
||||
dut.start_gdb_for_coredump(core_elf_file)
|
||||
|
||||
assert dut.gdb_data_eval_expr('g_extram_bss_var') == '123456'
|
||||
assert dut.gdb_data_eval_expr('g_extram_noinit_var') == '789012'
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('config, target', CONFIGS, indirect=['config', 'target'])
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration')
|
||||
@@ -1464,21 +1438,6 @@ def test_tcb_corrupted(dut: PanicTestDut, target: str, config: str, test_func_na
|
||||
common_test(dut, config, expected_backtrace=None, expected_coredump=coredump_pattern)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('config, target', CONFIGS_BACKTRACE, indirect=['config', 'target'])
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration')
|
||||
def test_panic_print_backtrace(dut: PanicTestDut, config: str, test_func_name: str) -> None:
|
||||
dut.run_test_func(test_func_name)
|
||||
regex_pattern = rb'abort\(\) was called at PC [0-9xa-f]+ on core 0'
|
||||
dut.expect(regex_pattern)
|
||||
dut.expect_backtrace()
|
||||
dut.expect_elf_sha256()
|
||||
dut.expect_none(['Guru Meditation', 'Re-entered core dump'])
|
||||
|
||||
coredump_pattern = re.compile(PANIC_ABORT_PREFIX + regex_pattern.decode('utf-8'))
|
||||
common_test(dut, config, expected_backtrace=None, expected_coredump=[coredump_pattern])
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('config, target', CONFIG_PANIC_HALT, indirect=['config', 'target'])
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration')
|
||||
|
||||
Reference in New Issue
Block a user