test: format all test scripts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
import time
|
||||
@@ -6,30 +6,35 @@ from typing import Tuple
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
# Case 1: gatt write throughput test(EXAMPLE_CI_ID = 2)
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
|
||||
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'write', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'write',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c61', 'esp32c5', 'esp32h2', 'esp32s3'], indirect=['target']
|
||||
)
|
||||
def test_gatt_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
@@ -49,22 +54,31 @@ def test_gatt_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> Non
|
||||
|
||||
|
||||
# Case 2: gatt write throughput test for ESP32C2 26mhz xtal(EXAMPLE_CI_ID = 2)
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'esp32c2_xtal26m_write', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'esp32c2_xtal26m_write',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
@@ -84,27 +98,31 @@ def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut
|
||||
|
||||
|
||||
# Case 3: gatt notify throughput test(EXAMPLE_CI_ID = 1)
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'notify', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'notify',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c61', 'esp32c5', 'esp32h2', 'esp32s3'], indirect=['target']
|
||||
)
|
||||
def test_gatt_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
@@ -126,22 +144,31 @@ def test_gatt_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> No
|
||||
|
||||
|
||||
# Case 4: gatt notify throughput test for ESP32C2 26mhz xtal(EXAMPLE_CI_ID = 1)
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'esp32c2_xtal26m_notify', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'esp32c2_xtal26m_notify',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
from typing import Tuple
|
||||
@@ -7,31 +7,36 @@ import pexpect
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
# Case 1: gatt client and gatt server test
|
||||
# EXAMPLE_CI_ID=3
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
|
||||
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'name', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'name',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']
|
||||
)
|
||||
def test_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
gatt_client = dut[1]
|
||||
gatt_server = dut[0]
|
||||
gatt_client_addr = gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_server_addr = gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_client_addr = (
|
||||
gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
gatt_server_addr = (
|
||||
gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
gatt_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
@@ -56,22 +61,31 @@ def test_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
# Case 2: gatt client and gatt server test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=3
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'esp32c2_xtal26m', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'esp32c2_xtal26m',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
gatt_client = dut[1]
|
||||
gatt_server = dut[0]
|
||||
gatt_client_addr = gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
gatt_server_addr = gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
gatt_client_addr = (
|
||||
gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
)
|
||||
gatt_server_addr = (
|
||||
gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
)
|
||||
gatt_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
@@ -96,26 +110,30 @@ def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> N
|
||||
|
||||
# Case 3: gatt security server and gatt security client test
|
||||
# EXAMPLE_CI_ID=5
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}',
|
||||
'name', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}',
|
||||
'name',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']
|
||||
)
|
||||
def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: Tuple) -> None:
|
||||
gatt_security_client = dut[1]
|
||||
gatt_security_server = dut[0]
|
||||
gatt_security_client_addr = gatt_security_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_security_client_addr = (
|
||||
gatt_security_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30)
|
||||
.group(1)
|
||||
.decode('utf8')
|
||||
)
|
||||
|
||||
gatt_security_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_security_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
@@ -142,7 +160,9 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T
|
||||
if target == ('esp32', 'esp32'):
|
||||
gatt_security_server.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30)
|
||||
else:
|
||||
gatt_security_server.expect_exact(f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30)
|
||||
gatt_security_server.expect_exact(
|
||||
f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30
|
||||
)
|
||||
gatt_security_client.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30)
|
||||
gatt_security_server.expect_exact('Pairing successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Bonded devices number 1', timeout=30)
|
||||
@@ -158,21 +178,30 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T
|
||||
|
||||
# Case 4: gatt security server and gatt security client test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=5
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}',
|
||||
'esp32c2_xtal26m', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}',
|
||||
'esp32c2_xtal26m',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
gatt_security_client = dut[1]
|
||||
gatt_security_server = dut[0]
|
||||
gatt_security_client_addr = gatt_security_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_security_client_addr = (
|
||||
gatt_security_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30)
|
||||
.group(1)
|
||||
.decode('utf8')
|
||||
)
|
||||
|
||||
gatt_security_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_security_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
@@ -193,7 +222,9 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD
|
||||
gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_PENC', timeout=30)
|
||||
gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_LID', timeout=30)
|
||||
gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30)
|
||||
gatt_security_server.expect_exact(f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30)
|
||||
gatt_security_server.expect_exact(
|
||||
f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30
|
||||
)
|
||||
gatt_security_client.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30)
|
||||
gatt_security_server.expect_exact('Pairing successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Bonded devices number 1', timeout=30)
|
||||
@@ -208,27 +239,31 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD
|
||||
|
||||
|
||||
# Case 5: ble ibeacon test
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}',
|
||||
'sender|receiver', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}',
|
||||
'sender|receiver',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']
|
||||
)
|
||||
def test_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
ibeacon_sender = dut[0]
|
||||
ibeacon_receiver = dut[1]
|
||||
|
||||
ibeacon_sender_addr = ibeacon_sender.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
ibeacon_sender_addr = (
|
||||
ibeacon_sender.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30)
|
||||
.group(1)
|
||||
.decode('utf8')
|
||||
)
|
||||
|
||||
ibeacon_sender.expect_exact('Advertising start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Scanning start successfully', timeout=30)
|
||||
@@ -242,14 +277,19 @@ def test_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 5: ble ibeacon test for ESP32C2 26mhz xtal
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}',
|
||||
'esp32c2_xtal26m_sender|esp32c2_xtal26m_receiver', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}',
|
||||
'esp32c2_xtal26m_sender|esp32c2_xtal26m_receiver',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -257,7 +297,11 @@ def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) ->
|
||||
ibeacon_sender = dut[0]
|
||||
ibeacon_receiver = dut[1]
|
||||
|
||||
ibeacon_sender_addr = ibeacon_sender.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
ibeacon_sender_addr = (
|
||||
ibeacon_sender.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30)
|
||||
.group(1)
|
||||
.decode('utf8')
|
||||
)
|
||||
|
||||
ibeacon_sender.expect_exact('Advertising start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Scanning start successfully', timeout=30)
|
||||
@@ -272,27 +316,31 @@ def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) ->
|
||||
|
||||
# Case 6: gatt client and gatt server config test
|
||||
# EXAMPLE_CI_ID=4
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'cfg_test', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'cfg_test',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']
|
||||
)
|
||||
def test_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
gatt_client = dut[1]
|
||||
gatt_server = dut[0]
|
||||
gatt_client_addr = gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_server_addr = gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
gatt_client_addr = (
|
||||
gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
gatt_server_addr = (
|
||||
gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
gatt_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
@@ -317,22 +365,31 @@ def test_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
# Case 7: gatt client and gatt server config test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=3
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'esp32c2_cfg_test', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'esp32c2_cfg_test',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
gatt_client = dut[1]
|
||||
gatt_server = dut[0]
|
||||
gatt_client_addr = gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
gatt_server_addr = gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
gatt_client_addr = (
|
||||
gatt_client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
)
|
||||
gatt_server_addr = (
|
||||
gatt_server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
)
|
||||
gatt_client.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
@@ -356,16 +413,13 @@ def test_c2_26mhz_xtal_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut
|
||||
|
||||
|
||||
# Case 8: BLE init deinit loop test
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config, app_path', [('init_deinit',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_client")}')], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config, app_path', [('init_deinit', f'{os.path.join(os.path.dirname(__file__), "gatt_client")}')], indirect=True
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32c6', 'esp32h2', 'esp32c3', 'esp32s3', 'esp32c5', 'esp32c61', 'esp32'], indirect=['target']
|
||||
)
|
||||
def test_bluedroid_host_init_deinit(dut: Dut) -> None:
|
||||
all_hp = []
|
||||
dut.expect_exact('Bluetooth MAC:')
|
||||
@@ -377,17 +431,16 @@ def test_bluedroid_host_init_deinit(dut: Dut) -> None:
|
||||
|
||||
|
||||
# # Case 9: BLE init deinit loop test for ESP32C2 26mhz xtal
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'baud, app_path, config', [
|
||||
('74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'esp32c2_init_deinit'),
|
||||
'baud, app_path, config',
|
||||
[
|
||||
('74880', f'{os.path.join(os.path.dirname(__file__), "gatt_client")}', 'esp32c2_init_deinit'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
|
||||
def test_c2_26mhz_bluedroid_host_init_deinit(dut: Dut) -> None:
|
||||
all_hp = []
|
||||
dut.expect_exact('Bluetooth MAC:')
|
||||
|
||||
@@ -1,34 +1,38 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
from typing import Tuple
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
# Case 1: ble50 security client and ble50 security server test
|
||||
# EXAMPLE_CI_ID=6
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
|
||||
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'name', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'name',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'])
|
||||
def test_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
@@ -48,22 +52,31 @@ def test_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
# Case 2: ble50 security client and ble50 security server test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=6
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'esp32c2_xtal26m', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'esp32c2_xtal26m',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
@@ -83,21 +96,20 @@ def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: Tuple[IdfDut, Idf
|
||||
|
||||
# Case 3: period_adv and period_sync test
|
||||
# EXAMPLE_CI_ID=8
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}',
|
||||
'name', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}',
|
||||
'name',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'])
|
||||
def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
adv_dut = dut[0]
|
||||
sync_dut = dut[1]
|
||||
@@ -118,14 +130,19 @@ def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None
|
||||
|
||||
# Case 4: period_adv and period_sync test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=8
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}',
|
||||
'esp32c2_xtal26m', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}',
|
||||
'esp32c2_xtal26m',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -149,26 +166,29 @@ def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, Id
|
||||
|
||||
# Case 5: ble50 security client and ble50 security server config test
|
||||
# EXAMPLE_CI_ID=7
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, config, erase_nvs', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'cfg_test', 'y'),
|
||||
'count, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'cfg_test',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'])
|
||||
def test_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
@@ -190,22 +210,31 @@ def test_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -
|
||||
|
||||
# Case 6: ble50 security client and ble50 security server config test for ESP32C2 26mhz xtal
|
||||
# EXAMPLE_CI_ID=7
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'count, target, baud, app_path, config, erase_nvs', [
|
||||
(2, 'esp32c2|esp32c2', '74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'esp32c2_cfg_test', 'y'),
|
||||
'count, target, baud, app_path, config, erase_nvs',
|
||||
[
|
||||
(
|
||||
2,
|
||||
'esp32c2|esp32c2',
|
||||
'74880',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}',
|
||||
'esp32c2_cfg_test',
|
||||
'y',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_c2_26mhz_xtal_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
client_addr = client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
server_addr = server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
client_addr = (
|
||||
client.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
server_addr = (
|
||||
server.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})', timeout=30).group(1).decode('utf8')
|
||||
)
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_bt_discovery(dut: Dut) -> None:
|
||||
dut.expect_exact('Discovery started.')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
from typing import Tuple
|
||||
@@ -6,16 +6,20 @@ from typing import Tuple
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
# Case 1: SPP
|
||||
@pytest.mark.esp32
|
||||
|
||||
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, erase_all, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_initiator")}',
|
||||
'esp32|esp32', 'y', 'test'),
|
||||
'count, app_path, target, erase_all, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_initiator")}',
|
||||
'esp32|esp32',
|
||||
'y',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -39,13 +43,16 @@ def test_bt_spp_only(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 2: SPP_VFS
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_initiator")}',
|
||||
'esp32|esp32', 'test'),
|
||||
'count, app_path, target, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_initiator")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -64,13 +71,16 @@ def test_bt_spp_vfs(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 3: A2DP
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "a2dp_sink")}|{os.path.join(os.path.dirname(__file__), "a2dp_source")}',
|
||||
'esp32|esp32', 'test'),
|
||||
'count, app_path, target, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "a2dp_sink")}|{os.path.join(os.path.dirname(__file__), "a2dp_source")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -87,13 +97,16 @@ def test_bt_a2dp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 4: HFP
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "hfp_ag")}|{os.path.join(os.path.dirname(__file__), "hfp_hf")}',
|
||||
'esp32|esp32', 'all'),
|
||||
'count, app_path, target, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "hfp_ag")}|{os.path.join(os.path.dirname(__file__), "hfp_hf")}',
|
||||
'esp32|esp32',
|
||||
'all',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -109,14 +122,17 @@ def test_bt_hfp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# # Case 5: HID
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_hid_mouse_device")}|'
|
||||
f'{os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")), "esp_hid_host")}',
|
||||
'esp32|esp32', 'test'),
|
||||
'count, app_path, target, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_hid_mouse_device")}|'
|
||||
f'{os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")), "esp_hid_host")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@@ -135,13 +151,16 @@ def test_bt_hid(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 6: L2CAP
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path, target, config', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_server")}|{os.path.join(os.path.dirname(__file__), "bt_l2cap_client")}',
|
||||
'esp32|esp32', 'test'),
|
||||
'count, app_path, target, config',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_server")}|{os.path.join(os.path.dirname(__file__), "bt_l2cap_client")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
from typing import Tuple
|
||||
@@ -6,24 +6,24 @@ from typing import Tuple
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
# Case 1: BLE power save test
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32
|
||||
|
||||
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}'),
|
||||
'count, app_path',
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target', ['esp32c6', 'esp32h2', 'esp32c3', 'esp32s3', 'esp32c5', 'esp32c61', 'esp32'], indirect=['target']
|
||||
)
|
||||
def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
peripheral = dut[0]
|
||||
central = dut[1]
|
||||
@@ -39,17 +39,21 @@ def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 2: BLE power save test for ESP32C2
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_two_dut
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'config, count, app_path, baud', [
|
||||
('esp32c2_xtal26m', 2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}',
|
||||
'74880'),
|
||||
'config, count, app_path, baud',
|
||||
[
|
||||
(
|
||||
'esp32c2_xtal26m',
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}',
|
||||
'74880',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
|
||||
def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
peripheral = dut[0]
|
||||
central = dut[1]
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from pytest_embedded_qemu.dut import QemuDut
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.host_test
|
||||
@pytest.mark.qemu
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_pytest_host(dut: QemuDut) -> None:
|
||||
dut.expect_exact('Initializing the filesystem')
|
||||
dut.expect_exact('Read XML data:')
|
||||
@@ -16,5 +15,5 @@ def test_pytest_host(dut: QemuDut) -> None:
|
||||
dut.expect_exact('To: Tove')
|
||||
dut.expect_exact('From: Jani')
|
||||
dut.expect_exact('Heading: Reminder')
|
||||
dut.expect_exact('Body: Don\'t forget me this weekend!')
|
||||
dut.expect_exact("Body: Don't forget me this weekend!")
|
||||
dut.expect_exact('Example end', timeout=20)
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_plugins(dut: Dut) -> None:
|
||||
log_text = textwrap.dedent(r"""
|
||||
Nihao plugin performing self-registration...
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_custom_bootloader_extra_component(dut: Dut) -> None:
|
||||
dut.expect_exact('This function is called from an extra component')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_custom_bootloader_hooks_example(dut: Dut) -> None:
|
||||
# Expect to read both hooks messages
|
||||
dut.expect_exact('This hook is called BEFORE bootloader initialization')
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.app import IdfApp
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_custom_bootloader_multiboot_example(app: IdfApp, dut: Dut) -> None:
|
||||
# Expect to see all three partitions in the list
|
||||
dut.expect_exact('default')
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.app import IdfApp
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_custom_bootloader_impl_example(app: IdfApp, dut: Dut) -> None:
|
||||
# Expect to read a message from the custom bootloader
|
||||
# This message is defined in the Kconfig file, retrieve it while deleting
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_examples_cpp_exceptions(dut: IdfDut) -> None:
|
||||
lines = [
|
||||
'app_main starting',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_examples_cpp_pthread(dut: IdfDut) -> None:
|
||||
dut.expect(
|
||||
[
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_cpp_rtti_example(dut: IdfDut) -> None:
|
||||
dut.expect_exact('Type name of std::cout is: std::ostream')
|
||||
dut.expect_exact('Type name of std::cin is: std::istream')
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.parametrize('config', [
|
||||
pytest.param('default_ip101', marks=[pytest.mark.ethernet_router]),
|
||||
pytest.param('default_generic', marks=[pytest.mark.ethernet_router]),
|
||||
pytest.param('default_dm9051', marks=[pytest.mark.eth_dm9051]),
|
||||
], indirect=True)
|
||||
def test_esp_eth_basic(
|
||||
dut: Dut
|
||||
) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
pytest.param('default_ip101', marks=[pytest.mark.ethernet_router]),
|
||||
pytest.param('default_generic', marks=[pytest.mark.ethernet_router]),
|
||||
pytest.param('default_dm9051', marks=[pytest.mark.eth_dm9051]),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_basic(dut: Dut) -> None:
|
||||
# wait for ip received
|
||||
dut_ip = dut.expect(r'esp_netif_handlers: .+ ip: (\d+\.\d+\.\d+\.\d+),').group(1)
|
||||
# ping it once
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
"""
|
||||
Test case for iperf example.
|
||||
|
||||
@@ -26,11 +28,16 @@ NO_BANDWIDTH_LIMIT = -1 # iperf send bandwidth is not limited
|
||||
|
||||
|
||||
class IperfTestUtilityEth(IperfUtility.IperfTestUtility):
|
||||
""" iperf test implementation """
|
||||
def __init__(self, dut: str, config_name: str, pc_nic_ip: str, pc_iperf_log_file: str, test_result:Any=None) -> None:
|
||||
IperfUtility.IperfTestUtility.__init__(self, dut, config_name, 'None', 'None', pc_nic_ip, pc_iperf_log_file, test_result)
|
||||
"""iperf test implementation"""
|
||||
|
||||
def setup(self) -> Tuple[str,int]:
|
||||
def __init__(
|
||||
self, dut: str, config_name: str, pc_nic_ip: str, pc_iperf_log_file: str, test_result: Any = None
|
||||
) -> None:
|
||||
IperfUtility.IperfTestUtility.__init__(
|
||||
self, dut, config_name, 'None', 'None', pc_nic_ip, pc_iperf_log_file, test_result
|
||||
)
|
||||
|
||||
def setup(self) -> Tuple[str, int]:
|
||||
"""
|
||||
setup iperf test:
|
||||
|
||||
@@ -55,7 +62,7 @@ def test_esp_eth_iperf(
|
||||
check_performance: Callable[[str, float, str], None],
|
||||
udp_tx_bw_lim: Optional[int] = NO_BANDWIDTH_LIMIT,
|
||||
udp_rx_bw_lim: Optional[int] = NO_BANDWIDTH_LIMIT,
|
||||
spi_eth: Optional[bool] = False
|
||||
spi_eth: Optional[bool] = False,
|
||||
) -> None:
|
||||
"""
|
||||
steps: |
|
||||
@@ -86,26 +93,36 @@ def test_esp_eth_iperf(
|
||||
|
||||
# 4. log performance and compare with pass standard
|
||||
for throughput_type in test_result:
|
||||
log_performance('{}_throughput'.format(throughput_type),
|
||||
'{:.02f} Mbps'.format(test_result[throughput_type].get_best_throughput()))
|
||||
log_performance(
|
||||
'{}_throughput'.format(throughput_type),
|
||||
'{:.02f} Mbps'.format(test_result[throughput_type].get_best_throughput()),
|
||||
)
|
||||
|
||||
# do check after logging, otherwise test will exit immediately if check fail, some performance can't be logged.
|
||||
for throughput_type in test_result:
|
||||
if spi_eth:
|
||||
check_performance('{}_eth_throughput_spi_eth'.format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput(),
|
||||
dut.target)
|
||||
check_performance(
|
||||
'{}_eth_throughput_spi_eth'.format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput(),
|
||||
dut.target,
|
||||
)
|
||||
else:
|
||||
check_performance('{}_eth_throughput'.format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput(),
|
||||
dut.target)
|
||||
check_performance(
|
||||
'{}_eth_throughput'.format(throughput_type),
|
||||
test_result[throughput_type].get_best_throughput(),
|
||||
dut.target,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet_router
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ip101',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_ip101',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_ip101(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -114,11 +131,15 @@ def test_esp_eth_iperf_ip101(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90)
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.eth_ip101
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ip101_esp32p4',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_ip101_esp32p4',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_esp_eth_iperf_ip101_esp32p4(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -127,11 +148,15 @@ def test_esp_eth_iperf_ip101_esp32p4(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=96)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_lan8720
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_lan8720',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_lan8720',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_lan8720(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -140,11 +165,15 @@ def test_esp_eth_iperf_lan8720(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_rtl8201
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_rtl8201',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_rtl8201',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_rtl8201(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -153,11 +182,15 @@ def test_esp_eth_iperf_rtl8201(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_dp83848
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_dp83848',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_dp83848',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_dp83848(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -166,11 +199,15 @@ def test_esp_eth_iperf_dp83848(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_ksz8041
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ksz8041',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_ksz8041',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_ksz8041(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -179,11 +216,15 @@ def test_esp_eth_iperf_ksz8041(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_dm9051
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_dm9051',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_dm9051',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_dm9051(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -192,11 +233,15 @@ def test_esp_eth_iperf_dm9051(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, spi_eth=True, udp_rx_bw_lim=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_w5500
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_w5500',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_w5500',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_w5500(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
@@ -205,11 +250,15 @@ def test_esp_eth_iperf_w5500(
|
||||
test_esp_eth_iperf(dut, log_performance, check_performance, spi_eth=True, udp_rx_bw_lim=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_ksz8851snl
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ksz8851snl',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default_ksz8851snl',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_iperf_ksz8851snl(
|
||||
dut: Dut,
|
||||
log_performance: Callable[[str, object], None],
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_blink(dut: IdfDut) -> None:
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'blink.bin')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import hashlib
|
||||
import logging
|
||||
@@ -6,29 +6,27 @@ from typing import Callable
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from pytest_embedded_qemu.app import QemuApp
|
||||
from pytest_embedded_qemu.dut import QemuDut
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.preview_targets
|
||||
@pytest.mark.generic
|
||||
def test_hello_world(
|
||||
dut: IdfDut, log_minimum_free_heap_size: Callable[..., None]
|
||||
) -> None:
|
||||
@idf_parametrize('target', ['supported_targets', 'preview_targets'], indirect=['target'])
|
||||
def test_hello_world(dut: IdfDut, log_minimum_free_heap_size: Callable[..., None]) -> None:
|
||||
dut.expect('Hello world!')
|
||||
log_minimum_free_heap_size()
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
@idf_parametrize('target', ['linux'], indirect=['target'])
|
||||
def test_hello_world_linux(dut: IdfDut) -> None:
|
||||
dut.expect('Hello world!')
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
@pytest.mark.macos_shell
|
||||
@idf_parametrize('target', ['linux'], indirect=['target'])
|
||||
def test_hello_world_macos(dut: IdfDut) -> None:
|
||||
dut.expect('Hello world!')
|
||||
|
||||
@@ -47,14 +45,11 @@ def verify_elf_sha256_embedding(app: QemuApp, sha256_reported: str) -> None:
|
||||
raise ValueError('ELF file SHA256 mismatch')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.host_test
|
||||
@pytest.mark.qemu
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3'], indirect=['target'])
|
||||
def test_hello_world_host(app: QemuApp, dut: QemuDut) -> None:
|
||||
sha256_reported = (
|
||||
dut.expect(r'ELF file SHA256:\s+([a-f0-9]+)').group(1).decode('utf-8')
|
||||
)
|
||||
sha256_reported = dut.expect(r'ELF file SHA256:\s+([a-f0-9]+)').group(1).decode('utf-8')
|
||||
verify_elf_sha256_embedding(app, sha256_reported)
|
||||
|
||||
dut.expect('Hello world!')
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import random
|
||||
import re
|
||||
from time import sleep
|
||||
from typing import List, Tuple
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def generate_shortaddr() -> str:
|
||||
@@ -33,7 +34,7 @@ def generate_extaddr() -> str:
|
||||
return extaddr
|
||||
|
||||
|
||||
def dlt_pendingtable(ser:IdfDut, addr:str) -> None:
|
||||
def dlt_pendingtable(ser: IdfDut, addr: str) -> None:
|
||||
if addr != '':
|
||||
addr_list = re.findall(r'0x([A-Za-z0-9]{2})', addr)
|
||||
addr_field = '0x' + ''.join(reversed(addr_list))
|
||||
@@ -52,7 +53,7 @@ def dlt_pendingtable(ser:IdfDut, addr:str) -> None:
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
def add_pendingtable(ser:IdfDut, addr:str='') -> None:
|
||||
def add_pendingtable(ser: IdfDut, addr: str = '') -> None:
|
||||
if len(addr.split(' ')) == 2 or len(addr.split(' ')) == 8:
|
||||
cmd = 'pending %s\n' % (addr)
|
||||
addr_list = re.findall(r'0x([A-Za-z0-9]{2})', addr)
|
||||
@@ -66,7 +67,7 @@ def add_pendingtable(ser:IdfDut, addr:str='') -> None:
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
def generate_wrong_PANID_addr(right:str) -> str:
|
||||
def generate_wrong_PANID_addr(right: str) -> str:
|
||||
wrong = ''
|
||||
for i in right.split(' '):
|
||||
num = (int(i, 16) + random.randint(1, 255)) % 256
|
||||
@@ -75,7 +76,9 @@ def generate_wrong_PANID_addr(right:str) -> str:
|
||||
return wrong
|
||||
|
||||
|
||||
def set_mismatch_short_extern_addr_pendingtable(ser:IdfDut, addr:str, short:int=12, extern:int=12) -> List[List]:
|
||||
def set_mismatch_short_extern_addr_pendingtable(
|
||||
ser: IdfDut, addr: str, short: int = 12, extern: int = 12
|
||||
) -> List[List]:
|
||||
short_addr = []
|
||||
extern_addr = []
|
||||
cnt = 0
|
||||
@@ -100,7 +103,7 @@ def set_mismatch_short_extern_addr_pendingtable(ser:IdfDut, addr:str, short:int=
|
||||
return [short_addr, extern_addr]
|
||||
|
||||
|
||||
def dlt_short_extern_addr_in_pendingtable(ser:IdfDut, table:List, short:int=5, extern:int=5) -> None:
|
||||
def dlt_short_extern_addr_in_pendingtable(ser: IdfDut, table: List, short: int = 5, extern: int = 5) -> None:
|
||||
cnt = 0
|
||||
while cnt < short:
|
||||
dlt_pendingtable(ser, table[0][cnt])
|
||||
@@ -110,13 +113,15 @@ def dlt_short_extern_addr_in_pendingtable(ser:IdfDut, table:List, short:int=5, e
|
||||
cnt = cnt + 1
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'count, config', [
|
||||
'count, config',
|
||||
[
|
||||
(2, 'release'),
|
||||
], indirect=True
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_txrx(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit = dut[0]
|
||||
receive = dut[1]
|
||||
@@ -147,12 +152,15 @@ def test_based_txrx(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
assert 'Rx Done' not in str(tmp)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_energy(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -161,12 +169,15 @@ def test_based_energy(dut: IdfDut) -> None:
|
||||
transmit.expect('ed_scan_rss_value:', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_channel(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -176,12 +187,15 @@ def test_based_channel(dut: IdfDut) -> None:
|
||||
transmit.expect('current channel: 23', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_txpower(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -191,12 +205,15 @@ def test_based_txpower(dut: IdfDut) -> None:
|
||||
transmit.expect('current txpower: 13', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_promiscuous(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -210,12 +227,15 @@ def test_based_promiscuous(dut: IdfDut) -> None:
|
||||
transmit.expect('hardware promiscuous mode was disabled', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_panid(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -225,12 +245,15 @@ def test_based_panid(dut: IdfDut) -> None:
|
||||
transmit.expect('current panid: 0x60', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_shortaddr(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -240,12 +263,15 @@ def test_based_shortaddr(dut: IdfDut) -> None:
|
||||
transmit.expect('current shortaddr: 0x1234', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_extaddr(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -255,12 +281,15 @@ def test_based_extaddr(dut: IdfDut) -> None:
|
||||
transmit.expect('get extaddr: 0807060504030201', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_coordinator(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -274,12 +303,15 @@ def test_based_coordinator(dut: IdfDut) -> None:
|
||||
transmit.expect('hardware coordinator was disabled', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_pending(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -295,12 +327,15 @@ def test_based_pending(dut: IdfDut) -> None:
|
||||
transmit.expect('clear the pending address table', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_cca(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -312,13 +347,15 @@ def test_based_cca(dut: IdfDut) -> None:
|
||||
transmit.expect('threshold:-60 dB, mode: 0', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'count, config', [
|
||||
'count, config',
|
||||
[
|
||||
(2, 'release'),
|
||||
], indirect=True
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_autoack(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit = dut[0]
|
||||
receive = dut[1]
|
||||
@@ -359,18 +396,20 @@ def test_based_autoack(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit.expect('02 00 00', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'count, config', [
|
||||
'count, config',
|
||||
[
|
||||
(2, 'release'),
|
||||
], indirect=True
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit = dut[0]
|
||||
receive = dut[1]
|
||||
|
||||
# mode 0: CMD ID = 0x04 --> FP = 1
|
||||
# mode 0: CMD ID = 0x04 --> FP = 1
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
transmit.write('rx -r 0')
|
||||
transmit.expect('radio exit receive mode')
|
||||
@@ -397,11 +436,13 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
receive.write('rx -r 1')
|
||||
receive.expect('RX Start', timeout=10)
|
||||
transmit.write('tx 0x23 0x08 0x00 0x74 0x2E 0x49 0x26 0x04 0x53 0x04 0xe3 0x71 0xc2 0x36 0xf7 0xa5 0x2b 0x68 0x79 0x8c 0x72 0x50 0x8b 0x61 0x55 0x56')
|
||||
transmit.write(
|
||||
'tx 0x23 0x08 0x00 0x74 0x2E 0x49 0x26 0x04 0x53 0x04 0xe3 0x71 0xc2 0x36 0xf7 0xa5 0x2b 0x68 0x79 0x8c 0x72 0x50 0x8b 0x61 0x55 0x56'
|
||||
)
|
||||
transmit.expect('Rx ack 5 bytes', timeout=10)
|
||||
transmit.expect('12 00 00', timeout=10)
|
||||
|
||||
# mode 0: CMD ID != 0x04 --> FP = 0
|
||||
# mode 0: CMD ID != 0x04 --> FP = 0
|
||||
receive.write('pending -r')
|
||||
receive.expect('clear the pending address table', timeout=10)
|
||||
receive.write('promisc -d')
|
||||
@@ -426,7 +467,7 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit.expect('Rx ack 5 bytes', timeout=10)
|
||||
transmit.expect('02 00 0c', timeout=10)
|
||||
|
||||
# mode 1: CMD ID = 0x04, src addr in pending table --> FP = 1
|
||||
# mode 1: CMD ID = 0x04, src addr in pending table --> FP = 1
|
||||
receive.write('pending -r')
|
||||
receive.expect('clear the pending address table', timeout=10)
|
||||
receive.write('promisc -d')
|
||||
@@ -459,7 +500,7 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit.expect('Rx ack 5 bytes', timeout=10)
|
||||
transmit.expect('12 00 00', timeout=10)
|
||||
|
||||
# mode 1: CMD ID = 0x04, src addr not in pending table --> FP = 0
|
||||
# mode 1: CMD ID = 0x04, src addr not in pending table --> FP = 0
|
||||
receive.write('pending -r')
|
||||
receive.expect('clear the pending address table', timeout=10)
|
||||
receive.write('promisc -d')
|
||||
@@ -487,11 +528,13 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
receive.write('rx -r 1')
|
||||
receive.expect('RX Start', timeout=10)
|
||||
transmit.write('tx 0x2b 0x88 0x08 0xE3 0x9F 0x20 0x9E 0x18 0xE7 0x66 0xC4 0x17 0x92 0x8a 0xcd 0x4c 0xd0 0x20 0x40 0x0d 0x46 0x04 0xa0 0xe3 0x9c 0x57')
|
||||
transmit.write(
|
||||
'tx 0x2b 0x88 0x08 0xE3 0x9F 0x20 0x9E 0x18 0xE7 0x66 0xC4 0x17 0x92 0x8a 0xcd 0x4c 0xd0 0x20 0x40 0x0d 0x46 0x04 0xa0 0xe3 0x9c 0x57'
|
||||
)
|
||||
transmit.expect('Rx ack 5 bytes', timeout=10)
|
||||
transmit.expect('02 00 08', timeout=10)
|
||||
|
||||
# mode 2: frame type is data, src addr in pending table --> FP = 1
|
||||
# mode 2: frame type is data, src addr in pending table --> FP = 1
|
||||
receive.write('pending -r')
|
||||
receive.expect('clear the pending address table', timeout=10)
|
||||
receive.write('promisc -d')
|
||||
@@ -524,7 +567,7 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit.expect('Rx ack 5 bytes', timeout=10)
|
||||
transmit.expect('12 00 10', timeout=10)
|
||||
|
||||
# mode 2: frame type is data, src addr not in pending table --> FP = 0
|
||||
# mode 2: frame type is data, src addr not in pending table --> FP = 0
|
||||
receive.write('pending -r')
|
||||
receive.expect('clear the pending address table', timeout=10)
|
||||
receive.write('promisc -d')
|
||||
@@ -557,12 +600,15 @@ def test_based_autopending(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
transmit.expect('02 00 10', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_transmit_failed(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
@@ -579,12 +625,15 @@ def test_based_transmit_failed(dut: IdfDut) -> None:
|
||||
transmit.expect('08 09 00 00 00 00 00 00', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.ieee802154
|
||||
@pytest.mark.parametrize(
|
||||
'config', ['release',],
|
||||
indirect=True
|
||||
'config',
|
||||
[
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_based_initialize(dut: IdfDut) -> None:
|
||||
transmit = dut
|
||||
transmit.expect('ieee802154>', timeout=10)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import ipaddress
|
||||
import logging
|
||||
@@ -17,8 +17,9 @@ import pytest
|
||||
from common_test_methods import get_host_ip_by_interface
|
||||
from netmiko import ConnectHandler
|
||||
from pytest_embedded import Dut
|
||||
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
# Testbed configuration
|
||||
|
||||
BR_PORTS_NUM = 2
|
||||
IPERF_BW_LIM = 6
|
||||
MIN_UDP_THROUGHPUT = 5
|
||||
@@ -30,9 +31,7 @@ class EndnodeSsh:
|
||||
self.host_ip = host_ip
|
||||
self.ssh_client = paramiko.SSHClient()
|
||||
self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
self.ssh_client.connect(hostname=self.host_ip,
|
||||
username=usr,
|
||||
password=passwd)
|
||||
self.ssh_client.connect(hostname=self.host_ip, username=usr, password=passwd)
|
||||
self.executor: ThreadPoolExecutor
|
||||
self.async_result: Future
|
||||
|
||||
@@ -69,9 +68,7 @@ class SwitchSsh:
|
||||
if self.type == self.EDGE_SWITCH_5XP:
|
||||
self.ssh_client = paramiko.SSHClient()
|
||||
self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
self.ssh_client.connect(hostname=self.host_ip,
|
||||
username=usr,
|
||||
password=passwd)
|
||||
self.ssh_client.connect(hostname=self.host_ip, username=usr, password=passwd)
|
||||
else:
|
||||
edgeSwitch = {
|
||||
'device_type': 'ubiquiti_edgeswitch',
|
||||
@@ -119,7 +116,10 @@ class SwitchSsh:
|
||||
|
||||
def get_endnode_mac_by_interface(endnode: EndnodeSsh, if_name: str) -> str:
|
||||
ip_info = endnode.exec_cmd(f'ip addr show {if_name}')
|
||||
regex = if_name + r':.*?link/ether ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'
|
||||
regex = (
|
||||
if_name
|
||||
+ r':.*?link/ether ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'
|
||||
)
|
||||
mac_addr = re.search(regex, ip_info, re.DOTALL)
|
||||
if mac_addr is None:
|
||||
return ''
|
||||
@@ -160,7 +160,15 @@ def get_host_brcast_ip_by_interface(interface_name: str, ip_type: int = netiface
|
||||
return ''
|
||||
|
||||
|
||||
def run_iperf(proto: str, endnode: EndnodeSsh, server_ip: str, bandwidth_lim:int=10, interval:int=5, server_if:str='', client_if:str='') -> float:
|
||||
def run_iperf(
|
||||
proto: str,
|
||||
endnode: EndnodeSsh,
|
||||
server_ip: str,
|
||||
bandwidth_lim: int = 10,
|
||||
interval: int = 5,
|
||||
server_if: str = '',
|
||||
client_if: str = '',
|
||||
) -> float:
|
||||
if proto == 'tcp':
|
||||
proto = ''
|
||||
else:
|
||||
@@ -168,19 +176,29 @@ def run_iperf(proto: str, endnode: EndnodeSsh, server_ip: str, bandwidth_lim:int
|
||||
|
||||
if ipaddress.ip_address(server_ip).is_multicast:
|
||||
# Configure Multicast Server
|
||||
server_proc = subprocess.Popen(['iperf', '-u', '-s', '-i', '1', '-t', '%i' % interval, '-B', '%s%%%s'
|
||||
% (server_ip, server_if)], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
server_proc = subprocess.Popen(
|
||||
['iperf', '-u', '-s', '-i', '1', '-t', '%i' % interval, '-B', '%s%%%s' % (server_ip, server_if)],
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
# Configure Multicast Client
|
||||
endnode_ip = get_endnode_ip_by_interface(endnode, client_if)
|
||||
if endnode_ip == '':
|
||||
raise RuntimeError('End node IP address not found')
|
||||
client_res = endnode.exec_cmd('iperf -u -c %s -t %i -i 1 -b %iM --ttl 5 -B %s' % (server_ip, interval, bandwidth_lim, endnode_ip))
|
||||
client_res = endnode.exec_cmd(
|
||||
'iperf -u -c %s -t %i -i 1 -b %iM --ttl 5 -B %s' % (server_ip, interval, bandwidth_lim, endnode_ip)
|
||||
)
|
||||
if server_proc.wait(10) is None: # Process did not finish.
|
||||
server_proc.terminate()
|
||||
else:
|
||||
# Configure Server
|
||||
server_proc = subprocess.Popen(['iperf', '%s' % proto, '-s', '-i', '1', '-t', '%i' % interval], text=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
server_proc = subprocess.Popen(
|
||||
['iperf', '%s' % proto, '-s', '-i', '1', '-t', '%i' % interval],
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
# Configure Client
|
||||
client_res = endnode.exec_cmd('iperf %s -c %s -t %i -i 1 -b %iM' % (proto, server_ip, interval, bandwidth_lim))
|
||||
if server_proc.wait(10) is None: # Process did not finish.
|
||||
@@ -239,16 +257,16 @@ def send_brcast_msg_endnode_to_host(endnode: EndnodeSsh, host_brcast_ip: str, te
|
||||
return nc_host_out
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_w5500
|
||||
@pytest.mark.parametrize('config', [
|
||||
'w5500',
|
||||
], indirect=True)
|
||||
def test_esp_eth_bridge(
|
||||
dut: Dut,
|
||||
dev_user: str,
|
||||
dev_password: str
|
||||
) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'w5500',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_esp_eth_bridge(dut: Dut, dev_user: str, dev_password: str) -> None:
|
||||
# ------------------------------ #
|
||||
# Pre-test testbed configuration #
|
||||
# ------------------------------ #
|
||||
@@ -263,18 +281,15 @@ def test_esp_eth_bridge(
|
||||
port_num = int(sw_info.group(2))
|
||||
port_num_endnode = int(port_num) + 1 # endnode address is always + 1 to the host
|
||||
|
||||
endnode = EndnodeSsh(f'10.10.{sw_num}.{port_num_endnode}',
|
||||
dev_user,
|
||||
dev_password)
|
||||
switch1 = SwitchSsh(f'10.10.{sw_num}.100',
|
||||
dev_user,
|
||||
dev_password,
|
||||
SwitchSsh.EDGE_SWITCH_10XP)
|
||||
endnode = EndnodeSsh(f'10.10.{sw_num}.{port_num_endnode}', dev_user, dev_password)
|
||||
switch1 = SwitchSsh(f'10.10.{sw_num}.100', dev_user, dev_password, SwitchSsh.EDGE_SWITCH_10XP)
|
||||
|
||||
# Collect all addresses in our network
|
||||
# ------------------------------------
|
||||
# Bridge (DUT) MAC
|
||||
br_mac = dut.expect(r'esp_netif_br_glue: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})')
|
||||
br_mac = dut.expect(
|
||||
r'esp_netif_br_glue: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'
|
||||
)
|
||||
br_mac = br_mac.group(1).decode('utf-8')
|
||||
logging.info('ESP Bridge MAC %s', br_mac)
|
||||
# Get unique identification of each Ethernet port
|
||||
@@ -350,7 +365,9 @@ def test_esp_eth_bridge(
|
||||
|
||||
logging.info('link up the port #2')
|
||||
switch1.switch_port_up(port_num_endnode)
|
||||
dut.expect_exact(f'Ethernet ({p2_id}) Link Up') # Note: No "Ethernet Got IP Address" since DHCP Server is connected to port #1
|
||||
dut.expect_exact(
|
||||
f'Ethernet ({p2_id}) Link Up'
|
||||
) # Note: No "Ethernet Got IP Address" since DHCP Server is connected to port #1
|
||||
|
||||
logging.info('link down both ports')
|
||||
switch1.switch_port_down(port_num_endnode)
|
||||
@@ -369,30 +386,43 @@ def test_esp_eth_bridge(
|
||||
# unicast UDP
|
||||
bandwidth_udp = run_iperf('udp', endnode, host_ip, IPERF_BW_LIM, 5)
|
||||
if bandwidth_udp < MIN_UDP_THROUGHPUT:
|
||||
logging.warning('Unicast UDP bandwidth was less than expected. Trying again over longer period to compensate transient drops.')
|
||||
logging.warning(
|
||||
'Unicast UDP bandwidth was less than expected. Trying again over longer period to compensate transient drops.'
|
||||
)
|
||||
bandwidth_udp = run_iperf('udp', endnode, host_ip, IPERF_BW_LIM, 60)
|
||||
logging.info('Unicast UDP average bandwidth: %s Mbits/s', bandwidth_udp)
|
||||
|
||||
# unicast TCP
|
||||
bandwidth_tcp = run_iperf('tcp', endnode, host_ip, IPERF_BW_LIM, 5)
|
||||
if bandwidth_tcp < MIN_TCP_THROUGHPUT:
|
||||
logging.warning('Unicast TCP bandwidth was less than expected. Trying again over longer period to compensate transient drops.')
|
||||
logging.warning(
|
||||
'Unicast TCP bandwidth was less than expected. Trying again over longer period to compensate transient drops.'
|
||||
)
|
||||
bandwidth_tcp = run_iperf('tcp', endnode, host_ip, IPERF_BW_LIM, 60)
|
||||
logging.info('Unicast TCP average bandwidth: %s Mbits/s', bandwidth_tcp)
|
||||
|
||||
# multicast UDP
|
||||
bandwidth_mcast_udp = run_iperf('udp', endnode, '224.0.1.4', IPERF_BW_LIM, 5, host_if, endnode_if)
|
||||
if bandwidth_mcast_udp < MIN_UDP_THROUGHPUT:
|
||||
logging.warning('Multicast UDP bandwidth was less than expected. Trying again over longer period to compensate transient drops.')
|
||||
logging.warning(
|
||||
'Multicast UDP bandwidth was less than expected. Trying again over longer period to compensate transient drops.'
|
||||
)
|
||||
bandwidth_mcast_udp = run_iperf('udp', endnode, '224.0.1.4', IPERF_BW_LIM, 60, host_if, endnode_if)
|
||||
logging.info('Multicast UDP average bandwidth: %s Mbits/s', bandwidth_mcast_udp)
|
||||
|
||||
if bandwidth_udp < MIN_UDP_THROUGHPUT:
|
||||
raise RuntimeError('Unicast UDP throughput expected %.2f, actual %.2f' % (MIN_UDP_THROUGHPUT, bandwidth_udp) + ' Mbits/s')
|
||||
raise RuntimeError(
|
||||
'Unicast UDP throughput expected %.2f, actual %.2f' % (MIN_UDP_THROUGHPUT, bandwidth_udp) + ' Mbits/s'
|
||||
)
|
||||
if bandwidth_tcp < MIN_TCP_THROUGHPUT:
|
||||
raise RuntimeError('Unicast TCP throughput expected %.2f, actual %.2f' % (MIN_TCP_THROUGHPUT, bandwidth_tcp) + ' Mbits/s')
|
||||
raise RuntimeError(
|
||||
'Unicast TCP throughput expected %.2f, actual %.2f' % (MIN_TCP_THROUGHPUT, bandwidth_tcp) + ' Mbits/s'
|
||||
)
|
||||
if bandwidth_mcast_udp < MIN_UDP_THROUGHPUT:
|
||||
raise RuntimeError('Multicast UDP throughput expected %.2f, actual %.2f' % (MIN_UDP_THROUGHPUT, bandwidth_mcast_udp) + ' Mbits/s')
|
||||
raise RuntimeError(
|
||||
'Multicast UDP throughput expected %.2f, actual %.2f' % (MIN_UDP_THROUGHPUT, bandwidth_mcast_udp)
|
||||
+ ' Mbits/s'
|
||||
)
|
||||
|
||||
# ------------------------------------------------
|
||||
# TEST Objective 4: adding/deleting entries in FDB
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import pytest
|
||||
from common_test_methods import get_env_config_variable
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def _sniffer_packets_check(dut: Dut, channel: int, packet_num: int) -> None:
|
||||
@@ -36,18 +37,19 @@ def _sniffer_packets_check(dut: Dut, channel: int, packet_num: int) -> None:
|
||||
dut.expect('cmd_pcap: .pcap file close done')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_ap
|
||||
@pytest.mark.parametrize('config', [
|
||||
'mem',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'mem',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32c2', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32c61', 'esp32s2', 'esp32s3'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_examples_simple_sniffer(dut: Dut) -> None:
|
||||
dut.expect('sniffer>')
|
||||
channel = get_env_config_variable('wifi_ap', 'sniffer_channel', default=1)
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import ipaddress
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
from typing import Dict, Union
|
||||
from typing import Dict
|
||||
from typing import Union
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from scapy import layers
|
||||
from scapy.all import ICMP, IP, TCP, UDP, AsyncSniffer
|
||||
from scapy.all import AsyncSniffer
|
||||
from scapy.all import ICMP
|
||||
from scapy.all import IP
|
||||
from scapy.all import TCP
|
||||
from scapy.all import UDP
|
||||
|
||||
udp_port = 1234
|
||||
tcp_port = 4321
|
||||
|
||||
|
||||
def run_cmd(command: str, secure: bool=False) -> str:
|
||||
def run_cmd(command: str, secure: bool = False) -> str:
|
||||
if secure is False:
|
||||
print(f'Running: {command}')
|
||||
|
||||
@@ -73,12 +78,16 @@ def setup_network(config: dict) -> None:
|
||||
|
||||
def create_config(dut: Dut) -> dict:
|
||||
pc_iface = dut.app.sdkconfig.get('EXAMPLE_VLAN_PYTEST_PC_IFACE')
|
||||
vlanClient_conf = {'id': str(dut.app.sdkconfig.get('EXAMPLE_ETHERNET_VLAN_ID')),
|
||||
'name': 'vlanClient',
|
||||
'ip': dut.app.sdkconfig.get('EXAMPLE_VLAN_STATIC_ADDR_DEF_GW')}
|
||||
vlanServer_conf = {'id': str(dut.app.sdkconfig.get('EXAMPLE_EXTRA_ETHERNET_VLAN_ID')),
|
||||
'name': 'vlanServer',
|
||||
'ip': dut.app.sdkconfig.get('EXAMPLE_EXTRA_VLAN_STATIC_ADDR_DEF_GW')}
|
||||
vlanClient_conf = {
|
||||
'id': str(dut.app.sdkconfig.get('EXAMPLE_ETHERNET_VLAN_ID')),
|
||||
'name': 'vlanClient',
|
||||
'ip': dut.app.sdkconfig.get('EXAMPLE_VLAN_STATIC_ADDR_DEF_GW'),
|
||||
}
|
||||
vlanServer_conf = {
|
||||
'id': str(dut.app.sdkconfig.get('EXAMPLE_EXTRA_ETHERNET_VLAN_ID')),
|
||||
'name': 'vlanServer',
|
||||
'ip': dut.app.sdkconfig.get('EXAMPLE_EXTRA_VLAN_STATIC_ADDR_DEF_GW'),
|
||||
}
|
||||
esp_vlanClient_ip = dut.app.sdkconfig.get('EXAMPLE_VLAN_STATIC_IPV4_ADDR')
|
||||
esp_vlanServer_ip = dut.app.sdkconfig.get('EXAMPLE_EXTRA_VLAN_STATIC_IPV4_ADDR')
|
||||
|
||||
@@ -89,31 +98,33 @@ def create_config(dut: Dut) -> dict:
|
||||
config: Dict[str, Union[str, dict, dict, str, str, list, list, list, list]] = {
|
||||
# Basic Configurations
|
||||
'pc_iface': pc_iface,
|
||||
|
||||
'vlanClient': vlanClient_conf,
|
||||
'vlanServer': vlanServer_conf,
|
||||
|
||||
'esp_vlanClient_ip': esp_vlanClient_ip,
|
||||
'esp_vlanServer_ip': esp_vlanServer_ip,
|
||||
|
||||
'vlan_create_cmd_l': [f'ip netns add ns_vlanClient',
|
||||
f"ip link add link {pc_iface} name {vlanClient_conf['name']} type vlan id {vlanClient_conf['id']}",
|
||||
f"ip link set {vlanClient_conf['name']} netns ns_vlanClient",
|
||||
f"ip netns exec ns_vlanClient ip addr add {vlanClient_conf['ip']}/255.255.255.0 dev {vlanClient_conf['name']}",
|
||||
f"ip netns exec ns_vlanClient ip link set dev {vlanClient_conf['name']} up",
|
||||
f"ip link add link {pc_iface} name {vlanServer_conf['name']} type vlan id {vlanServer_conf['id']}",
|
||||
f"ip addr add {vlanServer_conf['ip']}/255.255.255.0 dev {vlanServer_conf['name']}",
|
||||
f"ip link set dev {vlanServer_conf['name']} up"],
|
||||
|
||||
'vlan_destroy_cmd_l': [f"ip netns exec ns_vlanClient ip link set dev {vlanClient_conf['name']} down",
|
||||
f"ip netns exec ns_vlanClient ip link delete {vlanClient_conf['name']}",
|
||||
f"ip link set dev {vlanServer_conf['name']} down",
|
||||
f"ip link delete {vlanServer_conf['name']}",
|
||||
f'ip netns delete ns_vlanClient'],
|
||||
|
||||
'set_route_cmd_l': [f'ip netns exec ns_vlanClient ip route add {vlanServer_net_addr}/24 via {esp_vlanClient_ip}'],
|
||||
|
||||
'delete_route_cmd_l': [f'ip netns exec ns_vlanClient ip route delete {vlanServer_net_addr}/24 via {esp_vlanClient_ip}'],
|
||||
'vlan_create_cmd_l': [
|
||||
f'ip netns add ns_vlanClient',
|
||||
f'ip link add link {pc_iface} name {vlanClient_conf["name"]} type vlan id {vlanClient_conf["id"]}',
|
||||
f'ip link set {vlanClient_conf["name"]} netns ns_vlanClient',
|
||||
f'ip netns exec ns_vlanClient ip addr add {vlanClient_conf["ip"]}/255.255.255.0 dev {vlanClient_conf["name"]}',
|
||||
f'ip netns exec ns_vlanClient ip link set dev {vlanClient_conf["name"]} up',
|
||||
f'ip link add link {pc_iface} name {vlanServer_conf["name"]} type vlan id {vlanServer_conf["id"]}',
|
||||
f'ip addr add {vlanServer_conf["ip"]}/255.255.255.0 dev {vlanServer_conf["name"]}',
|
||||
f'ip link set dev {vlanServer_conf["name"]} up',
|
||||
],
|
||||
'vlan_destroy_cmd_l': [
|
||||
f'ip netns exec ns_vlanClient ip link set dev {vlanClient_conf["name"]} down',
|
||||
f'ip netns exec ns_vlanClient ip link delete {vlanClient_conf["name"]}',
|
||||
f'ip link set dev {vlanServer_conf["name"]} down',
|
||||
f'ip link delete {vlanServer_conf["name"]}',
|
||||
f'ip netns delete ns_vlanClient',
|
||||
],
|
||||
'set_route_cmd_l': [
|
||||
f'ip netns exec ns_vlanClient ip route add {vlanServer_net_addr}/24 via {esp_vlanClient_ip}'
|
||||
],
|
||||
'delete_route_cmd_l': [
|
||||
f'ip netns exec ns_vlanClient ip route delete {vlanServer_net_addr}/24 via {esp_vlanClient_ip}'
|
||||
],
|
||||
}
|
||||
|
||||
return config
|
||||
@@ -121,7 +132,6 @@ def create_config(dut: Dut) -> dict:
|
||||
|
||||
# Ping Test
|
||||
def ping_test(config: dict) -> None:
|
||||
|
||||
setup_network(config)
|
||||
|
||||
capture = AsyncSniffer(iface=config['vlanServer']['name'], filter='icmp', count=10)
|
||||
@@ -131,7 +141,11 @@ def ping_test(config: dict) -> None:
|
||||
|
||||
time.sleep(1)
|
||||
# Run network test commands here
|
||||
print(run_cmd_sec(f"ip netns exec ns_vlanClient ping -I {config['vlanClient']['ip']} {config['vlanServer']['ip']} -c 10"))
|
||||
print(
|
||||
run_cmd_sec(
|
||||
f'ip netns exec ns_vlanClient ping -I {config["vlanClient"]["ip"]} {config["vlanServer"]["ip"]} -c 10'
|
||||
)
|
||||
)
|
||||
|
||||
# Stop sniffing
|
||||
capture.join(timeout=20)
|
||||
@@ -147,12 +161,20 @@ def ping_test(config: dict) -> None:
|
||||
print('Failure: No packets captured')
|
||||
assert False
|
||||
|
||||
print(f"Captured: {len(vlanServer_pkt_list)} packets on interface {config['vlanServer']['name']}")
|
||||
print(f'Captured: {len(vlanServer_pkt_list)} packets on interface {config["vlanServer"]["name"]}')
|
||||
for pkt in vlanServer_pkt_list:
|
||||
print('Summary: ', pkt.summary())
|
||||
if pkt[ICMP].type == 8 and pkt[IP].src == config['esp_vlanServer_ip'] and pkt[IP].dst == config['vlanServer']['ip']:
|
||||
if (
|
||||
pkt[ICMP].type == 8
|
||||
and pkt[IP].src == config['esp_vlanServer_ip']
|
||||
and pkt[IP].dst == config['vlanServer']['ip']
|
||||
):
|
||||
vlanServer_forward_flag = True
|
||||
if pkt[ICMP].type == 0 and pkt[IP].src == config['vlanServer']['ip'] and pkt[IP].dst == config['esp_vlanServer_ip']:
|
||||
if (
|
||||
pkt[ICMP].type == 0
|
||||
and pkt[IP].src == config['vlanServer']['ip']
|
||||
and pkt[IP].dst == config['esp_vlanServer_ip']
|
||||
):
|
||||
vlanServer_return_flag = True
|
||||
|
||||
assert vlanServer_forward_flag and vlanServer_return_flag
|
||||
@@ -170,7 +192,13 @@ def udp_client(serverip: str, port: int) -> None:
|
||||
|
||||
|
||||
def udp_server_client_comm(config: dict, port: int) -> None:
|
||||
server_thread = threading.Thread(target=udp_server, args=(config['vlanServer']['ip'], port,))
|
||||
server_thread = threading.Thread(
|
||||
target=udp_server,
|
||||
args=(
|
||||
config['vlanServer']['ip'],
|
||||
port,
|
||||
),
|
||||
)
|
||||
client_thread = threading.Thread(target=udp_client, args=(config['vlanServer']['ip'], port))
|
||||
|
||||
server_thread.start()
|
||||
@@ -186,13 +214,9 @@ def udp_lfilter(packet: layers.l2.Ether) -> layers.l2.Ether:
|
||||
|
||||
|
||||
def udp_test(config: dict) -> None:
|
||||
|
||||
setup_network(config)
|
||||
|
||||
capture = AsyncSniffer(iface=config['vlanServer']['name'],
|
||||
filter='udp',
|
||||
lfilter=udp_lfilter,
|
||||
count=10)
|
||||
capture = AsyncSniffer(iface=config['vlanServer']['name'], filter='udp', lfilter=udp_lfilter, count=10)
|
||||
|
||||
# Start sniffing
|
||||
capture.start()
|
||||
@@ -216,13 +240,21 @@ def udp_test(config: dict) -> None:
|
||||
print('Failure: No packets captured')
|
||||
assert False
|
||||
|
||||
print(f"Captured: {len(vlanServer_pkt_list)} packets on interface {config['vlanServer']['name']}")
|
||||
print(f'Captured: {len(vlanServer_pkt_list)} packets on interface {config["vlanServer"]["name"]}')
|
||||
for pkt in vlanServer_pkt_list:
|
||||
print('Summary: ', pkt.summary())
|
||||
if UDP in pkt:
|
||||
if pkt[UDP].dport == udp_port and pkt[IP].src == config['esp_vlanServer_ip'] and pkt[IP].dst == config['vlanServer']['ip']:
|
||||
if (
|
||||
pkt[UDP].dport == udp_port
|
||||
and pkt[IP].src == config['esp_vlanServer_ip']
|
||||
and pkt[IP].dst == config['vlanServer']['ip']
|
||||
):
|
||||
vlanServer_forward_flag = True
|
||||
if pkt[UDP].sport == udp_port and pkt[IP].src == config['vlanServer']['ip'] and pkt[IP].dst == config['esp_vlanServer_ip']:
|
||||
if (
|
||||
pkt[UDP].sport == udp_port
|
||||
and pkt[IP].src == config['vlanServer']['ip']
|
||||
and pkt[IP].dst == config['esp_vlanServer_ip']
|
||||
):
|
||||
vlanServer_return_flag = True
|
||||
|
||||
assert vlanServer_forward_flag and vlanServer_return_flag
|
||||
@@ -240,7 +272,13 @@ def tcp_client(serverip: str, port: int) -> None:
|
||||
|
||||
|
||||
def tcp_server_client_comm(config: dict, port: int) -> None:
|
||||
server_thread = threading.Thread(target=tcp_server, args=(config['vlanServer']['ip'], port,))
|
||||
server_thread = threading.Thread(
|
||||
target=tcp_server,
|
||||
args=(
|
||||
config['vlanServer']['ip'],
|
||||
port,
|
||||
),
|
||||
)
|
||||
client_thread = threading.Thread(target=tcp_client, args=(config['vlanServer']['ip'], port))
|
||||
|
||||
server_thread.start()
|
||||
@@ -256,13 +294,9 @@ def tcp_lfilter(packet: layers.l2.Ether) -> layers.l2.Ether:
|
||||
|
||||
|
||||
def tcp_test(config: dict) -> None:
|
||||
|
||||
setup_network(config)
|
||||
|
||||
capture = AsyncSniffer(iface=config['vlanServer']['name'],
|
||||
filter='tcp',
|
||||
lfilter=tcp_lfilter,
|
||||
count=10)
|
||||
capture = AsyncSniffer(iface=config['vlanServer']['name'], filter='tcp', lfilter=tcp_lfilter, count=10)
|
||||
|
||||
# Start sniffing
|
||||
capture.start()
|
||||
@@ -286,36 +320,44 @@ def tcp_test(config: dict) -> None:
|
||||
print('Failure: No packets captured')
|
||||
assert False
|
||||
|
||||
print(f"Captured: {len(vlanServer_pkt_list)} packets on interface {config['vlanServer']['name']}")
|
||||
print(f'Captured: {len(vlanServer_pkt_list)} packets on interface {config["vlanServer"]["name"]}')
|
||||
for pkt in vlanServer_pkt_list:
|
||||
print('Summary: ', pkt.summary())
|
||||
if TCP in pkt:
|
||||
if pkt[TCP].dport == tcp_port and pkt[IP].src == config['esp_vlanServer_ip'] and pkt[IP].dst == config['vlanServer']['ip']:
|
||||
if (
|
||||
pkt[TCP].dport == tcp_port
|
||||
and pkt[IP].src == config['esp_vlanServer_ip']
|
||||
and pkt[IP].dst == config['vlanServer']['ip']
|
||||
):
|
||||
vlanServer_forward_flag = True
|
||||
if pkt[TCP].sport == tcp_port and pkt[IP].src == config['vlanServer']['ip'] and pkt[IP].dst == config['esp_vlanServer_ip']:
|
||||
if (
|
||||
pkt[TCP].sport == tcp_port
|
||||
and pkt[IP].src == config['vlanServer']['ip']
|
||||
and pkt[IP].dst == config['esp_vlanServer_ip']
|
||||
):
|
||||
vlanServer_return_flag = True
|
||||
|
||||
assert vlanServer_forward_flag and vlanServer_return_flag
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet_vlan
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_vlan_napt_pingtest(dut: Dut) -> None:
|
||||
dut.expect('main_task: Returned from app_main()')
|
||||
test_conf = create_config(dut)
|
||||
ping_test(test_conf)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet_vlan
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_vlan_napt_udptest(dut: Dut) -> None:
|
||||
dut.expect('main_task: Returned from app_main()')
|
||||
test_conf = create_config(dut)
|
||||
udp_test(test_conf)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet_vlan
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_vlan_napt_tcptest(dut: Dut) -> None:
|
||||
dut.expect('main_task: Returned from app_main()')
|
||||
test_conf = create_config(dut)
|
||||
|
||||
@@ -91,15 +91,10 @@ ESPPORT1 = os.getenv('ESPPORT1')
|
||||
ESPPORT2 = os.getenv('ESPPORT2')
|
||||
ESPPORT3 = os.getenv('ESPPORT3')
|
||||
|
||||
PORT_MAPPING = {
|
||||
'ESPPORT1': 'esp32h2',
|
||||
'ESPPORT2': 'esp32s3',
|
||||
'ESPPORT3': 'esp32c6'
|
||||
}
|
||||
PORT_MAPPING = {'ESPPORT1': 'esp32h2', 'ESPPORT2': 'esp32s3', 'ESPPORT3': 'esp32c6'}
|
||||
|
||||
|
||||
# Case 1: Thread network formation and attaching
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -113,7 +108,7 @@ PORT_MAPPING = {
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
pytest.param(
|
||||
'rcp_spi|cli|br_spi',
|
||||
@@ -123,12 +118,12 @@ PORT_MAPPING = {
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32h2|esp32c6|esp32s3',
|
||||
f'{ESPPORT1}|{ESPPORT3}|{ESPPORT2}',
|
||||
id='h2-c6-s3'
|
||||
id='h2-c6-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_thread_connect(dut:Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_thread_connect(dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli_h2 = dut[1]
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
@@ -168,7 +163,7 @@ def test_thread_connect(dut:Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
# / \
|
||||
# / \
|
||||
# Wi-FI_Host Thread_End_Device
|
||||
def formBasicWiFiThreadNetwork(br:IdfDut, cli:IdfDut) -> None:
|
||||
def formBasicWiFiThreadNetwork(br: IdfDut, cli: IdfDut) -> None:
|
||||
ocf.init_thread(br)
|
||||
ocf.init_thread(cli)
|
||||
otbr_wifi_para = copy.copy(default_br_wifi_para)
|
||||
@@ -179,11 +174,10 @@ def formBasicWiFiThreadNetwork(br:IdfDut, cli:IdfDut) -> None:
|
||||
otcli_thread_para.dataset = ocf.getDataset(br)
|
||||
otcli_thread_para.exaddr = '7766554433221101'
|
||||
ocf.joinThreadNetwork(cli, otcli_thread_para)
|
||||
ocf.wait(cli,10)
|
||||
ocf.wait(cli, 10)
|
||||
|
||||
|
||||
# Case 2: Bidirectional IPv6 connectivity
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -197,14 +191,14 @@ def formBasicWiFiThreadNetwork(br:IdfDut, cli:IdfDut) -> None:
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_Bidirectional_IPv6_connectivity(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_Bidirectional_IPv6_connectivity(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -236,7 +230,6 @@ def test_Bidirectional_IPv6_connectivity(Init_interface:bool, dut: Tuple[IdfDut,
|
||||
|
||||
|
||||
# Case 3: Multicast forwarding from Wi-Fi to Thread network
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -250,14 +243,14 @@ def test_Bidirectional_IPv6_connectivity(Init_interface:bool, dut: Tuple[IdfDut,
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_multicast_forwarding_A(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_multicast_forwarding_A(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -290,7 +283,6 @@ def test_multicast_forwarding_A(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
|
||||
|
||||
|
||||
# Case 4: Multicast forwarding from Thread to Wi-Fi network
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -304,14 +296,14 @@ def test_multicast_forwarding_A(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_multicast_forwarding_B(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_multicast_forwarding_B(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -324,7 +316,7 @@ def test_multicast_forwarding_B(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
|
||||
cli.expect('Done', timeout=5)
|
||||
ocf.wait(cli, 3)
|
||||
myudp = ocf.udp_parameter('INET6', '::', 5090, 'ff04::125', False, 15.0, b'')
|
||||
udp_mission = threading.Thread(target=ocf.create_host_udp_server, args=(myudp, ))
|
||||
udp_mission = threading.Thread(target=ocf.create_host_udp_server, args=(myudp,))
|
||||
udp_mission.start()
|
||||
start_time = time.time()
|
||||
while not myudp.init_flag:
|
||||
@@ -345,7 +337,6 @@ def test_multicast_forwarding_B(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
|
||||
|
||||
|
||||
# Case 5: discover dervice published by Thread device
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -359,14 +350,16 @@ def test_multicast_forwarding_B(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_service_discovery_of_Thread_device(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_service_discovery_of_Thread_device(
|
||||
Init_interface: bool, Init_avahi: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]
|
||||
) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
assert Init_avahi
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
@@ -405,7 +398,6 @@ def test_service_discovery_of_Thread_device(Init_interface:bool, Init_avahi:bool
|
||||
|
||||
|
||||
# Case 6: discover dervice published by Wi-Fi device
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -419,14 +411,16 @@ def test_service_discovery_of_Thread_device(Init_interface:bool, Init_avahi:bool
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_service_discovery_of_WiFi_device(
|
||||
Init_interface: bool, Init_avahi: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]
|
||||
) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
assert Init_avahi
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
@@ -474,7 +468,6 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
||||
|
||||
|
||||
# Case 7: ICMP communication via NAT64
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -488,14 +481,14 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_ICMP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_ICMP_NAT64(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -513,7 +506,6 @@ def test_ICMP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) ->
|
||||
|
||||
|
||||
# Case 8: UDP communication via NAT64
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -527,14 +519,14 @@ def test_ICMP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) ->
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_UDP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_UDP_NAT64(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -549,7 +541,7 @@ def test_UDP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
host_ipv4_address = ocf.get_host_ipv4_address()
|
||||
print('host_ipv4_address: ', host_ipv4_address)
|
||||
myudp = ocf.udp_parameter('INET4', host_ipv4_address, 5090, '', False, 15.0, b'')
|
||||
udp_mission = threading.Thread(target=ocf.create_host_udp_server, args=(myudp, ))
|
||||
udp_mission = threading.Thread(target=ocf.create_host_udp_server, args=(myudp,))
|
||||
udp_mission.start()
|
||||
start_time = time.time()
|
||||
while not myudp.init_flag:
|
||||
@@ -570,7 +562,6 @@ def test_UDP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
|
||||
|
||||
# Case 9: TCP communication via NAT64
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -584,14 +575,14 @@ def test_UDP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_TCP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_TCP_NAT64(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -607,7 +598,7 @@ def test_TCP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
connect_address = ocf.get_ipv6_from_ipv4(host_ipv4_address, br)
|
||||
print('connect_address is: ', connect_address)
|
||||
mytcp = ocf.tcp_parameter('INET4', host_ipv4_address, 12345, False, False, 15.0, b'')
|
||||
tcp_mission = threading.Thread(target=ocf.create_host_tcp_server, args=(mytcp, ))
|
||||
tcp_mission = threading.Thread(target=ocf.create_host_tcp_server, args=(mytcp,))
|
||||
tcp_mission.start()
|
||||
start_time = time.time()
|
||||
while not mytcp.listen_flag:
|
||||
@@ -633,8 +624,6 @@ def test_TCP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
|
||||
|
||||
# Case 10: Sleepy device test
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.openthread_sleep
|
||||
@pytest.mark.parametrize(
|
||||
'config, count, app_path, target, port',
|
||||
@@ -646,7 +635,7 @@ def test_TCP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_sleepy_device/light_sleep")}',
|
||||
'esp32h2|esp32c6',
|
||||
f'{ESPPORT1}|{ESPPORT3}',
|
||||
id='h2-c6'
|
||||
id='h2-c6',
|
||||
),
|
||||
pytest.param(
|
||||
'cli|sleepy',
|
||||
@@ -655,7 +644,7 @@ def test_TCP_NAT64(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_sleepy_device/light_sleep")}',
|
||||
'esp32c6|esp32h2',
|
||||
f'{ESPPORT3}|{ESPPORT1}',
|
||||
id='c6-h2'
|
||||
id='c6-h2',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
@@ -693,7 +682,6 @@ def test_ot_sleepy_device(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 11: Basic startup Test of BR
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -702,11 +690,10 @@ def test_ot_sleepy_device(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
pytest.param(
|
||||
'rcp_uart|br',
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}'
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT2}',
|
||||
id='c6-s3'
|
||||
id='c6-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
@@ -735,7 +722,6 @@ def test_basic_startup(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 12: Curl a website via DNS and NAT64
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_bbr
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -749,14 +735,14 @@ def test_basic_startup(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_NAT64_DNS(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -777,7 +763,6 @@ def test_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
|
||||
|
||||
# Case 13: Meshcop discovery of Border Router
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -786,16 +771,15 @@ def test_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> N
|
||||
pytest.param(
|
||||
'rcp_uart|br',
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}'
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT2}',
|
||||
id='c6-s3'
|
||||
id='c6-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_br_meshcop(Init_interface: bool, Init_avahi: bool, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
br = dut[1]
|
||||
assert Init_interface
|
||||
assert Init_avahi
|
||||
@@ -839,7 +823,6 @@ def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, Idf
|
||||
|
||||
|
||||
# Case 14: Curl a website over HTTPS via DNS and NAT64
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_bbr
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -853,14 +836,14 @@ def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, Idf
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32h2|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}',
|
||||
id='c6-h2-s3'
|
||||
id='c6-h2-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_https_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
def test_https_NAT64_DNS(Init_interface: bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
|
||||
br = dut[2]
|
||||
cli = dut[1]
|
||||
cli = dut[1]
|
||||
assert Init_interface
|
||||
dut[0].serial.stop_redirect_thread()
|
||||
|
||||
@@ -879,7 +862,6 @@ def test_https_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]
|
||||
|
||||
|
||||
# Case 15: Thread network formation and attaching with TREL
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -892,7 +874,7 @@ def test_https_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_trel")}',
|
||||
'esp32c6|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT2}',
|
||||
id='c6-s3'
|
||||
id='c6-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
@@ -934,7 +916,6 @@ def test_trel_connect(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
|
||||
|
||||
# Case 16: Thread network BR lib check
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.openthread_br
|
||||
@pytest.mark.flaky(reruns=1, reruns_delay=1)
|
||||
@pytest.mark.parametrize(
|
||||
@@ -943,11 +924,10 @@ def test_trel_connect(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
pytest.param(
|
||||
'rcp_uart|br_libcheck',
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}'
|
||||
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}|{os.path.join(os.path.dirname(__file__), "ot_br")}',
|
||||
'esp32c6|esp32s3',
|
||||
f'{ESPPORT3}|{ESPPORT2}',
|
||||
id='c6-s3'
|
||||
id='c6-s3',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded.dut import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5'], indirect=['target']
|
||||
)
|
||||
def test_adc_continuous(dut: Dut) -> None:
|
||||
res = dut.expect(r'TASK: ret is 0, ret_num is (\d+) bytes')
|
||||
num = res.group(1).decode('utf8')
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded.dut import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c5'], indirect=['target']
|
||||
)
|
||||
def test_adc_oneshot(dut: Dut) -> None:
|
||||
dut.expect(r'EXAMPLE: ADC1 Channel\[(\d+)\] Raw Data: (\d+)', timeout=5)
|
||||
|
||||
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.adc
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
@@ -26,5 +22,6 @@ def test_adc_oneshot(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
|
||||
def test_adc_oneshot_esp32c2_xtal_26mhz(dut: Dut) -> None:
|
||||
dut.expect(r'EXAMPLE: ADC1 Channel\[(\d+)\] Raw Data: (\d+)', timeout=5)
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -17,9 +14,12 @@ from pytest_embedded import Dut
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32h2', 'esp32p4', 'esp32c5', 'esp32c61'], indirect=['target'])
|
||||
def test_ana_cmpr_example(dut: Dut) -> None:
|
||||
sdkconfig = dut.app.sdkconfig
|
||||
dut.expect(r'ana_cmpr_example: Analog Comparator source gpio ([0-9]+), external reference gpio ([0-9]+)', timeout=10)
|
||||
dut.expect(
|
||||
r'ana_cmpr_example: Analog Comparator source gpio ([0-9]+), external reference gpio ([0-9]+)', timeout=10
|
||||
)
|
||||
if sdkconfig['EXAMPLE_INTERNAL_REF']:
|
||||
dut.expect('ana_cmpr_example: Allocate Analog Comparator with internal reference', timeout=10)
|
||||
dut.expect(r'ana_cmpr_example: Analog comparator enabled, reference voltage: [0-9]+% \* VDD', timeout=10)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32p4', 'esp32c5'], indirect=['target'])
|
||||
def test_bitscrambler_loopback_example(dut: Dut) -> None:
|
||||
dut.expect_exact('BitScrambler example main', timeout=5)
|
||||
dut.expect_exact('BitScrambler program complete. Input 40, output 40 bytes')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_dvp_isp_dsi(dut: Dut) -> None:
|
||||
dut.expect_exact('Calling app_main()')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_mipi_isp_dsi(dut: Dut) -> None:
|
||||
dut.expect_exact('Calling app_main()')
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
def dac_example_expect(dut: Dut, mode: str) -> None:
|
||||
@@ -13,8 +13,6 @@ def dac_example_expect(dut: Dut, mode: str) -> None:
|
||||
dut.expect('Play count: 2', timeout=10)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -24,6 +22,7 @@ def dac_example_expect(dut: Dut, mode: str) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32', 'esp32s2'], indirect=['target'])
|
||||
def test_dac_audio_example(dut: Dut) -> None:
|
||||
sdkconfig = dut.app.sdkconfig
|
||||
if sdkconfig['EXAMPLE_DAC_WRITE_SYNC']:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
def test_dac_continuous_output(dut: Dut, mode: str, chan0_io: str, chan1_io: str) -> None:
|
||||
@@ -21,8 +21,6 @@ def test_dac_continuous_output(dut: Dut, mode: str, chan0_io: str, chan1_io: str
|
||||
dut.expect(r'dac continuous\({}\): sine wave start'.format(mode), timeout=20)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -32,6 +30,7 @@ def test_dac_continuous_output(dut: Dut, mode: str, chan0_io: str, chan1_io: str
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32', 'esp32s2'], indirect=['target'])
|
||||
def test_dac_continuous_example_with_dma(dut: Dut) -> None:
|
||||
sdkconfig = dut.app.sdkconfig
|
||||
if dut.target == 'esp32':
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_dac_cosine_wave_example_with_12bit_adc(dut: Dut) -> None:
|
||||
res = []
|
||||
for _ in range(30):
|
||||
@@ -19,8 +19,8 @@ def test_dac_cosine_wave_example_with_12bit_adc(dut: Dut) -> None:
|
||||
assert max(chan0_val) - min(chan0_val) > 1000
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.adc
|
||||
@idf_parametrize('target', ['esp32s2'], indirect=['target'])
|
||||
def test_dac_cosine_wave_example_with_13bit_adc(dut: Dut) -> None:
|
||||
res = []
|
||||
for _ in range(30):
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s2'], indirect=['target'])
|
||||
def test_dac_oneshot_example(dut: Dut) -> None:
|
||||
res = []
|
||||
for _ in range(10):
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
from typing import Callable
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
def test_generic_gpio_example(
|
||||
dut: Dut, log_minimum_free_heap_size: Callable[..., None]
|
||||
) -> None:
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_generic_gpio_example(dut: Dut, log_minimum_free_heap_size: Callable[..., None]) -> None:
|
||||
log_minimum_free_heap_size()
|
||||
dut.expect(r'cnt: \d+')
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
EXPECT_TIMEOUT = 20
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ccs811
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_i2ctools_example(dut: IdfDut) -> None:
|
||||
dut.expect_exact('i2c-tools>', timeout=EXPECT_TIMEOUT)
|
||||
# Get i2c address
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_i2s_usb_example(dut: Dut) -> None:
|
||||
dut.expect(r'initial MCLK: [0-9]+ Hz')
|
||||
|
||||
@@ -2,50 +2,47 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
['pdm_tx'],
|
||||
indirect=True
|
||||
@pytest.mark.parametrize('config', ['pdm_tx'], indirect=True)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32c61'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_i2s_pdm_tx_example(dut: Dut) -> None:
|
||||
dut.expect(r'I2S PDM TX example start', timeout=5)
|
||||
dut.expect(r'---------------------------', timeout=5)
|
||||
dut.expect(r'i2s_common: tx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(r'i2s_pdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(
|
||||
r'i2s_pdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_pdm: The tx channel on I2S0 has been initialized to PDM TX mode successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: i2s tx channel enabled', timeout=5)
|
||||
dut.expect(r'Playing bass `twinkle twinkle little star`', timeout=5)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
['pdm_rx'],
|
||||
indirect=True
|
||||
)
|
||||
@pytest.mark.parametrize('config', ['pdm_rx'], indirect=True)
|
||||
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_i2s_pdm_rx_example(dut: Dut) -> None:
|
||||
dut.expect(r'I2S PDM RX example start', timeout=5)
|
||||
dut.expect(r'---------------------------', timeout=5)
|
||||
dut.expect(r'i2s_common: rx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_common: i2s rx channel enabled', timeout=5)
|
||||
dut.expect(r'Read Task: i2s read ([0-9]+) bytes', timeout=5)
|
||||
dut.expect(r'-----------------------------------', timeout=5)
|
||||
|
||||
@@ -2,36 +2,41 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32c61'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_i2s_basic_example(dut: Dut) -> None:
|
||||
|
||||
dut.expect(r'i2s_common: tx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: rx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(r'i2s_std: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(
|
||||
r'i2s_std: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_std: The tx channel on I2S0 has been initialized to STD mode successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(r'i2s_std: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(
|
||||
r'i2s_std: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_std: The rx channel on I2S0 has been initialized to STD mode successfully', timeout=5)
|
||||
chan_enable_pattern = [
|
||||
r'i2s_common: i2s tx channel enabled',
|
||||
r'i2s_common: i2s rx channel enabled'
|
||||
]
|
||||
chan_enable_pattern = [r'i2s_common: i2s tx channel enabled', r'i2s_common: i2s rx channel enabled']
|
||||
dut.expect(chan_enable_pattern, timeout=5)
|
||||
dut.expect(chan_enable_pattern, timeout=5)
|
||||
dut.expect(r'Write Task: i2s write ([0-9]+) bytes', timeout=5)
|
||||
|
||||
@@ -2,34 +2,39 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target', ['esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32c61'], indirect=['target']
|
||||
)
|
||||
def test_i2s_tdm_example(dut: Dut) -> None:
|
||||
|
||||
dut.expect(r'i2s_common: tx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: rx channel is registered on I2S0 successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(r'i2s_tdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(
|
||||
r'i2s_tdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_tdm: The tx channel on I2S0 has been initialized to TDM mode successfully', timeout=5)
|
||||
dut.expect(r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)', timeout=5)
|
||||
dut.expect(r'i2s_tdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz', timeout=5)
|
||||
dut.expect(
|
||||
r'i2s_common: DMA malloc info: dma_desc_num = ([0-9]+), '
|
||||
r'dma_desc_buf_size = dma_frame_num \* slot_num \* data_bit_width = ([0-9]+)',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(
|
||||
r'i2s_tdm: Clock division info: \[sclk\] ([0-9]+) Hz '
|
||||
r'\[mdiv\] ([0-9]+) ([0-9]+)/([0-9]+) \[mclk\] ([0-9]+) Hz \[bdiv\] ([0-9]+) \[bclk\] ([0-9]+) Hz',
|
||||
timeout=5,
|
||||
)
|
||||
dut.expect(r'i2s_tdm: The rx channel on I2S0 has been initialized to TDM mode successfully', timeout=5)
|
||||
chan_enable_pattern = [
|
||||
r'i2s_common: i2s tx channel enabled',
|
||||
r'i2s_common: i2s rx channel enabled'
|
||||
]
|
||||
chan_enable_pattern = [r'i2s_common: i2s tx channel enabled', r'i2s_common: i2s rx channel enabled']
|
||||
dut.expect(chan_enable_pattern, timeout=5)
|
||||
dut.expect(chan_enable_pattern, timeout=5)
|
||||
dut.expect(r'Write Task: i2s write ([0-9]+) bytes', timeout=5)
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2'], indirect=['target'])
|
||||
def test_i2s_es7210_tdm_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create I2S receive channel')
|
||||
dut.expect_exact('example: Configure I2S receive channel to TDM mode')
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32c61'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_i2s_es8311_example_generic(dut: Dut) -> None:
|
||||
dut.expect('i2s es8311 codec example start')
|
||||
dut.expect('-----------------------------')
|
||||
dut.expect('I \\(([0-9]+)\\) i2s_es8311: i2s driver init success')
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -29,6 +25,7 @@ def test_i2s_es8311_example_generic(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_i2s_es8311_example_bsp(dut: Dut) -> None:
|
||||
dut.expect('i2s es8311 codec example start')
|
||||
dut.expect('-----------------------------')
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_i2s_recorder_generic(dut: Dut) -> None:
|
||||
dut.expect('PDM microphone recording example start')
|
||||
dut.expect('--------------------------------------')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_rgb_lcd_lvgl(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Install MIPI DSI LCD control panel')
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.octal_psram
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -15,6 +15,7 @@ from pytest_embedded import Dut
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_rgb_lcd_lvgl_esp32s3(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Turn off LCD backlight')
|
||||
dut.expect_exact('example: Install RGB LCD panel driver')
|
||||
@@ -26,7 +27,6 @@ def test_rgb_lcd_lvgl_esp32s3(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Display LVGL UI')
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -37,6 +37,7 @@ def test_rgb_lcd_lvgl_esp32s3(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_rgb_lcd_lvgl_esp32p4(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Turn off LCD backlight')
|
||||
dut.expect_exact('example: Install RGB LCD panel driver')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_bdc_speed_control_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create DC motor')
|
||||
dut.expect_exact('example: Init pcnt driver to decode rotary signal')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_bldc_hall_control_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Disable MOSFET gate')
|
||||
dut.expect_exact('example: Create MCPWM timer')
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32p4'], indirect=['target'])
|
||||
def test_hc_sr04_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Install capture timer')
|
||||
dut.expect_exact('example: Install capture channel')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_open_foc(dut: Dut) -> None:
|
||||
dut.expect_exact('example_foc: Hello FOC')
|
||||
dut.expect_exact('example_foc: Inverter init OK')
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target'])
|
||||
def test_servo_mg996r_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create timer and operator')
|
||||
dut.expect_exact('example: Connect timer and operator')
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', [
|
||||
pytest.param('gpio', marks=[pytest.mark.esp32, pytest.mark.esp32s3]),
|
||||
pytest.param('tez', marks=[pytest.mark.esp32, pytest.mark.esp32s3]),
|
||||
pytest.param('soft', marks=[pytest.mark.esp32s3]),
|
||||
], indirect=True)
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
[('gpio', 'esp32'), ('gpio', 'esp32s3'), ('tez', 'esp32'), ('tez', 'esp32s3'), ('soft', 'esp32s3')],
|
||||
indirect=['config', 'target'],
|
||||
)
|
||||
def test_mcpwm_sync_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create timers')
|
||||
dut.expect_exact('example: Create operators')
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -16,6 +13,7 @@ from pytest_embedded import Dut
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target'])
|
||||
def test_logic_analyzer_flash_stream(dut: Dut) -> None:
|
||||
dut.expect(r'flash_fat: Probe data partition base addr: \w+ size: \w+')
|
||||
dut.expect(r'flash_fat: flash FATFS mounted')
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_simple_rgb_led_matrix_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Install fast GPIO bundle for line address control')
|
||||
dut.expect_exact('example: Install parallel IO TX unit')
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded.dut import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target', ['esp32', 'esp32s2', 'esp32s3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target']
|
||||
)
|
||||
def test_rotary_encoder(dut: Dut) -> None:
|
||||
dut.expect_exact('install pcnt unit')
|
||||
dut.expect_exact('set glitch filter')
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
def test_ppa_dsi(dut: Dut) -> None:
|
||||
dut.expect_exact('Calling app_main()')
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_dshot_esc_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create RMT TX channel')
|
||||
dut.expect_exact('example: Install Dshot ESC encoder')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ir_transceiver
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_ir_nec_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: create RMT RX channel')
|
||||
dut.expect_exact('example: register RX done callback')
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_led_strip_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create RMT TX channel')
|
||||
dut.expect_exact('example: Install led strip encoder')
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target', ['esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target']
|
||||
)
|
||||
def test_musical_buzzer_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create RMT TX channel')
|
||||
dut.expect_exact('example: Install musical score encoder')
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_onewire_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: 1-Wire bus installed on GPIO')
|
||||
dut.expect_exact('example: Device iterator created, start searching')
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target'])
|
||||
def test_stepper_motor_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Initialize EN + DIR GPIO')
|
||||
dut.expect_exact('example: Create RMT TX channel')
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import os
|
||||
from typing import Tuple
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.sdio_master_slave
|
||||
@pytest.mark.parametrize(
|
||||
'count, app_path',
|
||||
@@ -16,6 +16,7 @@ from pytest_embedded_idf import IdfDut
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_example_sdio_communication(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
"""
|
||||
Configurations
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_sdm_dac_example(dut: Dut) -> None:
|
||||
dut.expect(r'sdm_dac: Sigma-delta output is attached to GPIO \w+')
|
||||
dut.expect(r'sdm_dac: Timer allocated with resolution \w+ Hz')
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_sdm_led_example(dut: Dut) -> None:
|
||||
dut.expect_exact('sdm_led: Install sigma delta channel')
|
||||
dut.expect_exact('sdm_led: Enable sigma delta channel')
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded.dut import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32c5', 'esp32c61'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_temp_sensor_example(dut: Dut) -> None:
|
||||
dut.expect_exact('Install temperature sensor')
|
||||
dut.expect_exact('Enable temperature sensor')
|
||||
|
||||
+3
-6
@@ -1,15 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded.dut import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c6', 'esp32h2', 'esp32p4', 'esp32c5', 'esp32c61'], indirect=['target'])
|
||||
def test_temp_sensor_monitor_example(dut: Dut) -> None:
|
||||
dut.expect_exact('Install temperature sensor')
|
||||
dut.expect_exact('Enable temperature sensor')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_gptimer_example(dut: Dut) -> None:
|
||||
dut.expect_exact('Create timer handle', timeout=5)
|
||||
dut.expect_exact('Start timer, stop it at alarm event', timeout=5)
|
||||
@@ -27,7 +27,7 @@ def test_gptimer_example(dut: Dut) -> None:
|
||||
|
||||
dut.expect_exact('Stop timer')
|
||||
dut.expect_exact('Start timer, update alarm value dynamically')
|
||||
for i in range(1,5):
|
||||
for i in range(1, 5):
|
||||
res = dut.expect(r'Timer alarmed, count=(\d+)', timeout=5)
|
||||
alarm_count = res.group(1).decode('utf8')
|
||||
assert (i * 1000000 - 20) < int(alarm_count) < (i * 1000000 + 20)
|
||||
|
||||
+3
-6
@@ -1,15 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# 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
|
||||
|
||||
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32c5', 'esp32c6', 'esp32c61', 'esp32h2', 'esp32p4'], indirect=['target'])
|
||||
def test_gptimer_capture(dut: Dut) -> None:
|
||||
dut.expect_exact('Configure trig gpio')
|
||||
dut.expect_exact('Configure echo gpio')
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32c3', 'esp32c5', 'esp32c6', 'esp32c61', 'esp32h2', 'esp32s2', 'esp32s3', 'esp32p4'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_gptimer_wiegand(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Configure wiegand interface')
|
||||
dut.expect_exact('example: send wiegand data')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_touch_button(dut: Dut) -> None:
|
||||
dut.expect_exact('Touch Button Example: Touch element library installed')
|
||||
dut.expect_exact('Touch Button Example: Touch button installed')
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_touch_element_waterproof(dut: Dut) -> None:
|
||||
dut.expect_exact('Touch Element Waterproof Example: Touch Element library install')
|
||||
dut.expect_exact('Touch Element Waterproof Example: Touch Element waterproof install')
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_touch_elements_combination(dut: Dut) -> None:
|
||||
dut.expect_exact('Touch Elements Combination Example: Touch element library installed')
|
||||
dut.expect_exact('Touch Elements Combination Example: Touch button installed')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_touch_matrix(dut: Dut) -> None:
|
||||
dut.expect_exact('Touch Matrix Example: Touch element library installed')
|
||||
dut.expect_exact('Touch Matrix Example: Touch matrix installed')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_touch_slider(dut: Dut) -> None:
|
||||
dut.expect_exact('Touch Slider Example: Touch element library installed')
|
||||
dut.expect_exact('Touch Slider Example: Touch slider installed')
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_touch_sens(dut: Dut) -> None:
|
||||
dut.expect(r'Touch \[CH [0-9]+\] enabled on GPIO[0-9]+')
|
||||
dut.expect_exact('Initial benchmark and new threshold are:')
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.twai_transceiver
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_twai_alert_recovery_example(dut: Dut) -> None:
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver installed')
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver uninstalled')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-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
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.twai_transceiver
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_twai_self_test_example(dut: Dut) -> None:
|
||||
dut.expect_exact('TWAI Self Test: Driver installed')
|
||||
dut.expect_exact('TWAI Self Test: Driver uninstalled')
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_uart_async_rxtxtasks_example(dut: Dut) -> None:
|
||||
dut.expect_exact('TX_TASK: Wrote 11 bytes')
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_uart_events_example(dut: Dut) -> None:
|
||||
dut.expect_exact('Returned from app_main()')
|
||||
dut.write('a')
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_uart_select_example(dut: Dut) -> None:
|
||||
dut.expect_exact('uart_select_example: Timeout has been reached and nothing has been received')
|
||||
dut.write('a')
|
||||
|
||||
+3
-4
@@ -1,18 +1,17 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from serial import Serial
|
||||
from serial.tools.list_ports import comports
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_composite_device_serial_example(dut: Dut) -> None:
|
||||
dut.expect_exact('Hello World!')
|
||||
dut.expect_exact('USB Composite initialization')
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from serial import Serial
|
||||
from serial.tools.list_ports import comports
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_device_console_example(dut: Dut) -> None:
|
||||
dut.expect_exact('USB initialization DONE')
|
||||
dut.expect_exact('example: log -> UART')
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# 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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_device_hid_example(dut: Dut) -> None:
|
||||
dut.expect_exact('USB initialization DONE')
|
||||
dut.expect_exact('Sending Keyboard report')
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# 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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_device_midi_example(dut: Dut) -> None:
|
||||
dut.expect_exact('USB initialization DONE')
|
||||
dut.expect_exact('MIDI write task init')
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# 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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_device_msc_example(dut: Dut) -> None:
|
||||
dut.expect('Mount storage')
|
||||
dut.expect('TinyUSB Driver installed')
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3'], indirect=['target'])
|
||||
def test_usb_device_ncm_example(dut: Dut) -> None:
|
||||
netif_mac = dut.expect(r'Network interface HW address: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})')
|
||||
netif_mac = dut.expect(
|
||||
r'Network interface HW address: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'
|
||||
)
|
||||
netif_mac = netif_mac.group(1).decode('utf-8')
|
||||
dut.expect_exact('USB NCM and WiFi initialized and started')
|
||||
dut.expect_exact('Returned from app_main()')
|
||||
time.sleep(1) # Wait 1s for the network interface to appear
|
||||
time.sleep(1) # Wait 1s for the network interface to appear
|
||||
out_bytes = subprocess.check_output('ifconfig', shell=True, timeout=5)
|
||||
out_str = out_bytes.decode('utf-8')
|
||||
print('expected network interface HW address: ', netif_mac)
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from serial import Serial
|
||||
from serial.tools.list_ports import comports
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag')
|
||||
@pytest.mark.usb_device
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_device_serial_example(dut: Dut) -> None:
|
||||
dut.expect_exact('USB initialization DONE')
|
||||
sleep(2) # Some time for the OS to enumerate our USB device
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# 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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_host_msc_example(dut: Dut) -> None:
|
||||
# Get wMaxPacketSize to get USB device speed
|
||||
max_packet_size = int(dut.expect(r'wMaxPacketSize (\d{2,3})')[1].decode())
|
||||
@@ -21,10 +20,10 @@ def test_usb_host_msc_example(dut: Dut) -> None:
|
||||
read_throughput = float(dut.expect(r'example: Read speed ([0-9]*[.]?[0-9]+) MiB')[1].decode())
|
||||
|
||||
# Set write and read throughput limits
|
||||
if (max_packet_size == 512): # wMaxPacketSize = 512 for HS
|
||||
if max_packet_size == 512: # wMaxPacketSize = 512 for HS
|
||||
write_throughput_limit = 4.9
|
||||
read_throughput_limit = 11.5
|
||||
else: # wMaxPacketSize = 64 for FS
|
||||
else: # wMaxPacketSize = 64 for FS
|
||||
write_throughput_limit = 0.9
|
||||
read_throughput_limit = 1.0
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2024-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
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_host_lib_example(dut: Dut) -> None:
|
||||
# register client
|
||||
dut.expect_exact('CLASS: Registering Client')
|
||||
|
||||
+4
-3
@@ -1,21 +1,22 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
import serial.tools.list_ports
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32c6 # usb_serial_jtag is very similar, test C6 is enough.
|
||||
@pytest.mark.usj_device
|
||||
@idf_parametrize('target', ['esp32c6'], indirect=['target'])
|
||||
def test_usb_device_serial_echo_example(dut: Dut) -> None:
|
||||
dut.expect_exact('USB_SERIAL_JTAG init done')
|
||||
sleep(2)
|
||||
|
||||
ports = list(serial.tools.list_ports.comports())
|
||||
for p in ports:
|
||||
if (p.device == '/dev/ttyACM0'): # Get the usb_serial_jtag port
|
||||
if p.device == '/dev/ttyACM0': # Get the usb_serial_jtag port
|
||||
with serial.Serial(p.device) as s:
|
||||
s.write(b'hi, espressif\n')
|
||||
sleep(1)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.httpbin
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_examples_protocol_esp_http_client(dut: Dut) -> None:
|
||||
"""
|
||||
steps: |
|
||||
@@ -56,11 +57,15 @@ def test_examples_protocol_esp_http_client(dut: Dut) -> None:
|
||||
dut.expect('Finish http example')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.httpbin
|
||||
@pytest.mark.parametrize('config', [
|
||||
'ssldyn',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'ssldyn',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_examples_protocol_esp_http_client_dynamic_buffer(dut: Dut) -> None:
|
||||
# test mbedtls dynamic resource
|
||||
# check and log bin size
|
||||
@@ -103,13 +108,18 @@ def test_examples_protocol_esp_http_client_dynamic_buffer(dut: Dut) -> None:
|
||||
dut.expect('Finish http example')
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
# Currently we are just testing the build for esp_http_client on Linux target. So skipping the test run.
|
||||
# Later we will enable the test run for Linux target as well.
|
||||
@pytest.mark.skipif('config.getvalue("target") == "linux"', reason='Do not run on Linux')
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default', 'ssldyn',
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'default',
|
||||
'ssldyn',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['linux'], indirect=['target'])
|
||||
def test_examples_protocol_esp_http_client_linux(dut: Dut) -> None:
|
||||
dut.expect('Finish http example', timeout=60)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import logging
|
||||
import os
|
||||
@@ -9,6 +9,7 @@ import pexpect
|
||||
import pytest
|
||||
from common_test_methods import get_env_config_variable
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def get_sdk_path() -> str:
|
||||
@@ -19,27 +20,24 @@ def get_sdk_path() -> str:
|
||||
|
||||
|
||||
class CustomProcess(object):
|
||||
def __init__(self, cmd: str, logfile: str, verbose:bool =True) -> None:
|
||||
def __init__(self, cmd: str, logfile: str, verbose: bool = True) -> None:
|
||||
self.verbose = verbose
|
||||
self.f = open(logfile, 'w', encoding='utf-8')
|
||||
if self.verbose:
|
||||
logging.info('Starting {} > {}'.format(cmd, self.f.name))
|
||||
self.pexpect_proc = pexpect.spawn(cmd, timeout=60, logfile=self.f, encoding='utf-8', codec_errors='ignore')
|
||||
|
||||
def __enter__(self): # type: ignore
|
||||
def __enter__(self): # type: ignore
|
||||
return self
|
||||
|
||||
def close(self) -> None:
|
||||
self.pexpect_proc.terminate(force=True)
|
||||
|
||||
def __exit__(self, type, value, traceback): # type: ignore
|
||||
def __exit__(self, type, value, traceback): # type: ignore
|
||||
self.close()
|
||||
self.f.close()
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -49,8 +47,8 @@ class CustomProcess(object):
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_esp_local_ctrl(config: str, dut: Dut) -> None:
|
||||
|
||||
rel_project_path = os.path.join('examples', 'protocols', 'esp_local_ctrl')
|
||||
idf_path = get_sdk_path()
|
||||
|
||||
@@ -75,20 +73,28 @@ def test_examples_esp_local_ctrl(config: str, dut: Dut) -> None:
|
||||
# Running mDNS services in docker is not a trivial task. Therefore, the script won't connect to the host name but
|
||||
# to IP address. However, the certificates were generated for the host name and will be rejected.
|
||||
if config == 'default':
|
||||
cmd = ' '.join([sys.executable, os.path.join(idf_path, rel_project_path, 'scripts/esp_local_ctrl.py'),
|
||||
'--sec_ver 2',
|
||||
'--sec2_username wifiprov',
|
||||
'--sec2_pwd abcd1234',
|
||||
'--name', dut_ip,
|
||||
'--dont-check-hostname']) # don't reject the certificate because of the hostname
|
||||
cmd = ' '.join([
|
||||
sys.executable,
|
||||
os.path.join(idf_path, rel_project_path, 'scripts/esp_local_ctrl.py'),
|
||||
'--sec_ver 2',
|
||||
'--sec2_username wifiprov',
|
||||
'--sec2_pwd abcd1234',
|
||||
'--name',
|
||||
dut_ip,
|
||||
'--dont-check-hostname',
|
||||
]) # don't reject the certificate because of the hostname
|
||||
elif config == 'http':
|
||||
cmd = ' '.join([sys.executable, os.path.join(idf_path, rel_project_path, 'scripts/esp_local_ctrl.py'),
|
||||
'--sec_ver 2',
|
||||
'--transport http',
|
||||
'--sec2_username wifiprov',
|
||||
'--sec2_pwd abcd1234',
|
||||
'--name', dut_ip,
|
||||
'--dont-check-hostname'])
|
||||
cmd = ' '.join([
|
||||
sys.executable,
|
||||
os.path.join(idf_path, rel_project_path, 'scripts/esp_local_ctrl.py'),
|
||||
'--sec_ver 2',
|
||||
'--transport http',
|
||||
'--sec2_username wifiprov',
|
||||
'--sec2_pwd abcd1234',
|
||||
'--name',
|
||||
dut_ip,
|
||||
'--dont-check-hostname',
|
||||
])
|
||||
esp_local_ctrl_log = os.path.join(idf_path, rel_project_path, 'esp_local_ctrl.log')
|
||||
with CustomProcess(cmd, esp_local_ctrl_log) as ctrl_py:
|
||||
|
||||
@@ -100,7 +106,7 @@ def test_examples_esp_local_ctrl(config: str, dut: Dut) -> None:
|
||||
ctrl_py.pexpect_proc.expect(re.compile(r'\[ 2\] property1\s+INT32\s+{}'.format(prop1)))
|
||||
ctrl_py.pexpect_proc.expect(re.compile(r'\[ 3\] property2\s+BOOLEAN\s+Read-Only\s+(True)|(False)'))
|
||||
ctrl_py.pexpect_proc.expect(re.compile(r'\[ 4\] property3\s+STRING\s+{}'.format(prop3)))
|
||||
ctrl_py.pexpect_proc.expect_exact('Select properties to set (0 to re-read, \'q\' to quit) :')
|
||||
ctrl_py.pexpect_proc.expect_exact("Select properties to set (0 to re-read, 'q' to quit) :")
|
||||
|
||||
property1 = 123456789
|
||||
property3 = ''
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_examples_protocol_http_request(dut: Dut) -> None:
|
||||
"""
|
||||
steps: |
|
||||
1. join AP/Ethernet
|
||||
2. connect to example.com
|
||||
3. check conneciton success
|
||||
3. check connection success
|
||||
"""
|
||||
# check and log bin size
|
||||
binary_file = os.path.join(dut.app.binary_path, 'http_request.bin')
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from __future__ import division, print_function, unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
from idf_http_server_test import test as client
|
||||
@@ -32,12 +30,9 @@ from pytest_embedded import Dut
|
||||
# features to this component.
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_advanced(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'tests.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
@@ -57,9 +52,12 @@ def test_examples_protocol_http_server_advanced(dut: Dut) -> None:
|
||||
|
||||
got_port = dut.expect(r"(?:[\s\S]*)Started HTTP server on port: '(\d+)'", timeout=30)[1].decode()
|
||||
|
||||
result = dut.expect(r"(?:[\s\S]*)Max URI handlers: '(\d+)'(?:[\s\S]*)Max Open Sessions: " # noqa: W605
|
||||
r"'(\d+)'(?:[\s\S]*)Max Header Length: '(\d+)'(?:[\s\S]*)Max URI Length: "
|
||||
r"'(\d+)'(?:[\s\S]*)Max Stack Size: '(\d+)'", timeout=15)
|
||||
result = dut.expect(
|
||||
r"(?:[\s\S]*)Max URI handlers: '(\d+)'(?:[\s\S]*)Max Open Sessions: " # noqa: W605
|
||||
r"'(\d+)'(?:[\s\S]*)Max Header Length: '(\d+)'(?:[\s\S]*)Max URI Length: "
|
||||
r"'(\d+)'(?:[\s\S]*)Max Stack Size: '(\d+)'",
|
||||
timeout=15,
|
||||
)
|
||||
# max_uri_handlers = int(result[1])
|
||||
max_sessions = int(result[2])
|
||||
max_hdr_len = int(result[3])
|
||||
|
||||
@@ -7,10 +7,11 @@ import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ethernet
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_http_server_async_handler(dut: Dut) -> None:
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'simple.bin')
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import http.client
|
||||
import logging
|
||||
import os
|
||||
@@ -14,6 +11,7 @@ import sys
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
import wifi_tools
|
||||
@@ -68,12 +66,11 @@ def test_captive_page(ip: str, port: str, uri: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_wlan
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32'], reason='unstable case')
|
||||
@pytest.mark.xfail(reason='Runner unable to connect to target over WiFi', run=False)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_example_captive_portal(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'captive_portal.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
@@ -103,7 +100,9 @@ def test_example_captive_portal(dut: Dut) -> None:
|
||||
except RuntimeError as err:
|
||||
logging.info('error: {}'.format(err))
|
||||
try:
|
||||
got_ip = dut.expect(r'DHCP server assigned IP to a station, IP is: (\d+.\d+.\d+.\d+)', timeout=60)[1].decode()
|
||||
got_ip = dut.expect(r'DHCP server assigned IP to a station, IP is: (\d+.\d+.\d+.\d+)', timeout=60)[
|
||||
1
|
||||
].decode()
|
||||
logging.info('got_ip: {}'.format(got_ip))
|
||||
if ip != got_ip:
|
||||
raise RuntimeError('SoftAP connected to another host! {} != {}'.format(ip, got_ip))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import hashlib
|
||||
import http.client
|
||||
@@ -9,6 +9,7 @@ import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
from idf_http_server_test import adder as client
|
||||
@@ -20,13 +21,16 @@ from common_test_methods import get_env_config_variable
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@pytest.mark.parametrize('config', ['spiffs',], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'spiffs',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'file_server.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
@@ -73,7 +77,7 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
logging.info('Passed the test to uploaded file on the file server')
|
||||
|
||||
# Download the uploaded file from the file server
|
||||
logging.info("\nTesting for Download of \"existing\" file from the file server")
|
||||
logging.info('\nTesting for Download of "existing" file from the file server')
|
||||
|
||||
download_data = client.getreq(conn, '/' + str(upload_file_name))
|
||||
|
||||
@@ -91,7 +95,7 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
raise RuntimeError('The md5 hash of the downloaded file does not match with that of the uploaded file')
|
||||
|
||||
# Upload existing file on the file server
|
||||
logging.info("\nTesting the upload of \"already existing\" file on the file server")
|
||||
logging.info('\nTesting the upload of "already existing" file on the file server')
|
||||
client.postreq(conn, '/upload/' + str(upload_file_name), data=None)
|
||||
try:
|
||||
dut.expect('File already exists : /data/' + str(upload_file_name), timeout=10)
|
||||
@@ -112,7 +116,7 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
|
||||
conn = client.start_session(got_ip, got_port)
|
||||
# Delete the existing file from the file server
|
||||
logging.info("\nTesting the deletion of \"existing\" file on the file server")
|
||||
logging.info('\nTesting the deletion of "existing" file on the file server')
|
||||
client.postreq(conn, '/delete/' + str(upload_file_name), data=None)
|
||||
try:
|
||||
dut.expect('Deleting file : /' + str(upload_file_name), timeout=10)
|
||||
@@ -123,7 +127,7 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
|
||||
conn = client.start_session(got_ip, got_port)
|
||||
# Try to delete non existing file from the file server
|
||||
logging.info("\nTesting the deletion of \"non existing\" file on the file server")
|
||||
logging.info('\nTesting the deletion of "non existing" file on the file server')
|
||||
client.postreq(conn, '/delete/' + str(upload_file_name), data=None)
|
||||
try:
|
||||
dut.expect('File does not exist : /' + str(upload_file_name), timeout=10)
|
||||
@@ -134,7 +138,7 @@ def test_examples_protocol_http_server_file_serving(dut: Dut) -> None:
|
||||
|
||||
conn = client.start_session(got_ip, got_port)
|
||||
# Try to download non existing file from the file server
|
||||
logging.info("\nTesting for Download of \"non existing\" file from the file server")
|
||||
logging.info('\nTesting for Download of "non existing" file from the file server')
|
||||
|
||||
download_data = client.getreq(conn, '/' + str(upload_file_name))
|
||||
|
||||
|
||||
+8
-10
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import logging
|
||||
import os
|
||||
@@ -8,6 +8,7 @@ import random
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
from idf_http_server_test import adder as client
|
||||
@@ -23,19 +24,16 @@ from pytest_embedded import Dut
|
||||
# > make print_flash_cmd | tail -n 1 > build/download.config
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_persistence(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'persistent_sockets.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
logging.info('http_server_bin_size : {}KB'.format(bin_size // 1024))
|
||||
|
||||
# Upload binary and start testing
|
||||
logging.info('Starting http_server persistance test app')
|
||||
logging.info('Starting http_server persistence test app')
|
||||
|
||||
# Parse IP address of STA
|
||||
logging.info('Waiting to connect with AP')
|
||||
@@ -70,7 +68,7 @@ def test_examples_protocol_http_server_persistence(dut: Dut) -> None:
|
||||
dut.expect('Logging out', timeout=30)
|
||||
|
||||
# Test PUT request and initialize session context
|
||||
num = random.randint(0,100)
|
||||
num = random.randint(0, 100)
|
||||
client.putreq(conn, '/adder', str(num))
|
||||
visitor += 1
|
||||
dut.expect('/adder visitor count = ' + str(visitor), timeout=30)
|
||||
@@ -78,7 +76,7 @@ def test_examples_protocol_http_server_persistence(dut: Dut) -> None:
|
||||
dut.expect('PUT allocating new session', timeout=30)
|
||||
|
||||
# Retest PUT request and change session context value
|
||||
num = random.randint(0,100)
|
||||
num = random.randint(0, 100)
|
||||
logging.info('Adding: {}'.format(num))
|
||||
client.putreq(conn, '/adder', str(num))
|
||||
visitor += 1
|
||||
@@ -95,7 +93,7 @@ def test_examples_protocol_http_server_persistence(dut: Dut) -> None:
|
||||
pass
|
||||
|
||||
# Test POST request and session persistence
|
||||
random_nums = [random.randint(0,100) for _ in range(100)]
|
||||
random_nums = [random.randint(0, 100) for _ in range(100)]
|
||||
for num in random_nums:
|
||||
logging.info('Adding: {}'.format(num))
|
||||
client.postreq(conn, '/adder', str(num))
|
||||
@@ -120,7 +118,7 @@ def test_examples_protocol_http_server_persistence(dut: Dut) -> None:
|
||||
logging.info('Validating user context data')
|
||||
# Start another session to check user context data
|
||||
client.start_session(got_ip, got_port)
|
||||
num = random.randint(0,100)
|
||||
num = random.randint(0, 100)
|
||||
client.putreq(conn, '/adder', str(num))
|
||||
visitor += 1
|
||||
dut.expect('/adder visitor count = ' + str(visitor), timeout=30)
|
||||
|
||||
@@ -12,6 +12,7 @@ import threading
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
import http.client
|
||||
@@ -45,18 +46,15 @@ class http_client_thread(threading.Thread):
|
||||
except socket.timeout:
|
||||
self.exc = 1
|
||||
|
||||
def join(self, timeout=None): # type: ignore
|
||||
def join(self, timeout=None): # type: ignore
|
||||
threading.Thread.join(self)
|
||||
if self.exc:
|
||||
raise socket.timeout
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_simple(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'simple.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
@@ -106,7 +104,7 @@ def test_examples_protocol_http_server_simple(dut: Dut) -> None:
|
||||
dut.expect('Registering /hello and /echo URIs', timeout=30)
|
||||
|
||||
# Generate random data of 10KB
|
||||
random_data = ''.join(string.printable[random.randint(0,len(string.printable)) - 1] for _ in range(10 * 1024))
|
||||
random_data = ''.join(string.printable[random.randint(0, len(string.printable)) - 1] for _ in range(10 * 1024))
|
||||
logging.info('Test /echo POST handler with random data')
|
||||
if not client.test_post_handler(got_ip, got_port, random_data):
|
||||
raise RuntimeError
|
||||
@@ -116,7 +114,9 @@ def test_examples_protocol_http_server_simple(dut: Dut) -> None:
|
||||
if not client.test_custom_uri_query(got_ip, got_port, queries):
|
||||
raise RuntimeError
|
||||
|
||||
dut.expect_exact('Found URL query => query1=http%3A%2F%2Ffoobar&query3=abcd%2B1234%20xyz&query2=Esp%21%40%20%23%2471', timeout=30)
|
||||
dut.expect_exact(
|
||||
'Found URL query => query1=http%3A%2F%2Ffoobar&query3=abcd%2B1234%20xyz&query2=Esp%21%40%20%23%2471', timeout=30
|
||||
)
|
||||
dut.expect_exact('Found URL query parameter => query1=http%3A%2F%2Ffoobar', timeout=30)
|
||||
dut.expect_exact('Decoded query parameter => http://foobar', timeout=30)
|
||||
dut.expect_exact('Found URL query parameter => query3=abcd%2B1234%20xyz', timeout=30)
|
||||
@@ -125,12 +125,9 @@ def test_examples_protocol_http_server_simple(dut: Dut) -> None:
|
||||
dut.expect_exact('Decoded query parameter => Esp!@ #$71', timeout=30)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.wifi_router
|
||||
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_lru_purge_enable(dut: Dut) -> None:
|
||||
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'simple.bin')
|
||||
bin_size = os.path.getsize(binary_file)
|
||||
@@ -169,9 +166,15 @@ def test_examples_protocol_http_server_lru_purge_enable(dut: Dut) -> None:
|
||||
t.join()
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_router
|
||||
@pytest.mark.parametrize('config', ['sse',], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'sse',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_examples_protocol_http_server_sse(dut: Dut) -> None:
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'simple.bin')
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from __future__ import division, print_function, unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from common_test_methods import get_env_config_variable
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
try:
|
||||
import websocket
|
||||
@@ -21,7 +19,7 @@ except ImportError:
|
||||
OPCODE_TEXT = 0x1
|
||||
OPCODE_BIN = 0x2
|
||||
OPCODE_PING = 0x9
|
||||
OPCODE_PONG = 0xa
|
||||
OPCODE_PONG = 0xA
|
||||
|
||||
|
||||
class WsClient:
|
||||
@@ -30,17 +28,17 @@ class WsClient:
|
||||
self.ip = ip
|
||||
self.ws = websocket.WebSocket()
|
||||
|
||||
def __enter__(self): # type: ignore
|
||||
def __enter__(self): # type: ignore
|
||||
self.ws.connect('ws://{}:{}/ws'.format(self.ip, self.port))
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback): # type: ignore
|
||||
def __exit__(self, exc_type, exc_value, traceback): # type: ignore
|
||||
self.ws.close()
|
||||
|
||||
def read(self): # type: ignore
|
||||
def read(self): # type: ignore
|
||||
return self.ws.recv_data(control_frame=True)
|
||||
|
||||
def write(self, data='', opcode=OPCODE_TEXT): # type: ignore
|
||||
def write(self, data='', opcode=OPCODE_TEXT): # type: ignore
|
||||
if opcode == OPCODE_BIN:
|
||||
return self.ws.send_binary(data.encode())
|
||||
if opcode == OPCODE_PING:
|
||||
@@ -48,8 +46,8 @@ class WsClient:
|
||||
return self.ws.send(data)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_router
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_examples_protocol_http_ws_echo_server(dut: Dut) -> None:
|
||||
# Get binary file
|
||||
binary_file = os.path.join(dut.app.binary_path, 'ws_echo_server.bin')
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user