-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ble_dev/added_ble_power_save_pytest_v5.1' into 'release…
…/v5.1' Added pytest case for BLE power save example v5.1 See merge request espressif/esp-idf!28595
- Loading branch information
Showing
13 changed files
with
170 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_EXAMPLE_USE_CI_ADDRESS=y | ||
CONFIG_EXAMPLE_PEER_ADDR="${CI_JOB_ID}" |
4 changes: 4 additions & 0 deletions
4
examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c2_xtal26m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_IDF_TARGET="esp32c2" | ||
CONFIG_XTAL_FREQ_26=y | ||
CONFIG_EXAMPLE_USE_CI_ADDRESS=y | ||
CONFIG_EXAMPLE_PEER_ADDR="${CI_JOB_ID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Test Config | ||
# | ||
CONFIG_EXAMPLE_USE_CI_ADDRESS=y | ||
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_JOB_ID}" |
7 changes: 7 additions & 0 deletions
7
examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c2_xtal26m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CONFIG_IDF_TARGET="esp32c2" | ||
CONFIG_XTAL_FREQ_26=y | ||
# | ||
# Test Config | ||
# | ||
CONFIG_EXAMPLE_USE_CI_ADDRESS=y | ||
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_JOB_ID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# 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: BLE power save test | ||
@pytest.mark.esp32c6 | ||
@pytest.mark.esp32h2 | ||
@pytest.mark.esp32c3 | ||
@pytest.mark.esp32s3 | ||
@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")}'), | ||
], | ||
indirect=True, | ||
) | ||
def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: | ||
peripheral = dut[0] | ||
central = dut[1] | ||
|
||
peripheral.expect('NimBLE_BLE_PRPH: BLE Host Task Started', timeout=30) | ||
central.expect('NimBLE_BLE_CENT: BLE Host Task Started', timeout=30) | ||
peripheral.expect('Returned from app_main()', timeout=30) | ||
central.expect('Returned from app_main()', timeout=30) | ||
central.expect('Connection established', timeout=30) | ||
peripheral.expect('connection established; status=0', timeout=30) | ||
output = peripheral.expect(pexpect.TIMEOUT, timeout=30) | ||
assert 'rst:' not in str(output) and 'boot:' not in str(output) | ||
|
||
|
||
# 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'), | ||
], | ||
indirect=True, | ||
) | ||
def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: | ||
peripheral = dut[0] | ||
central = dut[1] | ||
|
||
peripheral.expect('NimBLE_BLE_PRPH: BLE Host Task Started', timeout=5) | ||
central.expect('NimBLE_BLE_CENT: BLE Host Task Started', timeout=5) | ||
peripheral.expect('Returned from app_main()', timeout=5) | ||
central.expect('Returned from app_main()', timeout=5) | ||
central.expect('Connection established', timeout=30) | ||
peripheral.expect('connection established; status=0', timeout=30) | ||
output = peripheral.expect(pexpect.TIMEOUT, timeout=30) | ||
assert 'rst:' not in str(output) and 'boot:' not in str(output) |