mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
ci: Added esp32p4 usb tests to CI:
- added new test for usb_host_lib example for all targets - CI USB host test are run on esp32p4 - CI USB device tests temporarily disabled until usb_device runner is fixed - hcd and usb_host tests which do not require PHY are run on esp32p4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# 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 pytest
|
||||
from pytest_embedded import Dut
|
||||
@@ -13,6 +13,6 @@ def test_usb_device_msc_example(dut: Dut) -> None:
|
||||
dut.expect('Mount storage')
|
||||
dut.expect('TinyUSB Driver installed')
|
||||
dut.expect('USB MSC initialization DONE')
|
||||
dut.expect('esp32s2>')
|
||||
dut.expect(dut.target + '>')
|
||||
dut.write('status')
|
||||
dut.expect('storage exposed over USB')
|
||||
|
@@ -7,9 +7,12 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
def test_usb_host_msc_example(dut: Dut) -> None:
|
||||
# Get wMaxPacketSize to get USB device speed
|
||||
max_packet_size = int(dut.expect(r'wMaxPacketSize (\d{2,3})')[1].decode())
|
||||
|
||||
# Check result of file_operations()
|
||||
dut.expect_exact("example: Read from file '/usb/esp/test.txt': 'Hello World!'")
|
||||
|
||||
@@ -17,12 +20,20 @@ def test_usb_host_msc_example(dut: Dut) -> None:
|
||||
write_throughput = float(dut.expect(r'example: Write speed ([0-9]*[.]?[0-9]+) MiB')[1].decode())
|
||||
read_throughput = float(dut.expect(r'example: Read speed ([0-9]*[.]?[0-9]+) MiB')[1].decode())
|
||||
|
||||
# Set write and read throughput limits
|
||||
if (max_packet_size == 512): # wMaxPacketSize = 512 for HS
|
||||
write_throughput_limit = 4.9
|
||||
read_throughput_limit = 11.5
|
||||
else: # wMaxPacketSize = 64 for FS
|
||||
write_throughput_limit = 0.9
|
||||
read_throughput_limit = 1.0
|
||||
|
||||
# These values should be updated for HS targets
|
||||
if write_throughput > 0.9:
|
||||
if write_throughput > write_throughput_limit:
|
||||
print('Write throughput put OK')
|
||||
else:
|
||||
print('write throughput too slow!')
|
||||
if read_throughput > 1.0:
|
||||
if read_throughput > read_throughput_limit:
|
||||
print('Read throughput put OK')
|
||||
else:
|
||||
print('Read throughput too slow!')
|
||||
|
@@ -72,7 +72,9 @@ static void action_get_info(class_driver_t *driver_obj)
|
||||
ESP_LOGI(TAG, "Getting device information");
|
||||
usb_device_info_t dev_info;
|
||||
ESP_ERROR_CHECK(usb_host_device_info(driver_obj->dev_hdl, &dev_info));
|
||||
ESP_LOGI(TAG, "\t%s speed", (dev_info.speed == USB_SPEED_LOW) ? "Low" : "Full");
|
||||
ESP_LOGI(TAG, "\t%s speed", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[dev_info.speed]);
|
||||
ESP_LOGI(TAG, "\tbConfigurationValue %d", dev_info.bConfigurationValue);
|
||||
|
||||
//Get the device descriptor next
|
||||
|
@@ -0,0 +1,26 @@
|
||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
def test_usb_host_lib_example(dut: Dut) -> None:
|
||||
# register client
|
||||
dut.expect_exact('CLASS: Registering Client')
|
||||
|
||||
# expect device descriptor
|
||||
dut.expect_exact('CLASS: Getting device descriptor')
|
||||
|
||||
# confirm device descriptor
|
||||
dut.expect_exact('*** Device descriptor ***')
|
||||
|
||||
# expect configuration descriptor
|
||||
dut.expect_exact('CLASS: Getting config descriptor')
|
||||
|
||||
# confirm configuration descriptor
|
||||
dut.expect_exact('*** Configuration descriptor ***')
|
Reference in New Issue
Block a user