Skip to content

TEST: update usb tests and guard them with macro #12498

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

Merged
merged 3 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TESTS/usb_device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ No setup method has been verified for this platform.

## Running tests
1. Plug both USB interfaces (*DAPLink* and *USB device*) to your host machine.
1. Run tests:
1. An addtional macro `USB_DEVICE_TESTS` is needed to be defined when runing tests:
```
mbed test -t <toolchain> -m <target> -n tests-usb_device-*
mbed test -t <toolchain> -m <target> -DUSB_DEVICE_TESTS -n tests-usb_device-*
```

## Known issues
Expand Down
3 changes: 3 additions & 0 deletions TESTS/usb_device/basic/USBEndpointTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#if USB_DEVICE_TESTS

#if defined(MBED_CONF_RTOS_PRESENT)

#include "stdint.h"
Expand Down Expand Up @@ -863,3 +865,4 @@ void USBEndpointTester::start_ep_in_abort_test()
write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet);
}
#endif
#endif //USB_DEVICE_TESTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of new line at the file end, Applies to all files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

3 changes: 3 additions & 0 deletions TESTS/usb_device/basic/USBTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#if USB_DEVICE_TESTS

#if defined(MBED_CONF_RTOS_PRESENT)

#include "stdint.h"
Expand Down Expand Up @@ -705,3 +707,4 @@ void USBTester::epbulk_out_callback()
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
}
#endif
#endif //USB_DEVICE_TESTS
5 changes: 5 additions & 0 deletions TESTS/usb_device/basic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* limitations under the License.
*/

#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
Expand Down Expand Up @@ -666,3 +670,4 @@ int main()

#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(MBED_CONF_RTOS_PRESENT)
6 changes: 6 additions & 0 deletions TESTS/usb_device/hid/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
Expand Down Expand Up @@ -389,3 +394,4 @@ int main()

#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)
5 changes: 5 additions & 0 deletions TESTS/usb_device/msd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* limitations under the License.
*/

#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
Expand Down Expand Up @@ -488,3 +492,4 @@ int main()

#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)
6 changes: 6 additions & 0 deletions TESTS/usb_device/serial/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
Expand Down Expand Up @@ -853,3 +858,4 @@ int main()

#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)