Skip to content

Commit c0a8fe6

Browse files
committed
CMake: Refactor storage TDBstore and FileSystemStore unittest cmake
- Add CMake configuration file in TDBstore and FileSystemStore unittest.
1 parent 2bafdf8 commit c0a8fe6

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(FileSystemStore)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME filesystemstore-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
UNITTEST
11+
MBED_LFS_READ_SIZE=64
12+
MBED_LFS_PROG_SIZE=64
13+
MBED_LFS_BLOCK_SIZE=512
14+
MBED_LFS_LOOKAHEAD=512
15+
)
16+
17+
target_sources(${TEST_NAME}
18+
PRIVATE
19+
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/HeapBlockDevice.cpp
20+
${mbed-os_SOURCE_DIR}/storage/kvstore/filesystemstore/source/FileSystemStore.cpp
21+
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/source/LittleFileSystem.cpp
22+
${mbed-os_SOURCE_DIR}/storage/filesystem/source/Dir.cpp
23+
${mbed-os_SOURCE_DIR}/storage/filesystem/source/File.cpp
24+
${mbed-os_SOURCE_DIR}/storage/filesystem/source/FileSystem.cpp
25+
${mbed-os_SOURCE_DIR}/platform/mbed-trace/source/mbed_trace.c
26+
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/littlefs/lfs.c
27+
${mbed-os_SOURCE_DIR}/platform/source/FileBase.cpp
28+
${mbed-os_SOURCE_DIR}/platform/source/FileSystemHandle.cpp
29+
${mbed-os_SOURCE_DIR}/platform/source/FileHandle.cpp
30+
moduletest.cpp
31+
)
32+
33+
target_link_libraries(${TEST_NAME}
34+
PRIVATE
35+
mbed-headers
36+
mbed-stubs-platform
37+
mbed-stubs-storage
38+
gmock_main
39+
)
40+
41+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
42+
43+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "storage")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(TDBStore)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME tdbstore-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
UNITTEST
11+
)
12+
13+
target_sources(${TEST_NAME}
14+
PRIVATE
15+
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/HeapBlockDevice.cpp
16+
${mbed-os_SOURCE_DIR}/storage/blockdevice/source/BufferedBlockDevice.cpp
17+
${mbed-os_SOURCE_DIR}/storage/kvstore/tdbstore/source/TDBStore.cpp
18+
moduletest.cpp
19+
)
20+
21+
target_link_libraries(${TEST_NAME}
22+
PRIVATE
23+
mbed-headers
24+
mbed-stubs-platform
25+
gmock_main
26+
)
27+
28+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
29+
30+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "storage")

0 commit comments

Comments
 (0)