Skip to content

Commit 555981e

Browse files
authored
Merge pull request #12498 from jamesbeyond/usb_test
TEST: update usb tests and guard them with macro
2 parents 3739ccd + 1bf3590 commit 555981e

File tree

7 files changed

+36
-8
lines changed

7 files changed

+36
-8
lines changed

TESTS/usb_device/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ No setup method has been verified for this platform.
6868
6969
## Running tests
7070
1. Plug both USB interfaces (*DAPLink* and *USB device*) to your host machine.
71-
1. Run tests:
71+
1. An addtional macro `USB_DEVICE_TESTS` is needed to be defined when runing tests:
7272
```
73-
mbed test -t <toolchain> -m <target> -n tests-usb_device-*
73+
mbed test -t <toolchain> -m <target> -DUSB_DEVICE_TESTS -n tests-usb_device-*
7474
```
7575
7676
## Known issues

TESTS/usb_device/basic/USBEndpointTester.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2018, ARM Limited, All Rights Reserved
2+
* Copyright (c) 2018-2020, ARM Limited, All Rights Reserved
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
#if USB_DEVICE_TESTS
19+
1820
#if defined(MBED_CONF_RTOS_PRESENT)
1921

2022
#include "stdint.h"
@@ -863,3 +865,4 @@ void USBEndpointTester::start_ep_in_abort_test()
863865
write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet);
864866
}
865867
#endif
868+
#endif //USB_DEVICE_TESTS

TESTS/usb_device/basic/USBTester.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2018, ARM Limited, All Rights Reserved
2+
* Copyright (c) 2018-2020, ARM Limited, All Rights Reserved
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
#if USB_DEVICE_TESTS
19+
1820
#if defined(MBED_CONF_RTOS_PRESENT)
1921

2022
#include "stdint.h"
@@ -705,3 +707,4 @@ void USBTester::epbulk_out_callback()
705707
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
706708
}
707709
#endif
710+
#endif //USB_DEVICE_TESTS

TESTS/usb_device/basic/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2018, ARM Limited, All Rights Reserved
2+
* Copyright (c) 2018-2020, ARM Limited, All Rights Reserved
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -15,6 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18+
#if !USB_DEVICE_TESTS
19+
#error [NOT_SUPPORTED] usb device tests not enabled
20+
#else
21+
1822
#if !defined(MBED_CONF_RTOS_PRESENT)
1923
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
2024
#else
@@ -666,3 +670,4 @@ int main()
666670

667671
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
668672
#endif // !defined(MBED_CONF_RTOS_PRESENT)
673+
#endif // !defined(USB_DEVICE_TESTS)

TESTS/usb_device/hid/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
2+
* Copyright (c) 2018-2020, ARM Limited, All Rights Reserved
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -14,6 +14,11 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
18+
#if !USB_DEVICE_TESTS
19+
#error [NOT_SUPPORTED] usb device tests not enabled
20+
#else
21+
1722
#if !defined(MBED_CONF_RTOS_PRESENT)
1823
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
1924
#else
@@ -389,3 +394,4 @@ int main()
389394

390395
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
391396
#endif // !defined(MBED_CONF_RTOS_PRESENT)
397+
#endif // !defined(USB_DEVICE_TESTS)

TESTS/usb_device/msd/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Arm Limited and affiliates.
2+
* Copyright (c) 2019-2020, Arm Limited and affiliates.
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,6 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18+
#if !USB_DEVICE_TESTS
19+
#error [NOT_SUPPORTED] usb device tests not enabled
20+
#else
21+
1822
#if !defined(MBED_CONF_RTOS_PRESENT)
1923
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
2024
#else
@@ -488,3 +492,4 @@ int main()
488492

489493
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
490494
#endif // !defined(MBED_CONF_RTOS_PRESENT)
495+
#endif // !defined(USB_DEVICE_TESTS)

TESTS/usb_device/serial/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
2+
* Copyright (c) 2018-2020, ARM Limited, All Rights Reserved
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -14,6 +14,11 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
18+
#if !USB_DEVICE_TESTS
19+
#error [NOT_SUPPORTED] usb device tests not enabled
20+
#else
21+
1722
#if !defined(MBED_CONF_RTOS_PRESENT)
1823
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
1924
#else
@@ -853,3 +858,4 @@ int main()
853858

854859
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
855860
#endif // !defined(MBED_CONF_RTOS_PRESENT)
861+
#endif // !defined(USB_DEVICE_TESTS)

0 commit comments

Comments
 (0)