-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(class/cdc): Add parsing host tests
- Loading branch information
1 parent
36956c2
commit 57b9613
Showing
16 changed files
with
1,231 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build and Run USB Host test | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * SAT' # Saturday midnight | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
idf_ver: ["latest"] | ||
runs-on: ubuntu-20.04 | ||
container: espressif/idf:${{ matrix.idf_ver }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Build USB Test Application | ||
shell: bash | ||
run: | | ||
. ${IDF_PATH}/export.sh | ||
pip install pytest pytest-cpp idf-build-apps==2.4.3 --upgrade | ||
idf-build-apps find --target linux | ||
idf-build-apps build --target linux | ||
pytest host/class/cdc/usb_host_cdc_acm/host_test/build_linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
set(COMPONENTS main) | ||
|
||
list(APPEND EXTRA_COMPONENT_DIRS | ||
"$ENV{IDF_PATH}/tools/mocks/usb/" | ||
"$ENV{IDF_PATH}/tools/mocks/freertos/" | ||
) | ||
|
||
project(host_test_usb_cdc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
| Supported Targets | Linux | | ||
| ----------------- | ----- | | ||
|
||
# Description | ||
|
||
This directory contains test code for `USB Host CDC-ACM` driver. Namely: | ||
* Descriptor parsing | ||
|
||
Tests are written using [Catch2](https://github.com/catchorg/Catch2) test framework, use CMock, so you must install Ruby on your machine to run them. | ||
|
||
# Build | ||
|
||
Tests build regularly like an idf project. Currently only working on Linux machines. | ||
|
||
``` | ||
idf.py --preview set-target linux | ||
idf.py build | ||
``` | ||
|
||
# Run | ||
|
||
The build produces an executable in the build folder. | ||
|
||
Just run: | ||
|
||
``` | ||
./build/host_test_usb_cdc.elf | ||
``` | ||
|
||
The test executable have some options provided by the test framework. |
9 changes: 9 additions & 0 deletions
9
host/class/cdc/usb_host_cdc_acm/host_test/main/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
idf_component_register(SRC_DIRS . | ||
REQUIRES cmock usb | ||
INCLUDE_DIRS . | ||
PRIV_INCLUDE_DIRS "../../private_include" | ||
WHOLE_ARCHIVE) | ||
|
||
# Currently 'main' for IDF_TARGET=linux is defined in freertos component. | ||
# Since we are using a freertos mock here, need to let Catch2 provide 'main'. | ||
target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain) |
Oops, something went wrong.