mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
test: format all test scripts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# 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 logging
|
||||
import os
|
||||
@@ -6,6 +6,7 @@ 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
|
||||
|
||||
|
||||
def _run_test(dut: Dut) -> None:
|
||||
@@ -27,41 +28,46 @@ def _run_test(dut: Dut) -> None:
|
||||
|
||||
# expect at least two packets (there could be lost packets)
|
||||
ip = dut.expect(r'64 bytes from (\d+\.\d+\.\d+\.\d+) icmp_seq=\d ttl=\d+ time=\d+ ms')[1].decode()
|
||||
dut.expect(fr'64 bytes from {ip} icmp_seq=[2-5] ttl=\d+ time=')
|
||||
dut.expect(rf'64 bytes from {ip} icmp_seq=[2-5] ttl=\d+ time=')
|
||||
|
||||
dut.expect(r'5 packets transmitted, [2-5] received, \d{1,3}% packet loss')
|
||||
dut.write('')
|
||||
dut.expect('esp>')
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c5
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32c61
|
||||
@pytest.mark.wifi_ap
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
['esp32', 'esp32c2', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c5', 'esp32c6', 'esp32c61'],
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_protocols_icmp_echo(dut: Dut) -> None:
|
||||
_run_test(dut)
|
||||
|
||||
|
||||
@pytest.mark.esp32c2
|
||||
@pytest.mark.wifi_ap
|
||||
@pytest.mark.xtal_26mhz
|
||||
@pytest.mark.parametrize(
|
||||
'config, baud', [
|
||||
'config, baud',
|
||||
[
|
||||
('c2_xtal26m', '74880'),
|
||||
], indirect=True
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
|
||||
def test_protocols_icmp_echo_esp32c2_26mhz(dut: Dut) -> None:
|
||||
_run_test(dut)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.wifi_router
|
||||
@pytest.mark.parametrize('config', ['ipv6_only',], indirect=True)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'ipv6_only',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_protocols_icmp_echo_ipv6_only(dut: Dut) -> None:
|
||||
# Parse IP address of STA
|
||||
logging.info('Waiting to connect with AP')
|
||||
@@ -82,7 +88,7 @@ def test_protocols_icmp_echo_ipv6_only(dut: Dut) -> None:
|
||||
|
||||
# expect at least two packets (there could be lost packets)
|
||||
ip = dut.expect(r'64 bytes from ([0-9a-fA-F:]+) icmp_seq=\d ttl=\d+ time=\d+ ms')[1].decode()
|
||||
dut.expect(fr'64 bytes from {ip} icmp_seq=[2-5] ttl=\d+ time=')
|
||||
dut.expect(rf'64 bytes from {ip} icmp_seq=[2-5] ttl=\d+ time=')
|
||||
|
||||
dut.expect(r'5 packets transmitted, [2-5] received, \d{1,3}% packet loss')
|
||||
dut.write('')
|
||||
|
Reference in New Issue
Block a user