Merge branch 'feat/parametrize-pytest-cli-args' into 'master'

ci: move test cli args alongside test scripts

Closes IDFCI-1951 and IDFCI-2940

See merge request espressif/esp-idf!46966
This commit is contained in:
Fu Hanxi
2026-03-28 08:04:25 +01:00
24 changed files with 337 additions and 134 deletions
@@ -5,7 +5,6 @@ from pytest_embedded_idf.utils import idf_parametrize
from pytest_embedded_qemu.dut import QemuDut
@pytest.mark.host_test
@pytest.mark.qemu
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
def test_pytest_host(dut: QemuDut) -> None:
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0
import hashlib
import logging
from typing import Callable
from collections.abc import Callable
import pytest
from pytest_embedded_idf.dut import IdfDut
@@ -45,7 +45,6 @@ def verify_elf_sha256_embedding(app: QemuApp, sha256_reported: str) -> None:
raise ValueError('ELF file SHA256 mismatch')
@pytest.mark.host_test
@pytest.mark.qemu
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
def test_hello_world_host(app: QemuApp, dut: QemuDut) -> None:
@@ -25,6 +25,8 @@ from pytest_embedded_idf.utils import idf_parametrize
# Testbed configuration
ETHVM_ENDNODE_USER = 'ci.ethvm'
ETHERNET_TEST_USER = os.getenv('ETHERNET_TEST_USER')
ETHERNET_TEST_PASSWORD = os.getenv('ETHERNET_TEST_PASSWORD')
BR_PORTS_NUM = 2
IPERF_BW_LIM = 6
@@ -632,5 +634,10 @@ def setup_test_environment() -> Generator[None, None, None]:
indirect=True,
)
@idf_parametrize('target', ['esp32'], indirect=['target'])
@pytest.mark.parametrize(
'dev_user, dev_password',
[(ETHERNET_TEST_USER, ETHERNET_TEST_PASSWORD)],
indirect=True,
)
def test_esp_eth_bridge(dut: Dut, dev_user: str, dev_password: str) -> None:
eth_bridge_test(dut, dev_user, dev_password)
@@ -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
@@ -20,13 +20,13 @@ def test_examples_protocol_https_x509_bundle(dut: Dut) -> None:
# check and log bin size
binary_file = os.path.join(dut.app.binary_path, 'https_x509_bundle.bin')
bin_size = os.path.getsize(binary_file)
logging.info('https_x509_bundle_bin_size : {}KB'.format(bin_size // 1024))
logging.info(f'https_x509_bundle_bin_size : {bin_size // 1024}KB')
dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)
# start test
num_URLS = int(dut.expect(r'Connecting to (\d+) URLs', timeout=30)[1].decode())
for _ in range(num_URLS):
dut.expect(r'Connection established to ([\s\S]*)', timeout=30)
dut.expect('Completed {} connections'.format(num_URLS), timeout=60)
dut.expect(f'Completed {num_URLS} connections', timeout=60)
@pytest.mark.ethernet
@@ -43,16 +43,15 @@ def test_examples_protocol_https_x509_bundle_dynamic_buffer(dut: Dut) -> None:
# check and log bin size
binary_file = os.path.join(dut.app.binary_path, 'https_x509_bundle.bin')
bin_size = os.path.getsize(binary_file)
logging.info('https_x509_bundle_bin_size : {}KB'.format(bin_size // 1024))
logging.info(f'https_x509_bundle_bin_size : {bin_size // 1024}KB')
dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)
# start test
num_URLS = int(dut.expect(r'Connecting to (\d+) URLs', timeout=30)[1].decode())
dut.expect(r'Connection established to ([\s\S]*)', timeout=30)
dut.expect('Completed {} connections'.format(num_URLS), timeout=60)
dut.expect(f'Completed {num_URLS} connections', timeout=60)
@pytest.mark.qemu
@pytest.mark.host_test
@pytest.mark.parametrize(
'config',
[
@@ -65,10 +64,10 @@ def test_examples_protocol_https_x509_bundle_default_crt_bundle_stress_test(dut:
# check and log bin size
binary_file = os.path.join(dut.app.binary_path, 'https_x509_bundle.bin')
bin_size = os.path.getsize(binary_file)
logging.info('https_x509_bundle_bin_size : {}KB'.format(bin_size // 1024))
logging.info(f'https_x509_bundle_bin_size : {bin_size // 1024}KB')
dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)
# start test
num_URLS = int(dut.expect(r'Connecting to (\d+) URLs', timeout=30)[1].decode())
for _ in range(num_URLS):
dut.expect(r'Connection established to ([\s\S]*)', timeout=30)
dut.expect('Completed {} connections'.format(num_URLS), timeout=60)
dut.expect(f'Completed {num_URLS} connections', timeout=60)
@@ -911,7 +911,6 @@ def test_examples_efuse_with_virt_sb_v2_and_fe(dut: Dut) -> None:
dut.expect('example: Done')
@pytest.mark.host_test
@pytest.mark.qemu
@pytest.mark.parametrize(
'config',
@@ -1096,7 +1096,6 @@ def test_examples_protocol_advanced_https_ota_example_openssl_aligned_bin(dut: D
@pytest.mark.qemu
@pytest.mark.nightly_run
@pytest.mark.host_test
@pytest.mark.parametrize(
'qemu_extra_args',
[
@@ -1152,7 +1151,6 @@ def test_examples_protocol_advanced_https_ota_example_verify_min_chip_revision(d
@pytest.mark.qemu
@pytest.mark.nightly_run
@pytest.mark.host_test
@pytest.mark.parametrize(
'qemu_extra_args',
[