Skip to content

Commit

Permalink
ci(usb_host): Run class driver test apps on esp32p4
Browse files Browse the repository at this point in the history
    - Enabled drivers CDC-ACM, HID, MSC, UVC
    - Added new usb_host esp32p4 CI runner
  • Loading branch information
peter-marcisovsky committed Dec 2, 2024
1 parent 5459ee9 commit 998b6f5
Show file tree
Hide file tree
Showing 20 changed files with 418 additions and 516 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/build_and_run_test_app_usb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,23 @@ jobs:
fail-fast: false
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "latest"]
idf_target: ["esp32s2"]
idf_target: ["esp32s2", "esp32p4"]
runner_tag: ["usb_host", "usb_device"]
exclude:
# Exclude esp32p4 for releases before IDF 5.3 for all runner tags (esp32p4 support starts in IDF 5.3)
- idf_ver: "release-v5.0"
idf_target: "esp32p4"
- idf_ver: "release-v5.1"
idf_target: "esp32p4"
- idf_ver: "release-v5.2"
idf_target: "esp32p4"
- idf_ver: "release-v5.3" # TODO: enable IDF 5.3 once the docker image is updated
idf_target: "esp32p4"

# Exclude esp32p4 for all versions when using the usb_device runner
- idf_target: "esp32p4" # TODO: esp32p4 usb_device runner not built yet
runner_tag: "usb_device"

runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"]
container:
image: python:3.11-bookworm
Expand Down
3 changes: 3 additions & 0 deletions host/class/cdc/usb_host_cdc_acm/test_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ It tests basic functionality of the driver like open/close/read/write operations

### Hardware Required

This test requires two ESP32 development board with USB-OTG support. The development boards shall have interconnected USB peripherals,
one acting as host running CDC-ACM host driver and another CDC-ACM device driver (tinyusb).

This test expects that TinyUSB dual CDC device with VID = 0x303A and PID = 0x4002 is connected to the USB host.
36 changes: 10 additions & 26 deletions host/class/cdc/usb_host_cdc_acm/test_app/main/test_app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
#include <stdio.h>
#include <string.h>
#include "unity.h"
#include "esp_heap_caps.h"
#include "unity_test_runner.h"
#include "unity_test_utils_memory.h"

static size_t before_free_8bit;
static size_t before_free_32bit;
void setUp(void)
{
unity_utils_record_free_mem();
}

#define TEST_MEMORY_LEAK_THRESHOLD (-530)
static void check_leak(size_t before_free, size_t after_free, const char *type)
void tearDown(void)
{
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");
unity_utils_evaluate_leaks();
}

void app_main(void)
Expand All @@ -35,23 +35,7 @@ void app_main(void)
printf("|______/ /_______ / |______ / |__| \\___ >____ > |__| \r\n");
printf(" \\/ \\/ \\/ \\/ \r\n");

UNITY_BEGIN();
unity_utils_setup_heap_record(80);
unity_utils_set_leak_level(530);
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");
}
Loading

0 comments on commit 998b6f5

Please sign in to comment.