forked from espressif/esp-idf
Merge branch 'feature/ble_example_add_pytest_for_ble' into 'master'
feat(ble): added pytest for ble example Closes BLERP-1110 See merge request espressif/esp-idf!33640
This commit is contained in:
@@ -19,7 +19,20 @@ examples/bluetooth/bluedroid/ble:
|
||||
<<: *bt_default_depends
|
||||
disable:
|
||||
- if: SOC_BT_SUPPORTED != 1
|
||||
|
||||
depends_components:
|
||||
- bt
|
||||
- esp_phy
|
||||
- nvs_flash
|
||||
- esp_coex
|
||||
- esp_log
|
||||
- esp_console
|
||||
- mbedtls
|
||||
- vfs
|
||||
- esp_driver_gpio
|
||||
- esp_driver_i2s
|
||||
- esp_driver_uart
|
||||
depends_filepatterns:
|
||||
- examples/bluetooth/bluedroid/ble/pytest_ble_test.py
|
||||
|
||||
examples/bluetooth/bluedroid/ble/ble_hid_device_demo:
|
||||
disable:
|
||||
@@ -27,9 +40,43 @@ examples/bluetooth/bluedroid/ble/ble_hid_device_demo:
|
||||
depends_components:
|
||||
- esp_driver_gpio
|
||||
|
||||
examples/bluetooth/bluedroid/ble/ble_throughput:
|
||||
<<: *bt_default_depends
|
||||
disable:
|
||||
- if: SOC_BT_SUPPORTED != 1
|
||||
depends_components:
|
||||
- bt
|
||||
- esp_phy
|
||||
- nvs_flash
|
||||
- esp_coex
|
||||
- esp_log
|
||||
- esp_console
|
||||
- mbedtls
|
||||
- vfs
|
||||
- esp_driver_gpio
|
||||
- esp_driver_i2s
|
||||
- esp_driver_uart
|
||||
depends_filepatterns:
|
||||
- examples/bluetooth/bluedroid/ble_50/pytest_ble_throughput_test.py
|
||||
|
||||
examples/bluetooth/bluedroid/ble_50:
|
||||
<<: *bt_default_depends
|
||||
disable:
|
||||
- if: SOC_BLE_50_SUPPORTED != 1
|
||||
depends_components:
|
||||
- bt
|
||||
- esp_phy
|
||||
- nvs_flash
|
||||
- esp_coex
|
||||
- esp_log
|
||||
- esp_console
|
||||
- mbedtls
|
||||
- vfs
|
||||
- esp_driver_gpio
|
||||
- esp_driver_i2s
|
||||
- esp_driver_uart
|
||||
depends_filepatterns:
|
||||
- examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py
|
||||
|
||||
examples/bluetooth/bluedroid/classic_bt:
|
||||
disable:
|
||||
|
@@ -0,0 +1,3 @@
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_IBEACON_RECEIVER=y
|
@@ -0,0 +1,3 @@
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_IBEACON_SENDER=y
|
@@ -0,0 +1 @@
|
||||
CONFIG_IBEACON_RECEIVER=y
|
@@ -0,0 +1 @@
|
||||
CONFIG_IBEACON_SENDER=y
|
@@ -0,0 +1,162 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
import time
|
||||
from typing import Tuple
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
# Case 1: gatt write throughput test
|
||||
@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_all', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'write', 'y'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
server.expect_exact('Advertising start successfully', timeout=30)
|
||||
client.expect_exact('Scanning start successfully', timeout=30)
|
||||
client.expect_exact('Device found ', timeout=30)
|
||||
server.expect_exact('Service start, status 0', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0, MTU 517', timeout=30)
|
||||
server.expect_exact('MTU exchange, MTU 517', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 30:
|
||||
throughput = int(server.expect(r'GATTC write Bit rate = (\d+) Byte/s', timeout=30).group(1).decode('utf8'))
|
||||
assert throughput > 50000 or throughput < 95000
|
||||
|
||||
|
||||
# Case 2: gatt write throughput 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_all', [
|
||||
(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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
server.expect_exact('Advertising start successfully', timeout=30)
|
||||
client.expect_exact('Scanning start successfully', timeout=30)
|
||||
client.expect_exact('Device found ', timeout=30)
|
||||
server.expect_exact('Service start, status 0', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0, MTU 517', timeout=30)
|
||||
server.expect_exact('MTU exchange, MTU 517', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 30:
|
||||
throughput = int(server.expect(r'GATTC write Bit rate = (\d+) Byte/s', timeout=30).group(1).decode('utf8'))
|
||||
assert throughput > 50000 or throughput < 95000
|
||||
|
||||
|
||||
# Case 3: gatt notify throughput test
|
||||
@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_all', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}',
|
||||
'notify', 'y'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
server.expect_exact('Advertising start successfully', timeout=30)
|
||||
client.expect_exact('Scanning start successfully', timeout=30)
|
||||
client.expect_exact('Device found ', timeout=30)
|
||||
server.expect_exact('Service start, status 0', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0, MTU 517', timeout=30)
|
||||
server.expect_exact('MTU exchange, MTU 517', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
client.expect_exact('Notification register successfully', timeout=30)
|
||||
server.expect_exact('Notification enable', timeout=30)
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 30:
|
||||
throughput = int(client.expect(r'Notify Bit rate = (\d+) Byte/s', timeout=30).group(1).decode('utf8'))
|
||||
assert throughput > 50000 or throughput < 95000
|
||||
|
||||
|
||||
# Case 4: gatt notify throughput 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_all', [
|
||||
(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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
server.expect_exact('Advertising start successfully', timeout=30)
|
||||
client.expect_exact('Scanning start successfully', timeout=30)
|
||||
client.expect_exact('Device found ', timeout=30)
|
||||
server.expect_exact('Service start, status 0', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0, MTU 517', timeout=30)
|
||||
server.expect_exact('MTU exchange, MTU 517', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
client.expect_exact('Notification register successfully', timeout=30)
|
||||
server.expect_exact('Notification enable', timeout=30)
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 30:
|
||||
throughput = int(client.expect(r'Notify Bit rate = (\d+) Byte/s', timeout=30).group(1).decode('utf8'))
|
||||
assert throughput > 50000 or throughput < 95000
|
@@ -0,0 +1,7 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=n
|
@@ -0,0 +1,6 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=n
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=n
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=n
|
@@ -0,0 +1,7 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=n
|
@@ -0,0 +1,6 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=n
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=n
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
||||
CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=y
|
||||
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=n
|
@@ -0,0 +1,5 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -7,3 +7,7 @@ CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
||||
# CONFIG_BT_LE_50_FEATURE_SUPPORT is not set
|
||||
CONFIG_BT_LE_HCI_EVT_BUF_SIZE=257
|
||||
|
||||
# XTAL Freq Config
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_XTAL_FREQ=26
|
||||
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,3 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,3 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,3 @@
|
||||
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -6,3 +6,6 @@ CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
||||
# CONFIG_BT_LE_50_FEATURE_SUPPORT is not set
|
||||
CONFIG_BT_LE_HCI_EVT_BUF_SIZE=257
|
||||
# XTAL Freq Config
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_XTAL_FREQ=26
|
||||
|
265
examples/bluetooth/bluedroid/ble/pytest_ble_test.py
Normal file
265
examples/bluetooth/bluedroid/ble/pytest_ble_test.py
Normal file
@@ -0,0 +1,265 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import os.path
|
||||
from typing import Tuple
|
||||
|
||||
import pexpect
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
|
||||
|
||||
# Case 1: gatt client and gatt server 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_all', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}',
|
||||
'name', 'y'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
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.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)
|
||||
gatt_client.expect_exact('Scanning start successfully', timeout=30)
|
||||
gatt_client.expect_exact(f'Connected, conn_id 0, remote {gatt_server_addr}', timeout=30)
|
||||
gatt_server.expect_exact(f'Connected, conn_id 0, remote {gatt_client_addr}', timeout=30)
|
||||
gatt_client.expect_exact('Connection params update, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Connection params update, status 0', timeout=30)
|
||||
gatt_client.expect_exact('Service discover complete', timeout=30)
|
||||
gatt_client.expect_exact('Service search complete', timeout=30)
|
||||
gatt_client.expect_exact('MTU exchange, status 0, MTU 500', timeout=30)
|
||||
gatt_server.expect_exact('MTU exchange, MTU 500', timeout=30)
|
||||
gatt_server.expect_exact('Notification enable', timeout=30)
|
||||
gatt_client.expect_exact('Notification received', timeout=30)
|
||||
gatt_client_output = gatt_client.expect(pexpect.TIMEOUT, timeout=10)
|
||||
gatt_server_output = gatt_server.expect(pexpect.TIMEOUT, timeout=10)
|
||||
assert 'rst:' not in str(gatt_client_output) and 'boot:' not in str(gatt_client_output)
|
||||
assert 'rst:' not in str(gatt_server_output) and 'boot:' not in str(gatt_server_output)
|
||||
assert 'Disconnected' not in str(gatt_client_output)
|
||||
assert 'Disconnected' not in str(gatt_server_output)
|
||||
|
||||
|
||||
# Case 2: gatt client and gatt server 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_all', [
|
||||
(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.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)
|
||||
gatt_client.expect_exact('Scanning start success', timeout=30)
|
||||
gatt_client.expect_exact(f'Connected, conn_id 0, remote {gatt_server_addr}', timeout=30)
|
||||
gatt_server.expect_exact(f'Connected, conn_id 0, remote {gatt_client_addr}', timeout=30)
|
||||
gatt_client.expect_exact('Connection params update, status 0', timeout=30)
|
||||
gatt_server.expect_exact('Connection params update, status 0', timeout=30)
|
||||
gatt_client.expect_exact('Service discover complete', timeout=30)
|
||||
gatt_client.expect_exact('Service search complete', timeout=30)
|
||||
gatt_client.expect_exact('MTU exchange, status 0, MTU 500', timeout=30)
|
||||
gatt_server.expect_exact('MTU exchange, MTU 500', timeout=30)
|
||||
gatt_server.expect_exact('Notification enable', timeout=30)
|
||||
gatt_client.expect_exact('Notification received', timeout=30)
|
||||
gatt_client_output = gatt_client.expect(pexpect.TIMEOUT, timeout=10)
|
||||
gatt_server_output = gatt_server.expect(pexpect.TIMEOUT, timeout=10)
|
||||
assert 'rst:' not in str(gatt_client_output) and 'boot:' not in str(gatt_client_output)
|
||||
assert 'rst:' not in str(gatt_server_output) and 'boot:' not in str(gatt_server_output)
|
||||
assert 'Disconnected' not in str(gatt_client_output)
|
||||
assert 'Disconnected' not in str(gatt_server_output)
|
||||
|
||||
|
||||
# Case 3: gatt security server and gatt security client 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_all', [
|
||||
(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,
|
||||
)
|
||||
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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_security_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_security_client.expect_exact('Local privacy config successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Local privacy config successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Scanning start successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Device found BE', timeout=30)
|
||||
# can not get rpa_address, so not check server address
|
||||
gatt_security_client.expect_exact(f'Connected, conn_id 0, remote ', timeout=30)
|
||||
if target == ('esp32', 'esp32'):
|
||||
gatt_security_server.expect_exact(f'Connected, conn_id 0, remote', timeout=30)
|
||||
else:
|
||||
gatt_security_server.expect_exact(f'Connected, conn_id 0, remote {gatt_security_client_addr}', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_LENC', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PENC', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_LID', timeout=30)
|
||||
|
||||
gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_LENC', timeout=30)
|
||||
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)
|
||||
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_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)
|
||||
gatt_security_client.expect_exact('Pairing successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Service search complete', timeout=30)
|
||||
gatt_security_client_output = gatt_security_client.expect(pexpect.TIMEOUT, timeout=10)
|
||||
gatt_security_server_output = gatt_security_server.expect(pexpect.TIMEOUT, timeout=10)
|
||||
assert 'rst:' not in str(gatt_security_client_output) and 'boot:' not in str(gatt_security_client_output)
|
||||
assert 'rst:' not in str(gatt_security_server_output) and 'boot:' not in str(gatt_security_server_output)
|
||||
assert 'Disconnected' not in str(gatt_security_client_output)
|
||||
assert 'Disconnected' not in str(gatt_security_server_output)
|
||||
|
||||
|
||||
# Case 4: gatt security server and gatt security client 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_all', [
|
||||
(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.expect_exact('GATT client register, status 0', timeout=30)
|
||||
gatt_security_server.expect_exact('GATT server register, status 0', timeout=30)
|
||||
gatt_security_client.expect_exact('Local privacy config successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Local privacy config successfully', timeout=30)
|
||||
gatt_security_server.expect_exact('Advertising start successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Scanning start successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Device found BE', timeout=30)
|
||||
# can not get rpa_address, so not check server address
|
||||
gatt_security_client.expect_exact(f'Connected, conn_id 0, remote ', timeout=30)
|
||||
gatt_security_server.expect_exact(f'Connected, conn_id 0, remote {gatt_security_client_addr}', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_LENC', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PENC', timeout=30)
|
||||
gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_LID', timeout=30)
|
||||
|
||||
gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_LENC', timeout=30)
|
||||
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_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)
|
||||
gatt_security_client.expect_exact('Pairing successfully', timeout=30)
|
||||
gatt_security_client.expect_exact('Service search complete', timeout=30)
|
||||
gatt_security_client_output = gatt_security_client.expect(pexpect.TIMEOUT, timeout=10)
|
||||
gatt_security_server_output = gatt_security_server.expect(pexpect.TIMEOUT, timeout=10)
|
||||
assert 'rst:' not in str(gatt_security_client_output) and 'boot:' not in str(gatt_security_client_output)
|
||||
assert 'rst:' not in str(gatt_security_server_output) and 'boot:' not in str(gatt_security_server_output)
|
||||
assert 'Disconnected' not in str(gatt_security_client_output)
|
||||
assert 'Disconnected' not in str(gatt_security_server_output)
|
||||
|
||||
|
||||
# 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_all', [
|
||||
(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,
|
||||
)
|
||||
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.expect_exact('Advertising start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Scanning start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('iBeacon Found', timeout=30)
|
||||
ibeacon_receiver.expect_exact(f'IBEACON_DEMO: Device address: {ibeacon_sender_addr}', timeout=30)
|
||||
ibeacon_receiver.expect_exact('IBEACON_DEMO: Proximity UUID:', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Major: 0x27b7 (10167)', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Minor: 0xf206 (61958)', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Measured power (RSSI at a 1m distance):', timeout=30)
|
||||
ibeacon_receiver.expect_exact('RSSI of packet: ', timeout=30)
|
||||
|
||||
|
||||
# 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_all', [
|
||||
(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,
|
||||
)
|
||||
def test_c2_26mhz_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.expect_exact('Advertising start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Scanning start successfully', timeout=30)
|
||||
ibeacon_receiver.expect_exact('iBeacon Found', timeout=30)
|
||||
ibeacon_receiver.expect_exact(f'IBEACON_DEMO: Device address: {ibeacon_sender_addr}', timeout=30)
|
||||
ibeacon_receiver.expect_exact('IBEACON_DEMO: Proximity UUID:', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Major: 0x27b7 (10167)', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Minor: 0xf206 (61958)', timeout=30)
|
||||
ibeacon_receiver.expect_exact('Measured power (RSSI at a 1m distance):', timeout=30)
|
||||
ibeacon_receiver.expect_exact('RSSI of packet: ', timeout=30)
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,4 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_XTAL_FREQ_26=y
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
@@ -0,0 +1,2 @@
|
||||
CONFIG_EXAMPLE_CI_ID=1
|
||||
CONFIG_EXAMPLE_CI_PIPELINE_ID=${CI_PIPELINE_ID}
|
143
examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py
Normal file
143
examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py
Normal file
@@ -0,0 +1,143 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 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
|
||||
|
||||
|
||||
# Case 1: ble50 security client and ble50 security server test
|
||||
@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_all', [
|
||||
(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,
|
||||
)
|
||||
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')
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising start, status 0', timeout=30)
|
||||
client.expect_exact('Extended scanning start successfully', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
server.expect_exact('Pairing successfully', timeout=30)
|
||||
client.expect_exact('Pairing successfully', timeout=30)
|
||||
server.expect_exact('Bonded devices number 1', timeout=30)
|
||||
server.expect_exact('Characteristic write', timeout=30)
|
||||
client.expect_exact('Service discover complete', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0', timeout=30)
|
||||
client.expect_exact('Descriptor write successfully', timeout=30)
|
||||
|
||||
|
||||
# Case 2: ble50 security client and ble50 security server 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_all', [
|
||||
(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')
|
||||
|
||||
server.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
server.expect_exact('Extended advertising start, status 0', timeout=30)
|
||||
client.expect_exact('Extended scanning start successfully', timeout=30)
|
||||
client.expect_exact(f'Connected, conn_id 0, remote {server_addr}', timeout=30)
|
||||
server.expect_exact(f'Connected, conn_id 0, remote {client_addr}', timeout=30)
|
||||
server.expect_exact('Pairing successfully', timeout=30)
|
||||
client.expect_exact('Pairing successfully', timeout=30)
|
||||
server.expect_exact('Bonded devices number 1', timeout=30)
|
||||
server.expect_exact('Characteristic write', timeout=30)
|
||||
client.expect_exact('Service discover complete', timeout=30)
|
||||
client.expect_exact('Service search complete', timeout=30)
|
||||
client.expect_exact('MTU exchange, status 0', timeout=30)
|
||||
client.expect_exact('Descriptor write successfully', timeout=30)
|
||||
|
||||
|
||||
# Case 3: period_adv and period_sync test
|
||||
@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_all', [
|
||||
(2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}',
|
||||
'name', 'y'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
adv_dut = dut[0]
|
||||
sync_dut = dut[1]
|
||||
|
||||
adv_dut.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising random address set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising start, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising params set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising data set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising start, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Extended scanning params set, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Extended scanning start, status 0', timeout=30)
|
||||
sync_dut.expect_exact(f'Create sync with the peer device BE', timeout=30)
|
||||
sync_dut.expect_exact('Periodic advertising sync establish, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Periodic adv report, sync handle ', timeout=30)
|
||||
|
||||
|
||||
# Case 4: period_adv and period_sync 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_all', [
|
||||
(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,
|
||||
)
|
||||
def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
adv_dut = dut[0]
|
||||
sync_dut = dut[1]
|
||||
|
||||
adv_dut.expect_exact('Extended advertising params set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising random address set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising data set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Extended advertising start, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising params set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising data set, status 0', timeout=30)
|
||||
adv_dut.expect_exact('Periodic advertising start, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Extended scanning params set, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Extended scanning start, status 0', timeout=30)
|
||||
sync_dut.expect_exact(f'Create sync with the peer device BE', timeout=30)
|
||||
sync_dut.expect_exact('Periodic advertising sync establish, status 0', timeout=30)
|
||||
sync_dut.expect_exact('Periodic adv report, sync handle ', timeout=30)
|
Reference in New Issue
Block a user