mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(bt/examples): Fixed test_bt_l2cap not finding ESP_SDP_CREATE_RECORD_COMP_EVT
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 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: SPP
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ from pytest_embedded_idf.dut import IdfDut
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_initiator")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_acceptor")}|'
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_initiator")}',
|
||||
'esp32|esp32',
|
||||
'y',
|
||||
'test',
|
||||
@@ -23,7 +24,7 @@ from pytest_embedded_idf.dut import IdfDut
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_spp_only(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_spp_only(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
acceptor = dut[0]
|
||||
initiator = dut[1]
|
||||
|
||||
@@ -49,14 +50,15 @@ def test_bt_spp_only(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_initiator")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_acceptor")}|'
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_initiator")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_spp_vfs(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_spp_vfs(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
acceptor = dut[0]
|
||||
initiator = dut[1]
|
||||
|
||||
@@ -77,14 +79,15 @@ def test_bt_spp_vfs(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "a2dp_sink")}|{os.path.join(os.path.dirname(__file__), "a2dp_source")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "a2dp_sink")}|'
|
||||
f'{os.path.join(os.path.dirname(__file__), "a2dp_source")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_a2dp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_a2dp(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
sink_dut = dut[0]
|
||||
source_dut = dut[1]
|
||||
source_dut_mac = source_dut.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8')
|
||||
@@ -110,7 +113,7 @@ def test_bt_a2dp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_hfp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_hfp(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
hfp_ag = dut[0]
|
||||
hfp_hf = dut[1]
|
||||
|
||||
@@ -136,7 +139,7 @@ def test_bt_hfp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_hid(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_hid(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
hid_device = dut[0]
|
||||
hid_host = dut[1]
|
||||
|
||||
@@ -157,20 +160,24 @@ def test_bt_hid(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
[
|
||||
(
|
||||
2,
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_server")}|{os.path.join(os.path.dirname(__file__), "bt_l2cap_client")}',
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_server")}|'
|
||||
f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_client")}',
|
||||
'esp32|esp32',
|
||||
'test',
|
||||
),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_bt_l2cap(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||
def test_bt_l2cap(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None:
|
||||
server = dut[0]
|
||||
client = dut[1]
|
||||
|
||||
server.expect_exact('ESP_BT_L2CAP_INIT_EVT: status:0', timeout=30)
|
||||
server.expect_exact('ESP_BT_L2CAP_START_EVT: status:0', timeout=30)
|
||||
server.expect_exact('ESP_SDP_CREATE_RECORD_COMP_EVT: status:0', timeout=30)
|
||||
server.expect(
|
||||
r'(?s)(ESP_BT_L2CAP_START_EVT: status:0.*ESP_SDP_CREATE_RECORD_COMP_EVT: status:0|'
|
||||
r'ESP_SDP_CREATE_RECORD_COMP_EVT: status:0.*ESP_BT_L2CAP_START_EVT: status:0)',
|
||||
timeout=30,
|
||||
)
|
||||
client.expect_exact('ESP_BT_L2CAP_INIT_EVT: status:0', timeout=30)
|
||||
client.expect_exact('ESP_SDP_SEARCH_COMP_EVT: status:0', timeout=30)
|
||||
client.expect_exact('ESP_BT_L2CAP_OPEN_EVT: status:0', timeout=30)
|
||||
|
||||
Reference in New Issue
Block a user