Skip to content

Commit e1a1542

Browse files
author
Jamie Smith
authored
Reactivate tests under drivers/ and fix deprecation warnings (#191)
* Reactivate tests under drivers/ and fix deprecation warnings * Fix missing statement * Oops, fix commented tests
1 parent eee0647 commit e1a1542

File tree

36 files changed

+312
-343
lines changed

36 files changed

+312
-343
lines changed

drivers/include/drivers/Watchdog.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "hal/watchdog_api.h"
2727
#include "platform/NonCopyable.h"
2828
#include <cstdio>
29+
#include <chrono>
2930

3031
namespace mbed {
3132
/**
@@ -92,7 +93,7 @@ class Watchdog : private NonCopyable<Watchdog> {
9293

9394
/** Start the Watchdog timer.
9495
*
95-
* @note Asset that the timeout param is supported by the target
96+
* @note Asserts that the timeout param is supported by the target
9697
* (0 < timeout <= Watchdog::get_max_timeout).
9798
*
9899
* @param timeout Watchdog timeout in milliseconds.
@@ -103,6 +104,22 @@ class Watchdog : private NonCopyable<Watchdog> {
103104
*/
104105
bool start(uint32_t timeout);
105106

107+
/** Start the Watchdog timer.
108+
*
109+
* @note Asserts that the timeout param is supported by the target
110+
* (0 < timeout <= Watchdog::get_max_timeout).
111+
*
112+
* @param timeout Watchdog timeout in chrono milliseconds.
113+
*
114+
* @return true if the Watchdog timer was started successfully;
115+
* false if Watchdog timer was not started or if setting
116+
* a new watchdog timeout was not possible.
117+
*/
118+
bool start(std::chrono::milliseconds timeout)
119+
{
120+
return start(timeout.count());
121+
}
122+
106123
/** Stop the Watchdog timer.
107124
*
108125
* Calling this function disables a running Watchdog

drivers/tests/TESTS/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_subdirectory(mbed_drivers/ticker)
4+
add_subdirectory(mbed_drivers)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
add_subdirectory(buffered_serial)
2+
add_subdirectory(c_strings)
3+
add_subdirectory(crc)
4+
add_subdirectory(dev_null)
5+
add_subdirectory(echo)
6+
add_subdirectory(flashiap)
7+
add_subdirectory(generic_tests)
8+
add_subdirectory(lp_ticker)
9+
add_subdirectory(lp_timeout)
10+
add_subdirectory(lp_timer)
11+
add_subdirectory(mem_trace)
12+
add_subdirectory(race_test)
13+
add_subdirectory(reset_reason)
14+
add_subdirectory(sleep_lock)
15+
add_subdirectory(stl_features)
16+
add_subdirectory(ticker)
17+
add_subdirectory(timerevent)
18+
add_subdirectory(unbuffered_serial)
19+
add_subdirectory(watchdog)
20+
add_subdirectory(watchdog_reset)
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5-
6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-drivers-buffered-serial)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
4+
if(NOT "DEVICE_SERIAL=1" IN_LIST MBED_TARGET_DEFINITIONS)
5+
set(TEST_SKIPPED "Serial communication not supported for this target")
6+
endif()
127

138
mbed_greentea_add_test(
149
TEST_NAME
15-
${TEST_TARGET}
10+
mbed-drivers-buffered-serial
1611
TEST_SOURCES
1712
main.cpp
13+
HOST_TESTS_DIR
14+
../../host_tests
15+
TEST_SKIPPED
16+
${TEST_SKIPPED}
1817
)
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5-
6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-drivers-c-strings)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
12-
134
mbed_greentea_add_test(
145
TEST_NAME
15-
${TEST_TARGET}
6+
mbed-drivers-c-strings
167
TEST_SOURCES
178
main.cpp
189
)
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5-
6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-drivers-crc)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
12-
134
mbed_greentea_add_test(
145
TEST_NAME
15-
${TEST_TARGET}
6+
mbed-drivers-crc
167
TEST_SOURCES
178
main.cpp
189
)
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5-
6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-drivers-dev-null)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
12-
134
mbed_greentea_add_test(
145
TEST_NAME
15-
${TEST_TARGET}
6+
mbed-drivers-dev-null
167
TEST_SOURCES
178
main.cpp
9+
HOST_TESTS_DIR
10+
../../host_tests
1811
)

drivers/tests/TESTS/mbed_drivers/echo/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ mbed_greentea_add_test(
1515
${TEST_TARGET}
1616
TEST_SOURCES
1717
main.cpp
18+
HOST_TESTS_DIR
19+
../../host_tests
1820
)

drivers/tests/TESTS/mbed_drivers/echo/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace utest::v1;
2929
void fill_buffer(char *buffer, unsigned int length, unsigned int index)
3030
{
3131
unsigned int start = length * index;
32-
for (int i = 0; i < length - 1; i++) {
32+
for (unsigned int i = 0; i < length - 1; i++) {
3333
buffer[i] = 'a' + ((start + i) % 26);
3434
}
3535
buffer[length - 1] = '\0';
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5-
6-
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "")
7-
set(TEST_TARGET mbed-drivers-flashiap)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
4+
if(NOT "DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
5+
set(TEST_SKIPPED "Flash API not supported for this target")
6+
endif()
127

138
mbed_greentea_add_test(
149
TEST_NAME
15-
${TEST_TARGET}
10+
mbed-drivers-flashiap
1611
TEST_SOURCES
1712
main.cpp
13+
TEST_SKIPPED
14+
${TEST_SKIPPED}
1815
)

0 commit comments

Comments
 (0)