mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci(esp_eth): enable Ethernet tests
This commit is contained in:
parent
c1cc22d245
commit
f732c3b7fd
@ -1,16 +1,18 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
from multiprocessing import Pipe, Process, connection
|
||||
from multiprocessing import connection
|
||||
from multiprocessing import Pipe
|
||||
from multiprocessing import Process
|
||||
from typing import Iterator
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf import IdfDut
|
||||
from scapy.all import Ether, raw
|
||||
from scapy.all import Ether
|
||||
from scapy.all import raw
|
||||
|
||||
ETH_TYPE = 0x3300
|
||||
|
||||
@ -24,6 +26,7 @@ class EthTestIntf(object):
|
||||
def find_target_if(self, my_if: str = '') -> None:
|
||||
# try to determine which interface to use
|
||||
netifs = os.listdir('/sys/class/net/')
|
||||
# order matters - ETH NIC with the highest number is connected to DUT on CI runner
|
||||
netifs.sort(reverse=True)
|
||||
logging.info('detected interfaces: %s', str(netifs))
|
||||
|
||||
@ -203,8 +206,7 @@ def test_esp_emac_hal(dut: IdfDut) -> None:
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.ip101
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32'], reason='runner under maintenance')
|
||||
@pytest.mark.eth_ip101
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ip101',
|
||||
], indirect=True)
|
||||
@ -215,7 +217,6 @@ def test_esp_eth_ip101(dut: IdfDut) -> None:
|
||||
# ----------- LAN8720 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_lan8720
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_lan8720',
|
||||
], indirect=True)
|
||||
@ -228,7 +229,6 @@ def test_esp_eth_lan8720(dut: IdfDut) -> None:
|
||||
# ----------- RTL8201 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_rtl8201
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_rtl8201',
|
||||
], indirect=True)
|
||||
@ -241,7 +241,6 @@ def test_esp_eth_rtl8201(dut: IdfDut) -> None:
|
||||
# ----------- KSZ8041 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_ksz8041
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ksz8041',
|
||||
], indirect=True)
|
||||
@ -254,7 +253,6 @@ def test_esp_eth_ksz8041(dut: IdfDut) -> None:
|
||||
# ----------- DP83848 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_dp83848
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_dp83848',
|
||||
], indirect=True)
|
||||
@ -267,7 +265,6 @@ def test_esp_eth_dp83848(dut: IdfDut) -> None:
|
||||
# ----------- W5500 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_w5500
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_w5500',
|
||||
], indirect=True)
|
||||
@ -280,7 +277,6 @@ def test_esp_eth_w5500(dut: IdfDut) -> None:
|
||||
# ----------- KSZ8851SNL -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_ksz8851snl
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_ksz8851snl',
|
||||
], indirect=True)
|
||||
@ -293,7 +289,6 @@ def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
|
||||
# ----------- DM9051 -----------
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.eth_dm9051
|
||||
@pytest.mark.nightly_run
|
||||
@pytest.mark.parametrize('config', [
|
||||
'default_dm9051',
|
||||
], indirect=True)
|
||||
|
@ -1,14 +1,15 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import ipaddress
|
||||
import logging
|
||||
import re
|
||||
import socket
|
||||
import subprocess
|
||||
import time
|
||||
from concurrent.futures import Future, ThreadPoolExecutor
|
||||
from typing import List, Union
|
||||
from concurrent.futures import Future
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import List
|
||||
from typing import Union
|
||||
|
||||
import netifaces
|
||||
import paramiko # type: ignore
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import os
|
||||
@ -10,7 +9,8 @@ from typing import Iterator
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from scapy.all import Ether, raw
|
||||
from scapy.all import Ether
|
||||
from scapy.all import raw
|
||||
|
||||
ETH_TYPE_1 = 0x2220
|
||||
ETH_TYPE_2 = 0x2221
|
||||
@ -22,6 +22,8 @@ def configure_eth_if(eth_type: int, target_if: str='') -> Iterator[socket.socket
|
||||
if target_if == '':
|
||||
# try to determine which interface to use
|
||||
netifs = os.listdir('/sys/class/net/')
|
||||
# order matters - ETH NIC with the highest number is connected to DUT on CI runner
|
||||
netifs.sort(reverse=True)
|
||||
logging.info('detected interfaces: %s', str(netifs))
|
||||
for netif in netifs:
|
||||
if netif.find('eth') == 0 or netif.find('enx') == 0 or netif.find('enp') == 0 or netif.find('eno') == 0:
|
||||
@ -100,8 +102,7 @@ def actual_test(dut: Dut) -> None:
|
||||
|
||||
|
||||
@pytest.mark.esp32 # internally tested using ESP32 with IP101 but may support all targets with SPI Ethernet
|
||||
@pytest.mark.ip101
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32'], reason='runner under maintenance')
|
||||
@pytest.mark.eth_ip101
|
||||
@pytest.mark.flaky(reruns=3, reruns_delay=5)
|
||||
def test_esp_netif_l2tap_example(dut: Dut) -> None:
|
||||
actual_test(dut)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
"""
|
||||
Pytest Related Constants. Don't import third-party packages here.
|
||||
"""
|
||||
@ -47,7 +46,7 @@ ENV_MARKERS = {
|
||||
# single-dut markers
|
||||
'generic': 'tests should be run on generic runners',
|
||||
'flash_suspend': 'support flash suspend feature',
|
||||
'ip101': 'connected via wired 10/100M ethernet',
|
||||
'eth_ip101': 'connected via IP101 ethernet transceiver',
|
||||
'eth_lan8720': 'connected via LAN8720 ethernet transceiver',
|
||||
'eth_rtl8201': 'connected via RTL8201 ethernet transceiver',
|
||||
'eth_ksz8041': 'connected via KSZ8041 ethernet transceiver',
|
||||
|
Loading…
x
Reference in New Issue
Block a user