ci(esp_eth): added tests of all supported Etherent chips

This commit is contained in:
Ondrej 2023-10-09 09:47:32 +00:00
parent a93d53aadb
commit 3a3656ba38
10 changed files with 161 additions and 55 deletions

View File

@ -225,13 +225,3 @@ build:integration_test:
"labels:nvs_coverage": # host_test
labels:
- nvs_coverage
"labels-protected:lan8720": # UT # FIXME: IDFCI-1176 temporary run this on master/release or with label
labels:
- lan8720
included_in:
- build:unit_test
- build:unit_test-esp32
- build:target_test
- build:component_ut
- build:component_ut-esp32

View File

@ -606,9 +606,6 @@
.if-label-integration_test_wifi: &if-label-integration_test_wifi
if: '$BOT_LABEL_INTEGRATION_TEST_WIFI || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_wifi(?:,[^,\n\r]+)*$/i'
.if-label-lan8720: &if-label-lan8720
if: '$BOT_LABEL_LAN8720 || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*lan8720(?:,[^,\n\r]+)*$/i'
.if-label-macos: &if-label-macos
if: '$BOT_LABEL_MACOS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*macos(?:,[^,\n\r]+)*$/i'
@ -694,7 +691,6 @@
- <<: *if-label-component_ut_esp32p4
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-lan8720
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
@ -742,7 +738,6 @@
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-lan8720
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
@ -1641,7 +1636,6 @@
- <<: *if-label-integration_test
- <<: *if-label-integration_test_ble
- <<: *if-label-integration_test_wifi
- <<: *if-label-lan8720
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
@ -1719,7 +1713,6 @@
when: never
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-lan8720
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
@ -1753,7 +1746,6 @@
when: never
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-lan8720
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
@ -1956,13 +1948,6 @@
- <<: *if-dev-push
changes: *patterns-unit_test-sdio
.rules:labels-protected:lan8720:
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected
- <<: *if-label-lan8720
.rules:labels:nvs_coverage:
rules:
- <<: *if-revert-branch

View File

@ -670,10 +670,51 @@ pytest_components_esp32_ip101:
pytest_components_esp32_lan8720:
extends:
- .pytest_components_dir_template
- .rules:labels-protected:lan8720 # FIXME: IDFCI-1176
needs:
- build_pytest_components_esp32
tags: [ esp32, lan8720 ]
tags: [ esp32, eth_lan8720 ]
pytest_components_esp32_rtl8201:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_rtl8201 ]
pytest_components_esp32_w5500:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_w5500 ]
pytest_components_esp32_ksz8851snl:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_ksz8851snl ]
pytest_components_esp32_dm9051:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_dm9051 ]
pytest_components_esp32_ksz8041:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_ksz8041 ]
pytest_components_esp32_dp83848:
extends:
- .pytest_components_dir_template
needs:
- build_pytest_components_esp32
tags: [ esp32, eth_dp83848 ]
pytest_components_esp32_ethernet:
extends:

View File

@ -4,3 +4,5 @@ components/esp_eth/test_apps:
enable:
- if: IDF_TARGET == "esp32"
reason: only test on esp32
depends_components:
- esp_eth

View File

@ -76,7 +76,7 @@ menu "esp_eth TEST_APPS Configuration"
config TARGET_SPI_CLOCK_MHZ
int "SPI clock speed (MHz)"
range 5 80
default 12
default 20
help
Set the clock speed (MHz) of SPI interface.

View File

@ -243,7 +243,18 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
TEST_CASE("ethernet start/stop stress test under heavy traffic", "[ethernet_l2]")
{
// *** SPI Ethernet modules deviation ***
// Rationale: The SPI bus is bottleneck when reading received frames from the module. The Rx Task would
// occupy all the resources under heavy Rx traffic and it would not be possible to access
// the Ethernet module to stop it. Therfore, the Rx task priority is set lower than "test" task
// to be able to be preempted.
#if CONFIG_TARGET_USE_SPI_ETHERNET
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.rx_task_prio = uxTaskPriorityGet(NULL) - 1;
esp_eth_mac_t *mac = mac_init(NULL, &mac_config);
#else
esp_eth_mac_t *mac = mac_init(NULL, NULL);
#endif // CONFIG_TARGET_USE_SPI_ETHERNET
TEST_ASSERT_NOT_NULL(mac);
esp_eth_phy_t *phy = phy_init(NULL);
TEST_ASSERT_NOT_NULL(phy);
@ -292,8 +303,13 @@ TEST_CASE("ethernet start/stop stress test under heavy traffic", "[ethernet_l2]"
// this also serves as main PASS/FAIL criteria
poke_and_wait(eth_handle, &tx_i, sizeof(tx_i), eth_event_rx_group);
// generate heavy Tx traffic
// *** SPI Ethernet modules deviation ***
// Rationale: Transmit errors are expected only for internal EMAC since it is possible to try to queue more
// data than it is able to process at a time.
#if !CONFIG_TARGET_USE_SPI_ETHERNET
printf("Note: transmit errors are expected...\n");
#endif
// generate heavy Tx traffic
for (int j = 0; j < 150; j++) {
// return value is not checked on purpose since it is expected that it may fail time to time because
// we may try to queue more packets than hardware is able to handle

View File

@ -9,7 +9,7 @@ from multiprocessing import Pipe, Process, connection
from typing import Iterator
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf import IdfDut
from scapy.all import Ether, raw
ETH_TYPE = 0x3300
@ -24,6 +24,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/')
netifs.sort(reverse=True)
logging.info('detected interfaces: %s', str(netifs))
for netif in netifs:
@ -100,25 +101,15 @@ class EthTestIntf(object):
raise e
def ethernet_test(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('\n')
dut.expect_exact('Enter test for running.')
dut.write('[ethernet]')
dut.expect_unity_test_output(timeout=980)
def ethernet_test(dut: IdfDut) -> None:
dut.run_all_single_board_cases(group='ethernet', timeout=980)
def ethernet_int_emac_hal_test(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('\n')
dut.expect_exact('Enter test for running.')
dut.write('[emac_hal]')
dut.expect_unity_test_output()
def ethernet_int_emac_hal_test(dut: IdfDut) -> None:
dut.run_all_single_board_cases(group='emac_hal')
def ethernet_l2_test(dut: Dut) -> None:
def ethernet_l2_test(dut: IdfDut) -> None:
target_if = EthTestIntf(ETH_TYPE)
dut.expect_exact('Press ENTER to see the list of tests')
@ -159,7 +150,7 @@ def ethernet_l2_test(dut: Dut) -> None:
# (there might be slight delay due to the RSTP execution)
target_if.recv_resp_poke(mac=dut_mac)
target_if.send_eth_packet('ff:ff:ff:ff:ff:ff') # broadcast frame
target_if.send_eth_packet('01:00:00:00:00:00') # multicast frame
target_if.send_eth_packet('01:00:5e:00:00:00') # IPv4 multicast frame (some SPI Eth modules filter multicast other than IP)
target_if.send_eth_packet(mac=dut_mac) # unicast frame
dut.expect_unity_test_output(extra_before=res.group(1))
@ -189,6 +180,7 @@ def ethernet_l2_test(dut: Dut) -> None:
dut.expect_unity_test_output(extra_before=res.group(1))
# ----------- IP101 -----------
@pytest.mark.esp32
@pytest.mark.ethernet
@pytest.mark.parametrize('config', [
@ -197,7 +189,7 @@ def ethernet_l2_test(dut: Dut) -> None:
'single_core_ip101'
], indirect=True)
@pytest.mark.flaky(reruns=3, reruns_delay=5)
def test_esp_ethernet(dut: Dut) -> None:
def test_esp_ethernet(dut: IdfDut) -> None:
ethernet_test(dut)
@ -206,7 +198,7 @@ def test_esp_ethernet(dut: Dut) -> None:
@pytest.mark.parametrize('config', [
'default_ip101',
], indirect=True)
def test_esp_emac_hal(dut: Dut) -> None:
def test_esp_emac_hal(dut: IdfDut) -> None:
ethernet_int_emac_hal_test(dut)
@ -215,14 +207,89 @@ def test_esp_emac_hal(dut: Dut) -> None:
@pytest.mark.parametrize('config', [
'default_ip101',
], indirect=True)
def test_esp_eth_ip101(dut: Dut) -> None:
def test_esp_eth_ip101(dut: IdfDut) -> None:
ethernet_l2_test(dut)
# ----------- LAN8720 -----------
@pytest.mark.esp32
@pytest.mark.lan8720
@pytest.mark.eth_lan8720
@pytest.mark.parametrize('config', [
'default_lan8720',
], indirect=True)
def test_esp_eth_lan8720(dut: Dut) -> None:
def test_esp_eth_lan8720(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- RTL8201 -----------
@pytest.mark.esp32
@pytest.mark.eth_rtl8201
@pytest.mark.parametrize('config', [
'default_rtl8201',
], indirect=True)
def test_esp_eth_rtl8201(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- KSZ8041 -----------
@pytest.mark.esp32
@pytest.mark.eth_ksz8041
@pytest.mark.parametrize('config', [
'default_ksz8041',
], indirect=True)
def test_esp_eth_ksz8041(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- DP83848 -----------
@pytest.mark.esp32
@pytest.mark.eth_dp83848
@pytest.mark.parametrize('config', [
'default_dp83848',
], indirect=True)
def test_esp_eth_dp83848(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- W5500 -----------
@pytest.mark.esp32
@pytest.mark.eth_w5500
@pytest.mark.parametrize('config', [
'default_w5500',
], indirect=True)
def test_esp_eth_w5500(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- KSZ8851SNL -----------
@pytest.mark.esp32
@pytest.mark.eth_ksz8851snl
@pytest.mark.parametrize('config', [
'default_ksz8851snl',
], indirect=True)
def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)
# ----------- DM9051 -----------
@pytest.mark.esp32
@pytest.mark.eth_dm9051
@pytest.mark.parametrize('config', [
'default_dm9051',
], indirect=True)
def test_esp_eth_dm9051(dut: IdfDut) -> None:
ethernet_test(dut)
dut.serial.hard_reset()
ethernet_l2_test(dut)

View File

@ -7,3 +7,5 @@ CONFIG_ESP_TASK_WDT=n
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
CONFIG_TARGET_ETH_PHY_DEVICE_DP83848=y
CONFIG_ETH_RMII_CLK_OUTPUT=y
CONFIG_ETH_RMII_CLK_OUT_GPIO=17

View File

@ -7,5 +7,3 @@ CONFIG_ESP_TASK_WDT=n
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
CONFIG_TARGET_ETH_PHY_DEVICE_KSZ80XX=y
CONFIG_ETH_RMII_CLK_OUTPUT=y
CONFIG_ETH_RMII_CLK_OUT_GPIO=17

View File

@ -43,7 +43,13 @@ ENV_MARKERS = {
'generic': 'tests should be run on generic runners',
'flash_suspend': 'support flash suspend feature',
'ip101': 'connected via wired 10/100M ethernet',
'lan8720': 'connected via LAN8720 ethernet transceiver',
'eth_lan8720': 'connected via LAN8720 ethernet transceiver',
'eth_rtl8201': 'connected via RTL8201 ethernet transceiver',
'eth_ksz8041': 'connected via KSZ8041 ethernet transceiver',
'eth_dp83848': 'connected via DP83848 ethernet transceiver',
'eth_w5500': 'SPI Ethernet module with two W5500',
'eth_ksz8851snl': 'SPI Ethernet module with two KSZ8851SNL',
'eth_dm9051': 'SPI Ethernet module with two DM9051',
'quad_psram': 'runners with quad psram',
'octal_psram': 'runners with octal psram',
'usb_host': 'usb host runners',
@ -87,7 +93,6 @@ ENV_MARKERS = {
'esp32eco3': 'Runner with esp32 eco3 connected',
'ecdsa_efuse': 'Runner with test ECDSA private keys programmed in efuse',
'ccs811': 'Runner with CCS811 connected',
'eth_w5500': 'SPI Ethernet module with two W5500',
'nvs_encr_hmac': 'Runner with test HMAC key programmed in efuse',
'i2c_oled': 'Runner with ssd1306 I2C oled connected',
'httpbin': 'runner for tests that need to access the httpbin service',