refactor(usb): Rename mock class files

- Rename "test_usb_mock_..." class files to "mock_..."
- Fixed some codespell issues
- Fixed comment spacing
This commit is contained in:
Darian Leung
2024-05-07 05:17:16 +08:00
parent 6d5d4f8fc1
commit 94e3b83bc0
23 changed files with 408 additions and 406 deletions

View File

@ -1,4 +1,4 @@
[codespell]
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight
write-changes = true

View File

@ -1,3 +1,5 @@
idf_component_register(SRCS "test_usb_common.c" "test_usb_mock_msc.c" "test_usb_mock_hid.c"
idf_component_register(SRCS "mock_hid.c"
"mock_msc.c"
"test_usb_common.c"
INCLUDE_DIRS "."
REQUIRES usb unity)

View File

@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
#include "usb/usb_types_ch9.h"
#include "test_usb_mock_hid.h"
#include "mock_hid.h"
// ---------------------------------------------------- HID Mouse ------------------------------------------------------

View File

@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
#include "usb/usb_types_ch9.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
// ---------------------------------------------------- MSC SCSI -------------------------------------------------------

View File

@ -9,7 +9,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "unity.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "test_hcd_common.h"
// --------------------------------------------------- Test Cases ------------------------------------------------------

View File

@ -19,7 +19,7 @@
#include "usb/usb_types_ch9.h"
#include "test_hcd_common.h"
#include "test_usb_common.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "unity.h"
#include "esp_dma_utils.h"

View File

@ -150,7 +150,7 @@ TEST_CASE("Test HCD control pipe STALL", "[ctrl][full_speed]")
int num_enqueued = 0;
for (int i = 0; i < NUM_URBS; i++) {
if (hcd_urb_enqueue(default_pipe, urb_list[i]) != ESP_OK) {
//STALL may occur before we are done enqueing
// STALL may occur before we are done enqueuing
break;
}
num_enqueued++;

View File

@ -8,8 +8,8 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "unity.h"
#include "test_usb_mock_msc.h"
#include "test_usb_mock_hid.h"
#include "mock_msc.h"
#include "mock_hid.h"
#include "test_hcd_common.h"
// --------------------------------------------------- Test Cases ------------------------------------------------------

View File

@ -10,7 +10,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "unity.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "test_usb_common.h"
#include "test_hcd_common.h"

View File

@ -7,5 +7,5 @@ There are two sets of tests in this application:
1. Low-speed: Expects low-speed USB mouse with interrupt endpoint to be connected
2. Full-speed: Expects full-speed USB flash disk with 2 bulk endpoints to be connected
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [test_usb_mock_msc.h](../common/test_usb_mock_msc.h) and [test_usb_mock_hid.h](../common/test_usb_mock_hid.h).
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [mock_msc.h](../common/mock_msc.h) and [mock_hid.h](../common/mock_hid.h).

View File

@ -168,7 +168,7 @@ void ctrl_client_async_seq_task(void *arg)
}
case TEST_STAGE_DEV_CLOSE: {
ESP_LOGD(CTRL_CLIENT_TAG, "Close");
vTaskDelay(10); // Give USB Host Lib some time to process all trnsfers
vTaskDelay(10); // Give USB Host Lib some time to process all transfers
TEST_ASSERT_EQUAL(ESP_OK, usb_host_device_close(ctrl_obj.client_hdl, ctrl_obj.dev_hdl));
exit_loop = true;
break;

View File

@ -12,7 +12,7 @@
#include "freertos/task.h"
#include "esp_err.h"
#include "esp_log.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "test_usb_common.h"
#include "msc_client.h"
#include "usb/usb_host.h"

View File

@ -12,7 +12,7 @@
#include "freertos/task.h"
#include "esp_err.h"
#include "esp_log.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "test_usb_common.h"
#include "msc_client.h"
#include "usb/usb_host.h"
@ -157,7 +157,7 @@ void msc_client_async_enum_task(void *arg)
const usb_config_desc_t *config_desc;
const usb_config_desc_t *config_desc_ref = (const usb_config_desc_t *)mock_msc_scsi_config_desc;
TEST_ASSERT_EQUAL(ESP_OK, usb_host_get_active_config_descriptor(msc_obj.dev_hdl, &config_desc));
TEST_ASSERT_EQUAL_MESSAGE(config_desc_ref->wTotalLength, config_desc->wTotalLength, "Incorrent length of CFG descriptor");
TEST_ASSERT_EQUAL_MESSAGE(config_desc_ref->wTotalLength, config_desc->wTotalLength, "Incorrect length of CFG descriptor");
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(config_desc_ref, config_desc, config_desc_ref->wTotalLength, "Configuration descriptors do not match");
msc_obj.next_stage = TEST_STAGE_CHECK_STR_DESC;
skip_event_handling = true; // Need to execute TEST_STAGE_CHECK_STR_DESC

View File

@ -13,7 +13,7 @@
#include "esp_err.h"
#include "esp_log.h"
#include "test_usb_common.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "msc_client.h"
#include "usb/usb_host.h"
#include "unity.h"

View File

@ -11,7 +11,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "test_usb_common.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "usb/usb_host.h"
void setUp(void)

View File

@ -11,7 +11,7 @@
#include "esp_err.h"
#include "esp_intr_alloc.h"
#include "test_usb_common.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "msc_client.h"
#include "ctrl_client.h"
#include "usb/usb_host.h"

View File

@ -10,7 +10,7 @@
#include "esp_err.h"
#include "esp_intr_alloc.h"
#include "test_usb_common.h"
#include "test_usb_mock_msc.h"
#include "mock_msc.h"
#include "msc_client.h"
#include "ctrl_client.h"
#include "usb/usb_host.h"