CMake: Refactor storage TDBstore and FileSystemStore unittest cmake

- Add CMake configuration file in TDBstore and FileSystemStore unittest.
pull/14426/head
Rajkumar Kanagaraj 2021-02-23 07:42:32 -08:00
parent 2bafdf82e7
commit c0a8fe62f5
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(FileSystemStore)

View File

@ -0,0 +1,43 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME filesystemstore-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
UNITTEST
MBED_LFS_READ_SIZE=64
MBED_LFS_PROG_SIZE=64
MBED_LFS_BLOCK_SIZE=512
MBED_LFS_LOOKAHEAD=512
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/HeapBlockDevice.cpp
${mbed-os_SOURCE_DIR}/storage/kvstore/filesystemstore/source/FileSystemStore.cpp
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/source/LittleFileSystem.cpp
${mbed-os_SOURCE_DIR}/storage/filesystem/source/Dir.cpp
${mbed-os_SOURCE_DIR}/storage/filesystem/source/File.cpp
${mbed-os_SOURCE_DIR}/storage/filesystem/source/FileSystem.cpp
${mbed-os_SOURCE_DIR}/platform/mbed-trace/source/mbed_trace.c
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/littlefs/lfs.c
${mbed-os_SOURCE_DIR}/platform/source/FileBase.cpp
${mbed-os_SOURCE_DIR}/platform/source/FileSystemHandle.cpp
${mbed-os_SOURCE_DIR}/platform/source/FileHandle.cpp
moduletest.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs-platform
mbed-stubs-storage
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "storage")

View File

@ -0,0 +1,4 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(TDBStore)

View File

@ -0,0 +1,30 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME tdbstore-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
UNITTEST
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/HeapBlockDevice.cpp
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/BufferedBlockDevice.cpp
${mbed-os_SOURCE_DIR}/storage/kvstore/tdbstore/source/TDBStore.cpp
moduletest.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs-platform
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "storage")