From e69f473198ca53791da9e84538f5807468549dcf Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Thu, 11 Aug 2022 14:10:58 +0200 Subject: [PATCH] usb_host: Remove custom test_app --- .gitlab/ci/target-test.yml | 8 ---- .../contribute/esp-idf-tests-with-pytest.rst | 2 - .../test_apps/peripherals/usb/CMakeLists.txt | 11 ----- tools/test_apps/peripherals/usb/README.md | 26 ----------- .../peripherals/usb/main/CMakeLists.txt | 3 -- .../peripherals/usb/main/usb_test_main.c | 44 ------------------- .../peripherals/usb/pytest_usb_host.py | 40 ----------------- .../peripherals/usb/sdkconfig.defaults | 16 ------- 8 files changed, 150 deletions(-) delete mode 100644 tools/test_apps/peripherals/usb/CMakeLists.txt delete mode 100644 tools/test_apps/peripherals/usb/README.md delete mode 100644 tools/test_apps/peripherals/usb/main/CMakeLists.txt delete mode 100644 tools/test_apps/peripherals/usb/main/usb_test_main.c delete mode 100644 tools/test_apps/peripherals/usb/pytest_usb_host.py delete mode 100644 tools/test_apps/peripherals/usb/sdkconfig.defaults diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 2db8218cfb..57f2d1809d 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -373,14 +373,6 @@ test_app_test_pytest_esp32c3_generic: - build_pytest_test_apps_esp32c3 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: extends: - .pytest_test_apps_dir_template diff --git a/docs/en/contribute/esp-idf-tests-with-pytest.rst b/docs/en/contribute/esp-idf-tests-with-pytest.rst index d7cbc69f81..7f5eab1e5c 100644 --- a/docs/en/contribute/esp-idf-tests-with-pytest.rst +++ b/docs/en/contribute/esp-idf-tests-with-pytest.rst @@ -270,8 +270,6 @@ Advanced Examples Multi Dut Tests with the Same App """"""""""""""""""""""""""""""""" -This code example is taken from :idf_file:`pytest_usb_host.py `. - .. code:: python @pytest.mark.esp32s2 diff --git a/tools/test_apps/peripherals/usb/CMakeLists.txt b/tools/test_apps/peripherals/usb/CMakeLists.txt deleted file mode 100644 index 8451ba1d94..0000000000 --- a/tools/test_apps/peripherals/usb/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/tools/test_apps/peripherals/usb/README.md b/tools/test_apps/peripherals/usb/README.md deleted file mode 100644 index 245f71285a..0000000000 --- a/tools/test_apps/peripherals/usb/README.md +++ /dev/null @@ -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). diff --git a/tools/test_apps/peripherals/usb/main/CMakeLists.txt b/tools/test_apps/peripherals/usb/main/CMakeLists.txt deleted file mode 100644 index b25d15fabb..0000000000 --- a/tools/test_apps/peripherals/usb/main/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -idf_component_register(SRCS "usb_test_main.c" - INCLUDE_DIRS "" - REQUIRES unity driver usb) diff --git a/tools/test_apps/peripherals/usb/main/usb_test_main.c b/tools/test_apps/peripherals/usb/main/usb_test_main.c deleted file mode 100644 index a902b52b4c..0000000000 --- a/tools/test_apps/peripherals/usb/main/usb_test_main.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#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"); -} diff --git a/tools/test_apps/peripherals/usb/pytest_usb_host.py b/tools/test_apps/peripherals/usb/pytest_usb_host.py deleted file mode 100644 index d05b736625..0000000000 --- a/tools/test_apps/peripherals/usb/pytest_usb_host.py +++ /dev/null @@ -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") diff --git a/tools/test_apps/peripherals/usb/sdkconfig.defaults b/tools/test_apps/peripherals/usb/sdkconfig.defaults deleted file mode 100644 index bab404d696..0000000000 --- a/tools/test_apps/peripherals/usb/sdkconfig.defaults +++ /dev/null @@ -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