Skip to content

Commit

Permalink
Reactivate block device tests (#270)
Browse files Browse the repository at this point in the history
* Reactivate block device tests

* Oops missed some CMake files
  • Loading branch information
multiplemonomials authored Apr 25, 2024
1 parent 3fcfbbd commit 04db467
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 73 deletions.
2 changes: 1 addition & 1 deletion storage/blockdevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if(MBED_ENABLE_OS_INTERNAL_TESTS)
if(MBED_BUILD_GREENTEA_TESTS)
# add greentea test
add_subdirectory(tests/TESTS)
else()
add_subdirectory(COMPONENT_QSPIF)
add_subdirectory(tests/UNITTESTS)
Expand Down
4 changes: 4 additions & 0 deletions storage/blockdevice/tests/TESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(blockdevice)
9 changes: 9 additions & 0 deletions storage/blockdevice/tests/TESTS/blockdevice/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(buffered_block_device)
add_subdirectory(flashsim_block_device)
add_subdirectory(general_block_device)
add_subdirectory(heap_block_device)
add_subdirectory(mbr_block_device)
add_subdirectory(util_block_device)
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-buffered_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-buffered_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-flashsim_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-flashsim_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-general_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

if("DATAFLASH" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_DATAFLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-dataflash)
endif()

if("FLASHIAP" IN_LIST MBED_TARGET_LABELS)
if("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-flashiap)
endif()

if("I2CEE" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_I2CEE=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-i2cee)
endif()

if("OSPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_OSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-ospif)
endif()

if("QSPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_QSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-qspif)
endif()

if("SD" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_SD=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-sd)
endif()

if("SPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_SPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed_blockdevice_libs mbed-storage-spif)
endif()

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-general_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include "SDBlockDevice.h"
#endif

#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
#include "FlashIAPBlockDevice.h"
#endif

Expand Down Expand Up @@ -108,7 +108,7 @@ static SingletonPtr<rtos::Mutex> _mutex;

BlockDevice *block_device = NULL;

#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
static inline uint32_t align_up(uint32_t val, uint32_t size)
{
return (((val - 1) / size) + 1) * size;
Expand Down Expand Up @@ -210,7 +210,7 @@ static BlockDevice *get_bd_instance(uint8_t bd_type)
break;
}
case flashiap: {
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)

size_t flash_size;
Expand Down Expand Up @@ -907,7 +907,7 @@ void test_get_type_functionality()
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "DATAFLASH"));
#elif COMPONENT_SD
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "SD"));
#elif COMPONENT_FLASHIAP
#elif DEVICE_FLASH
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "FLASHIAP"));
#elif COMPONENT_SPINAND
TEST_ASSERT_EQUAL(0, strcmp(bd_type, "SPINAND"));
Expand Down Expand Up @@ -966,7 +966,7 @@ int get_bd_count()
#if COMPONENT_SD
bd_arr[count++] = sd; //3
#endif
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
bd_arr[count++] = flashiap; //4
#endif
#if COMPONENT_OSPIF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-heap_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-heap_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-mbr_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-mbr_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)

set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "")
set(TEST_TARGET mbed-storage-blockdevice-util_block_device)

include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake)

project(${TEST_TARGET})

mbed_greentea_add_test(
TEST_NAME
${TEST_TARGET}
mbed-storage-blockdevice-util_block_device
TEST_SOURCES
main.cpp
TEST_REQUIRED_LIBS
Expand Down

0 comments on commit 04db467

Please sign in to comment.