Skip to content

Commit 04db467

Browse files
author
Jamie Smith
authored
Reactivate block device tests (ARMmbed#270)
* Reactivate block device tests * Oops missed some CMake files
1 parent 3fcfbbd commit 04db467

File tree

10 files changed

+32
-73
lines changed

10 files changed

+32
-73
lines changed

storage/blockdevice/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
if(MBED_ENABLE_OS_INTERNAL_TESTS)
55
if(MBED_BUILD_GREENTEA_TESTS)
6-
# add greentea test
6+
add_subdirectory(tests/TESTS)
77
else()
88
add_subdirectory(COMPONENT_QSPIF)
99
add_subdirectory(tests/UNITTESTS)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2024 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(blockdevice)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(buffered_block_device)
5+
add_subdirectory(flashsim_block_device)
6+
add_subdirectory(general_block_device)
7+
add_subdirectory(heap_block_device)
8+
add_subdirectory(mbr_block_device)
9+
add_subdirectory(util_block_device)

storage/blockdevice/tests/TESTS/blockdevice/buffered_block_device/CMakeLists.txt

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-storage-blockdevice-buffered_block_device)
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-storage-blockdevice-buffered_block_device
167
TEST_SOURCES
178
main.cpp
189
TEST_REQUIRED_LIBS

storage/blockdevice/tests/TESTS/blockdevice/flashsim_block_device/CMakeLists.txt

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-storage-blockdevice-flashsim_block_device)
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-storage-blockdevice-flashsim_block_device
167
TEST_SOURCES
178
main.cpp
189
TEST_REQUIRED_LIBS

storage/blockdevice/tests/TESTS/blockdevice/general_block_device/CMakeLists.txt

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
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-storage-blockdevice-general_block_device)
8-
9-
include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)
10-
11-
project(${TEST_TARGET})
12-
13-
if("DATAFLASH" IN_LIST MBED_TARGET_LABELS)
4+
if("COMPONENT_DATAFLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
145
list(APPEND mbed_blockdevice_libs mbed-storage-dataflash)
156
endif()
167

17-
if("FLASHIAP" IN_LIST MBED_TARGET_LABELS)
8+
if("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
189
list(APPEND mbed_blockdevice_libs mbed-storage-flashiap)
1910
endif()
2011

21-
if("I2CEE" IN_LIST MBED_TARGET_LABELS)
12+
if("COMPONENT_I2CEE=1" IN_LIST MBED_TARGET_DEFINITIONS)
2213
list(APPEND mbed_blockdevice_libs mbed-storage-i2cee)
2314
endif()
2415

25-
if("OSPIF" IN_LIST MBED_TARGET_LABELS)
16+
if("COMPONENT_OSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
2617
list(APPEND mbed_blockdevice_libs mbed-storage-ospif)
2718
endif()
2819

29-
if("QSPIF" IN_LIST MBED_TARGET_LABELS)
20+
if("COMPONENT_QSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
3021
list(APPEND mbed_blockdevice_libs mbed-storage-qspif)
3122
endif()
3223

33-
if("SD" IN_LIST MBED_TARGET_LABELS)
24+
if("COMPONENT_SD=1" IN_LIST MBED_TARGET_DEFINITIONS)
3425
list(APPEND mbed_blockdevice_libs mbed-storage-sd)
3526
endif()
3627

37-
if("SPIF" IN_LIST MBED_TARGET_LABELS)
28+
if("COMPONENT_SPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
3829
list(APPEND mbed_blockdevice_libs mbed-storage-spif)
3930
endif()
4031

4132
mbed_greentea_add_test(
4233
TEST_NAME
43-
${TEST_TARGET}
34+
mbed-storage-blockdevice-general_block_device
4435
TEST_SOURCES
4536
main.cpp
4637
TEST_REQUIRED_LIBS

storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#include "SDBlockDevice.h"
5050
#endif
5151

52-
#if COMPONENT_FLASHIAP
52+
#if DEVICE_FLASH
5353
#include "FlashIAPBlockDevice.h"
5454
#endif
5555

@@ -108,7 +108,7 @@ static SingletonPtr<rtos::Mutex> _mutex;
108108

109109
BlockDevice *block_device = NULL;
110110

111-
#if COMPONENT_FLASHIAP
111+
#if DEVICE_FLASH
112112
static inline uint32_t align_up(uint32_t val, uint32_t size)
113113
{
114114
return (((val - 1) / size) + 1) * size;
@@ -210,7 +210,7 @@ static BlockDevice *get_bd_instance(uint8_t bd_type)
210210
break;
211211
}
212212
case flashiap: {
213-
#if COMPONENT_FLASHIAP
213+
#if DEVICE_FLASH
214214
#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)
215215

216216
size_t flash_size;
@@ -907,7 +907,7 @@ void test_get_type_functionality()
907907
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "DATAFLASH"));
908908
#elif COMPONENT_SD
909909
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "SD"));
910-
#elif COMPONENT_FLASHIAP
910+
#elif DEVICE_FLASH
911911
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "FLASHIAP"));
912912
#elif COMPONENT_SPINAND
913913
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "SPINAND"));
@@ -966,7 +966,7 @@ int get_bd_count()
966966
#if COMPONENT_SD
967967
bd_arr[count++] = sd; //3
968968
#endif
969-
#if COMPONENT_FLASHIAP
969+
#if DEVICE_FLASH
970970
bd_arr[count++] = flashiap; //4
971971
#endif
972972
#if COMPONENT_OSPIF

storage/blockdevice/tests/TESTS/blockdevice/heap_block_device/CMakeLists.txt

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-storage-blockdevice-heap_block_device)
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-storage-blockdevice-heap_block_device
167
TEST_SOURCES
178
main.cpp
189
TEST_REQUIRED_LIBS

storage/blockdevice/tests/TESTS/blockdevice/mbr_block_device/CMakeLists.txt

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-storage-blockdevice-mbr_block_device)
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-storage-blockdevice-mbr_block_device
167
TEST_SOURCES
178
main.cpp
189
TEST_REQUIRED_LIBS

storage/blockdevice/tests/TESTS/blockdevice/util_block_device/CMakeLists.txt

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-storage-blockdevice-util_block_device)
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-storage-blockdevice-util_block_device
167
TEST_SOURCES
178
main.cpp
189
TEST_REQUIRED_LIBS

0 commit comments

Comments
 (0)