-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cdc_acm): mock open/close device #87
Conversation
96b95b0
to
937027f
Compare
There are 2 sub-folders for host tests now:
For this reason, the tests must have been regrouped |
c765ba2
to
803aaef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job @peter-marcisovsky !
host/class/cdc/usb_host_cdc_acm/host_test/parsing_tests/main/CMakeLists.txt
Outdated
Show resolved
Hide resolved
host/class/cdc/usb_host_cdc_acm/host_test/device_interaction/main/common_test_fixtures.hpp
Outdated
Show resolved
Hide resolved
host/class/cdc/usb_host_cdc_acm/host_test/device_interaction/main/test_opening_device.cpp
Show resolved
Hide resolved
CI failing, because we don't have the changes from First we merge |
7d5d5ca
to
16912b6
Compare
- Opening and closing mocked USB devices - Interaction with mocked USB devices
16912b6
to
ffdb0dc
Compare
Description
This MR, as a part of USB Class drivers testing, uses callback functions to some functions from
from usb_host.c
, used for device opening and closing.Cmock framework defines callbacks, as user-defined functions which are called whenever a certain mocked function is called, to which a callback function is registered to.
This is useful for us, for example, when we want to "open" a USB device during a class driver host test.
Since the whole USB stack is mocked,
usb_host_devcie_open
just calls an empty cmock function. But we can register a callback to theusb_host_devcie_open
function, which will "open" a mocked USB device. Once the USB device is opened, we can use it for further host testing.A developer must define USB devices he want's to have "connected" during a test case by himself, at the beginning of a host test case. One can do so by calling
usb_host_mock_add_device
and passing a device's device and config desc and a desired device address.Changes
test_device_opening.cpp
- We are testing device opening/closing itselftest_device_interaction.cpp
- We are testing interaction of already opened device with theCDC-ACM
drivermock_cdc_acm_host_install
mock_cdc_acm_host_uninstall
- Installs/UninstallsCDC-ACM
driver on mocked USB componentmock_cdc_acm_host_open
mock_cdc_acm_host_close
- Opens/Closes mocked CDC device in theCDC-ACM
drivermock_cdc_acm_host_data_tx_blocking
- Submits mocked transfer to already opened mocked deviceRelated
Testing
Checklist
Before submitting a Pull Request, please ensure the following: