mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
usb_host: Remove custom test_app
This commit is contained in:
parent
c8585267ab
commit
e69f473198
@ -373,14 +373,6 @@ test_app_test_pytest_esp32c3_generic:
|
|||||||
- build_pytest_test_apps_esp32c3
|
- build_pytest_test_apps_esp32c3
|
||||||
tags: [ esp32c3, generic ]
|
tags: [ esp32c3, generic ]
|
||||||
|
|
||||||
test_app_test_pytest_esp32s2_usb_host:
|
|
||||||
extends:
|
|
||||||
- .pytest_test_apps_dir_template
|
|
||||||
- .rules:test:custom_test-esp32s2
|
|
||||||
needs:
|
|
||||||
- build_pytest_test_apps_esp32s2
|
|
||||||
tags: [ esp32s2, usb_host ]
|
|
||||||
|
|
||||||
test_app_test_pytest_esp32s3_mspi_f8r8:
|
test_app_test_pytest_esp32s3_mspi_f8r8:
|
||||||
extends:
|
extends:
|
||||||
- .pytest_test_apps_dir_template
|
- .pytest_test_apps_dir_template
|
||||||
|
@ -270,8 +270,6 @@ Advanced Examples
|
|||||||
Multi Dut Tests with the Same App
|
Multi Dut Tests with the Same App
|
||||||
"""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
This code example is taken from :idf_file:`pytest_usb_host.py <tools/test_apps/peripherals/usb/pytest_usb_host.py>`.
|
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
@pytest.mark.esp32s2
|
@pytest.mark.esp32s2
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# The following lines of boilerplate have to be in your project's
|
|
||||||
# CMakeLists in this exact order for cmake to work correctly
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/peripherals/usb/host/cdc/common
|
|
||||||
$ENV{IDF_PATH}/examples/peripherals/usb/host/msc/components/)
|
|
||||||
|
|
||||||
# Set the components to include the tests for.
|
|
||||||
set(TEST_COMPONENTS "cdc_acm_host" "msc" CACHE STRING "List of components to test")
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(usb_test_app)
|
|
@ -1,26 +0,0 @@
|
|||||||
| Supported Targets | ESP32-S2 | ESP32-S3 |
|
|
||||||
| ----------------- | -------- | -------- |
|
|
||||||
|
|
||||||
# USB Host Class driver test project
|
|
||||||
Main purpose of this application is to test the USB Host Class drivers.
|
|
||||||
|
|
||||||
## CDC-ACM driver
|
|
||||||
|
|
||||||
It tests basic functionality of the driver like open/close/read/write operations,
|
|
||||||
advanced features like CDC control request, multi-threaded or multi-device access,
|
|
||||||
as well as reaction to sudden disconnection and other error states.
|
|
||||||
|
|
||||||
### Hardware Required
|
|
||||||
|
|
||||||
This test expects that TinyUSB dual CDC device with VID = 0x303A and PID = 0x4002
|
|
||||||
is connected to the USB host.
|
|
||||||
|
|
||||||
## MSC driver
|
|
||||||
|
|
||||||
Basic functionality such as MSC device install/uninstall, file operatons,
|
|
||||||
raw access to MSC device and sudden disconnect is tested.
|
|
||||||
|
|
||||||
### Hardware Required
|
|
||||||
|
|
||||||
This test requires two ESP32-S2/S3 boards with a interconnected USB perpherals,
|
|
||||||
one acting as host running MSC host driver and another MSC device driver (tinyusb).
|
|
@ -1,3 +0,0 @@
|
|||||||
idf_component_register(SRCS "usb_test_main.c"
|
|
||||||
INCLUDE_DIRS ""
|
|
||||||
REQUIRES unity driver usb)
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "unity.h"
|
|
||||||
#include "esp_heap_caps.h"
|
|
||||||
|
|
||||||
static size_t before_free_8bit;
|
|
||||||
static size_t before_free_32bit;
|
|
||||||
|
|
||||||
#define TEST_MEMORY_LEAK_THRESHOLD (-10000) // @todo MSC test are leaking memory
|
|
||||||
static void check_leak(size_t before_free, size_t after_free, const char *type)
|
|
||||||
{
|
|
||||||
ssize_t delta = after_free - before_free;
|
|
||||||
printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta);
|
|
||||||
TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak");
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main(void)
|
|
||||||
{
|
|
||||||
UNITY_BEGIN();
|
|
||||||
unity_run_menu();
|
|
||||||
UNITY_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* setUp runs before every test */
|
|
||||||
void setUp(void)
|
|
||||||
{
|
|
||||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
|
||||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* tearDown runs after every test */
|
|
||||||
void tearDown(void)
|
|
||||||
{
|
|
||||||
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
|
||||||
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
|
||||||
check_leak(before_free_8bit, after_free_8bit, "8BIT");
|
|
||||||
check_leak(before_free_32bit, after_free_32bit, "32BIT");
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
from typing import Tuple
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from pytest_embedded_idf.dut import IdfDut
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.esp32s2
|
|
||||||
@pytest.mark.esp32s3
|
|
||||||
@pytest.mark.usb_host
|
|
||||||
@pytest.mark.parametrize('count', [
|
|
||||||
2,
|
|
||||||
], indirect=True)
|
|
||||||
def test_usb_host(dut: Tuple[IdfDut, IdfDut]) -> None:
|
|
||||||
device = dut[0]
|
|
||||||
host = dut[1]
|
|
||||||
|
|
||||||
# 1.1 Prepare USB device for CDC test
|
|
||||||
device.expect_exact('Press ENTER to see the list of tests.')
|
|
||||||
device.write('[cdc_acm_device]')
|
|
||||||
device.expect_exact('USB initialization DONE')
|
|
||||||
|
|
||||||
# 1.2 Run CDC test
|
|
||||||
host.expect_exact('Press ENTER to see the list of tests.')
|
|
||||||
host.write('[cdc_acm]')
|
|
||||||
host.expect_unity_test_output()
|
|
||||||
host.expect_exact("Enter next test, or 'enter' to see menu")
|
|
||||||
|
|
||||||
# 2.1 Prepare USB device for MSC test
|
|
||||||
device.serial.hard_reset()
|
|
||||||
device.expect_exact('Press ENTER to see the list of tests.')
|
|
||||||
device.write('[usb_msc_device]')
|
|
||||||
device.expect_exact('USB initialization DONE')
|
|
||||||
|
|
||||||
# 2.2 Run MSC test
|
|
||||||
host.write('[usb_msc]')
|
|
||||||
host.expect_unity_test_output()
|
|
||||||
host.expect_exact("Enter next test, or 'enter' to see menu")
|
|
@ -1,16 +0,0 @@
|
|||||||
# Configure TinyUSB, it will be used to mock USB devices
|
|
||||||
CONFIG_TINYUSB=y
|
|
||||||
CONFIG_TINYUSB_MSC_ENABLED=y
|
|
||||||
CONFIG_TINYUSB_CDC_ENABLED=y
|
|
||||||
CONFIG_TINYUSB_CDC_COUNT=2
|
|
||||||
|
|
||||||
# Disable watchdogs, they'd get triggered during unity interactive menu
|
|
||||||
CONFIG_ESP_INT_WDT=n
|
|
||||||
CONFIG_ESP_TASK_WDT=n
|
|
||||||
|
|
||||||
# Run-time checks of Heap and Stack
|
|
||||||
CONFIG_HEAP_POISONING_COMPREHENSIVE=y
|
|
||||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
|
||||||
CONFIG_COMPILER_STACK_CHECK=y
|
|
||||||
|
|
||||||
CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL=y
|
|
Loading…
x
Reference in New Issue
Block a user