From d657fa178b8b0d82352e427a1c4242a8d052d522 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Sat, 22 Feb 2020 21:11:56 +0000 Subject: [PATCH 1/3] TEST: Add USB_DEVICE_TESTS macro to guard usb test --- TESTS/usb_device/basic/USBEndpointTester.cpp | 3 +++ TESTS/usb_device/basic/USBTester.cpp | 3 +++ TESTS/usb_device/basic/main.cpp | 5 +++++ TESTS/usb_device/hid/main.cpp | 6 ++++++ TESTS/usb_device/msd/main.cpp | 5 +++++ TESTS/usb_device/serial/main.cpp | 6 ++++++ 6 files changed, 28 insertions(+) diff --git a/TESTS/usb_device/basic/USBEndpointTester.cpp b/TESTS/usb_device/basic/USBEndpointTester.cpp index 805039dc550..7c808a6b013 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.cpp +++ b/TESTS/usb_device/basic/USBEndpointTester.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#if USB_DEVICE_TESTS + #if defined(MBED_CONF_RTOS_PRESENT) #include "stdint.h" @@ -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 \ No newline at end of file diff --git a/TESTS/usb_device/basic/USBTester.cpp b/TESTS/usb_device/basic/USBTester.cpp index 584d52b1f07..34f261ca9f7 100644 --- a/TESTS/usb_device/basic/USBTester.cpp +++ b/TESTS/usb_device/basic/USBTester.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#if USB_DEVICE_TESTS + #if defined(MBED_CONF_RTOS_PRESENT) #include "stdint.h" @@ -705,3 +707,4 @@ void USBTester::epbulk_out_callback() read_start(bulk_out, bulk_buf, sizeof(bulk_buf)); } #endif +#endif //USB_DEVICE_TESTS \ No newline at end of file diff --git a/TESTS/usb_device/basic/main.cpp b/TESTS/usb_device/basic/main.cpp index 50f4e38ab9d..b39e83dd77d 100644 --- a/TESTS/usb_device/basic/main.cpp +++ b/TESTS/usb_device/basic/main.cpp @@ -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 @@ -666,3 +670,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) +#endif // !defined(MBED_CONF_RTOS_PRESENT) \ No newline at end of file diff --git a/TESTS/usb_device/hid/main.cpp b/TESTS/usb_device/hid/main.cpp index 7d62d41214d..f552f04ea75 100644 --- a/TESTS/usb_device/hid/main.cpp +++ b/TESTS/usb_device/hid/main.cpp @@ -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 @@ -389,3 +394,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) +#endif // !defined(USB_DEVICE_TESTS) \ No newline at end of file diff --git a/TESTS/usb_device/msd/main.cpp b/TESTS/usb_device/msd/main.cpp index 65297f86cdd..b8893e8e6a7 100644 --- a/TESTS/usb_device/msd/main.cpp +++ b/TESTS/usb_device/msd/main.cpp @@ -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 @@ -488,3 +492,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) +#endif // !defined(USB_DEVICE_TESTS) diff --git a/TESTS/usb_device/serial/main.cpp b/TESTS/usb_device/serial/main.cpp index 0068d26d3ae..83299d4b9a3 100644 --- a/TESTS/usb_device/serial/main.cpp +++ b/TESTS/usb_device/serial/main.cpp @@ -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 @@ -853,3 +858,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) +#endif // !defined(USB_DEVICE_TESTS) \ No newline at end of file From 70c5797a94b105db9fb6adeb29a4315eb82292a5 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Mon, 24 Feb 2020 12:25:38 +0000 Subject: [PATCH 2/3] TEST: update usb test README --- TESTS/usb_device/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TESTS/usb_device/README.md b/TESTS/usb_device/README.md index f1d3bc8c905..38f6bdbeab8 100644 --- a/TESTS/usb_device/README.md +++ b/TESTS/usb_device/README.md @@ -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 -m -n tests-usb_device-* + mbed test -t -m -DUSB_DEVICE_TESTS -n tests-usb_device-* ``` ## Known issues From 1bf35905876d9c45566504e42550838242c6c901 Mon Sep 17 00:00:00 2001 From: Qinghao Shi Date: Tue, 25 Feb 2020 16:26:21 +0000 Subject: [PATCH 3/3] TEST: update licenses and add an empty line in the end --- TESTS/usb_device/basic/USBEndpointTester.cpp | 4 ++-- TESTS/usb_device/basic/USBTester.cpp | 4 ++-- TESTS/usb_device/basic/main.cpp | 4 ++-- TESTS/usb_device/hid/main.cpp | 4 ++-- TESTS/usb_device/msd/main.cpp | 2 +- TESTS/usb_device/serial/main.cpp | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TESTS/usb_device/basic/USBEndpointTester.cpp b/TESTS/usb_device/basic/USBEndpointTester.cpp index 7c808a6b013..f3af42b75e0 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.cpp +++ b/TESTS/usb_device/basic/USBEndpointTester.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2018, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -865,4 +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 \ No newline at end of file +#endif //USB_DEVICE_TESTS diff --git a/TESTS/usb_device/basic/USBTester.cpp b/TESTS/usb_device/basic/USBTester.cpp index 34f261ca9f7..7f01ba16ae1 100644 --- a/TESTS/usb_device/basic/USBTester.cpp +++ b/TESTS/usb_device/basic/USBTester.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2018, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -707,4 +707,4 @@ void USBTester::epbulk_out_callback() read_start(bulk_out, bulk_buf, sizeof(bulk_buf)); } #endif -#endif //USB_DEVICE_TESTS \ No newline at end of file +#endif //USB_DEVICE_TESTS diff --git a/TESTS/usb_device/basic/main.cpp b/TESTS/usb_device/basic/main.cpp index b39e83dd77d..6403f6a8db3 100644 --- a/TESTS/usb_device/basic/main.cpp +++ b/TESTS/usb_device/basic/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2018, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -670,4 +670,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) -#endif // !defined(MBED_CONF_RTOS_PRESENT) \ No newline at end of file +#endif // !defined(USB_DEVICE_TESTS) diff --git a/TESTS/usb_device/hid/main.cpp b/TESTS/usb_device/hid/main.cpp index f552f04ea75..cd92070eb3f 100644 --- a/TESTS/usb_device/hid/main.cpp +++ b/TESTS/usb_device/hid/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -394,4 +394,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) -#endif // !defined(USB_DEVICE_TESTS) \ No newline at end of file +#endif // !defined(USB_DEVICE_TESTS) diff --git a/TESTS/usb_device/msd/main.cpp b/TESTS/usb_device/msd/main.cpp index b8893e8e6a7..88e99cb64e8 100644 --- a/TESTS/usb_device/msd/main.cpp +++ b/TESTS/usb_device/msd/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/TESTS/usb_device/serial/main.cpp b/TESTS/usb_device/serial/main.cpp index 83299d4b9a3..d8fdcdbb70b 100644 --- a/TESTS/usb_device/serial/main.cpp +++ b/TESTS/usb_device/serial/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2020, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -858,4 +858,4 @@ int main() #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(MBED_CONF_RTOS_PRESENT) -#endif // !defined(USB_DEVICE_TESTS) \ No newline at end of file +#endif // !defined(USB_DEVICE_TESTS)