Merge pull request #12498 from jamesbeyond/usb_test

TEST: update usb tests and guard them with macro
pull/12526/head
Martin Kojtal 2020-02-27 08:52:30 +00:00 committed by GitHub
commit 555981e522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 8 deletions

View File

@ -68,9 +68,9 @@ No setup method has been verified for this platform.
## Running tests ## Running tests
1. Plug both USB interfaces (*DAPLink* and *USB device*) to your host machine. 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 ## Known issues

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,6 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
#if USB_DEVICE_TESTS
#if defined(MBED_CONF_RTOS_PRESENT) #if defined(MBED_CONF_RTOS_PRESENT)
#include "stdint.h" #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); write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet);
} }
#endif #endif
#endif //USB_DEVICE_TESTS

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,6 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
#if USB_DEVICE_TESTS
#if defined(MBED_CONF_RTOS_PRESENT) #if defined(MBED_CONF_RTOS_PRESENT)
#include "stdint.h" #include "stdint.h"
@ -705,3 +707,4 @@ void USBTester::epbulk_out_callback()
read_start(bulk_out, bulk_buf, sizeof(bulk_buf)); read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
} }
#endif #endif
#endif //USB_DEVICE_TESTS

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,6 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else
#if !defined(MBED_CONF_RTOS_PRESENT) #if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. #error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else #else
@ -666,3 +670,4 @@ int main()
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else
#if !defined(MBED_CONF_RTOS_PRESENT) #if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. #error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else #else
@ -389,3 +394,4 @@ int main()
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -15,6 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else
#if !defined(MBED_CONF_RTOS_PRESENT) #if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. #error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else #else
@ -488,3 +492,4 @@ int main()
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#if !USB_DEVICE_TESTS
#error [NOT_SUPPORTED] usb device tests not enabled
#else
#if !defined(MBED_CONF_RTOS_PRESENT) #if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. #error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else #else
@ -853,3 +858,4 @@ int main()
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)
#endif // !defined(USB_DEVICE_TESTS)