Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
David Rogers | a2c4d1d | 2021-01-15 03:17:28 -0800 | [diff] [blame] | 17 | import("$dir_pw_bloat/bloat.gni") |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 18 | import("$dir_pw_build/module_config.gni") |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 19 | import("$dir_pw_build/target_types.gni") |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 20 | import("$dir_pw_docgen/docs.gni") |
Wyatt Hepler | 70a6210 | 2022-02-11 15:14:35 -0800 | [diff] [blame] | 21 | import("$dir_pw_toolchain/generate_toolchain.gni") |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 22 | import("$dir_pw_unit_test/test.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 23 | |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 24 | declare_args() { |
| 25 | # The build target that overrides the default configuration options for this |
| 26 | # module. This should point to a source set that provides defines through a |
| 27 | # public config (which may -include a file or add defines directly). |
| 28 | pw_kvs_CONFIG = pw_build_DEFAULT_MODULE_CONFIG |
| 29 | } |
| 30 | |
| 31 | config("public_include_path") { |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 32 | include_dirs = [ "public" ] |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 33 | visibility = [ ":*" ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 34 | } |
| 35 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 36 | pw_source_set("pw_kvs") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 37 | public_configs = [ ":public_include_path" ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 38 | public = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 39 | "public/pw_kvs/alignment.h", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 40 | "public/pw_kvs/checksum.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 41 | "public/pw_kvs/flash_memory.h", |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 42 | "public/pw_kvs/flash_test_partition.h", |
Wyatt Hepler | 88adfe8 | 2020-02-20 19:33:27 -0800 | [diff] [blame] | 43 | "public/pw_kvs/format.h", |
Wyatt Hepler | 06b1b0b | 2020-03-09 08:26:34 -0700 | [diff] [blame] | 44 | "public/pw_kvs/io.h", |
Rob Oliver | e64daf4 | 2020-11-24 11:50:03 -0500 | [diff] [blame] | 45 | "public/pw_kvs/key.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 46 | "public/pw_kvs/key_value_store.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 47 | ] |
| 48 | sources = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 49 | "alignment.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 50 | "checksum.cc", |
Wyatt Hepler | d31d970 | 2020-02-14 08:46:36 -0800 | [diff] [blame] | 51 | "entry.cc", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 52 | "entry_cache.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 53 | "flash_memory.cc", |
Wyatt Hepler | 22d0d9f | 2020-03-05 14:57:11 -0800 | [diff] [blame] | 54 | "format.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 55 | "key_value_store.cc", |
Wyatt Hepler | bdd8e5a | 2020-02-20 19:27:26 -0800 | [diff] [blame] | 56 | "public/pw_kvs/internal/entry.h", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 57 | "public/pw_kvs/internal/entry_cache.h", |
Wyatt Hepler | 1fc1104 | 2020-02-19 17:17:51 -0800 | [diff] [blame] | 58 | "public/pw_kvs/internal/hash.h", |
| 59 | "public/pw_kvs/internal/key_descriptor.h", |
Wyatt Hepler | 2454f2d | 2020-03-20 12:54:35 -0700 | [diff] [blame] | 60 | "public/pw_kvs/internal/sectors.h", |
Keir Mierle | 0dd24a8 | 2020-02-21 16:08:59 -0800 | [diff] [blame] | 61 | "public/pw_kvs/internal/span_traits.h", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 62 | "sectors.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 63 | ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 64 | public_deps = [ |
David Rogers | 02892d2 | 2020-07-30 00:33:00 -0700 | [diff] [blame] | 65 | dir_pw_assert, |
Rob Oliver | f61adbd | 2020-12-09 13:46:46 -0500 | [diff] [blame] | 66 | dir_pw_bytes, |
Wyatt Hepler | 1c329ca | 2020-02-07 18:07:23 -0800 | [diff] [blame] | 67 | dir_pw_containers, |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 68 | dir_pw_status, |
David Rogers | b9acbb0 | 2022-02-11 14:19:55 -0800 | [diff] [blame] | 69 | dir_pw_stream, |
Rob Oliver | f61adbd | 2020-12-09 13:46:46 -0500 | [diff] [blame] | 70 | dir_pw_string, |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 71 | ] |
| 72 | deps = [ |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 73 | ":config", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 74 | dir_pw_checksum, |
| 75 | dir_pw_log, |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 76 | ] |
Wyatt Hepler | a8557ef | 2020-05-04 16:29:23 -0700 | [diff] [blame] | 77 | friend = [ ":*" ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 78 | } |
| 79 | |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 80 | pw_source_set("config") { |
| 81 | public_deps = [ pw_kvs_CONFIG ] |
| 82 | public = [ "pw_kvs_private/config.h" ] |
| 83 | visibility = [ ":*" ] |
| 84 | } |
| 85 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 86 | pw_source_set("crc16") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 87 | public = [ "public/pw_kvs/crc16_checksum.h" ] |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 88 | public_deps = [ |
| 89 | ":pw_kvs", |
| 90 | dir_pw_checksum, |
| 91 | ] |
| 92 | } |
| 93 | |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 94 | pw_source_set("flash_test_partition") { |
| 95 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 96 | public_deps = [ ":pw_kvs" ] |
| 97 | } |
| 98 | |
| 99 | pw_source_set("test_key_value_store") { |
| 100 | public = [ "public/pw_kvs/test_key_value_store.h" ] |
Ewout van Bekkum | 1d0aa6d | 2021-09-22 12:38:10 -0700 | [diff] [blame] | 101 | public_deps = [ |
| 102 | ":pw_kvs", |
| 103 | "$dir_pw_sync:borrow", |
| 104 | ] |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 107 | pw_source_set("fake_flash") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 108 | public_configs = [ ":public_include_path" ] |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 109 | public = [ "public/pw_kvs/fake_flash_memory.h" ] |
| 110 | sources = [ "fake_flash_memory.cc" ] |
| 111 | public_deps = [ |
| 112 | dir_pw_containers, |
| 113 | dir_pw_kvs, |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 114 | dir_pw_status, |
| 115 | ] |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 116 | deps = [ |
| 117 | ":config", |
| 118 | dir_pw_log, |
| 119 | ] |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 120 | } |
| 121 | |
David Rogers | a2c4d1d | 2021-01-15 03:17:28 -0800 | [diff] [blame] | 122 | pw_source_set("fake_flash_12_byte_partition") { |
| 123 | public_configs = [ ":public_include_path" ] |
| 124 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 125 | sources = [ "fake_flash_test_partition.cc" ] |
| 126 | public_deps = [ ":flash_test_partition" ] |
| 127 | deps = [ |
| 128 | ":fake_flash", |
| 129 | dir_pw_kvs, |
| 130 | ] |
| 131 | defines = [ |
| 132 | "PW_FLASH_TEST_SECTORS=3", |
| 133 | "PW_FLASH_TEST_SECTOR_SIZE=4", |
| 134 | "PW_FLASH_TEST_ALIGNMENT=4", |
| 135 | ] |
| 136 | } |
| 137 | |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 138 | pw_source_set("fake_flash_1_aligned_partition") { |
| 139 | public_configs = [ ":public_include_path" ] |
| 140 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 141 | sources = [ "fake_flash_test_partition.cc" ] |
| 142 | public_deps = [ ":flash_test_partition" ] |
| 143 | deps = [ |
| 144 | ":fake_flash", |
| 145 | dir_pw_kvs, |
| 146 | ] |
| 147 | defines = [ |
| 148 | "PW_FLASH_TEST_SECTORS=6U", |
| 149 | "PW_FLASH_TEST_SECTOR_SIZE=4096U", |
| 150 | "PW_FLASH_TEST_ALIGNMENT=1U", |
| 151 | ] |
| 152 | } |
| 153 | |
| 154 | pw_source_set("fake_flash_16_aligned_partition") { |
| 155 | public_configs = [ ":public_include_path" ] |
| 156 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 157 | sources = [ "fake_flash_test_partition.cc" ] |
| 158 | public_deps = [ ":flash_test_partition" ] |
| 159 | deps = [ |
| 160 | ":fake_flash", |
| 161 | dir_pw_kvs, |
| 162 | ] |
| 163 | defines = [ |
| 164 | "PW_FLASH_TEST_SECTORS=6U", |
| 165 | "PW_FLASH_TEST_SECTOR_SIZE=4096U", |
| 166 | "PW_FLASH_TEST_ALIGNMENT=16U", |
| 167 | ] |
| 168 | } |
| 169 | |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 170 | pw_source_set("fake_flash_64_aligned_partition") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 171 | public_configs = [ ":public_include_path" ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 172 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 173 | sources = [ "fake_flash_test_partition.cc" ] |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 174 | public_deps = [ ":flash_test_partition" ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 175 | deps = [ |
| 176 | ":fake_flash", |
| 177 | dir_pw_kvs, |
| 178 | ] |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 179 | defines = [ |
| 180 | "PW_FLASH_TEST_SECTORS=6U", |
| 181 | "PW_FLASH_TEST_SECTOR_SIZE=4096U", |
| 182 | "PW_FLASH_TEST_ALIGNMENT=64U", |
| 183 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | pw_source_set("fake_flash_256_aligned_partition") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 187 | public_configs = [ ":public_include_path" ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 188 | public = [ "public/pw_kvs/flash_test_partition.h" ] |
| 189 | sources = [ "fake_flash_test_partition.cc" ] |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 190 | public_deps = [ ":flash_test_partition" ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 191 | deps = [ |
| 192 | ":fake_flash", |
| 193 | dir_pw_kvs, |
| 194 | ] |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 195 | defines = [ |
| 196 | "PW_FLASH_TEST_SECTORS=6U", |
| 197 | "PW_FLASH_TEST_SECTOR_SIZE=4096U", |
| 198 | "PW_FLASH_TEST_ALIGNMENT=256U", |
| 199 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 200 | } |
| 201 | |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 202 | pw_source_set("fake_flash_test_key_value_store") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 203 | public_configs = [ ":public_include_path" ] |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 204 | sources = [ "fake_flash_test_key_value_store.cc" ] |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 205 | public_deps = [ ":test_key_value_store" ] |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 206 | deps = [ |
| 207 | ":crc16", |
| 208 | ":fake_flash", |
| 209 | dir_pw_kvs, |
| 210 | ] |
| 211 | } |
| 212 | |
David Rogers | b9acbb0 | 2022-02-11 14:19:55 -0800 | [diff] [blame] | 213 | pw_source_set("flash_partition_stream_test") { |
| 214 | public_configs = [ ":public_include_path" ] |
| 215 | public = [ "public/pw_kvs/flash_memory.h" ] |
| 216 | sources = [ "flash_partition_stream_test.cc" ] |
| 217 | public_deps = [ |
| 218 | "$dir_pw_sync:borrow", |
| 219 | dir_pw_bytes, |
| 220 | dir_pw_kvs, |
Wyatt Hepler | 79525f5 | 2022-03-02 11:16:28 -0800 | [diff] [blame] | 221 | dir_pw_polyfill, |
David Rogers | b9acbb0 | 2022-02-11 14:19:55 -0800 | [diff] [blame] | 222 | dir_pw_preprocessor, |
| 223 | dir_pw_status, |
| 224 | dir_pw_stream, |
| 225 | ] |
| 226 | deps = [ |
| 227 | ":config", |
| 228 | ":fake_flash", |
| 229 | ":flash_test_partition", |
| 230 | dir_pw_kvs, |
| 231 | dir_pw_log, |
| 232 | dir_pw_random, |
| 233 | dir_pw_unit_test, |
| 234 | ] |
| 235 | } |
| 236 | |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 237 | pw_source_set("flash_partition_test_100_iterations") { |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 238 | deps = [ |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 239 | ":config", |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 240 | ":flash_test_partition", |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 241 | dir_pw_kvs, |
| 242 | dir_pw_log, |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 243 | dir_pw_unit_test, |
| 244 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 245 | sources = [ "flash_partition_test.cc" ] |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 246 | defines = [ |
| 247 | "PW_FLASH_TEST_ITERATIONS=100", |
| 248 | "PW_FLASH_TEST_WRITE_SIZE=1", |
| 249 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | pw_source_set("flash_partition_test_2_iterations") { |
| 253 | deps = [ |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 254 | ":config", |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 255 | ":flash_test_partition", |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 256 | dir_pw_kvs, |
| 257 | dir_pw_log, |
| 258 | dir_pw_unit_test, |
| 259 | ] |
| 260 | sources = [ "flash_partition_test.cc" ] |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 261 | defines = [ |
| 262 | "PW_FLASH_TEST_ITERATIONS=2", |
| 263 | "PW_FLASH_TEST_WRITE_SIZE=1", |
| 264 | ] |
| 265 | } |
| 266 | |
| 267 | pw_source_set("flash_partition_test_100_iterations_256_write") { |
| 268 | deps = [ |
| 269 | ":config", |
| 270 | ":flash_test_partition", |
| 271 | dir_pw_kvs, |
| 272 | dir_pw_log, |
| 273 | dir_pw_unit_test, |
| 274 | ] |
| 275 | sources = [ "flash_partition_test.cc" ] |
| 276 | defines = [ |
| 277 | "PW_FLASH_TEST_ITERATIONS=100", |
| 278 | "PW_FLASH_TEST_WRITE_SIZE=256", |
| 279 | ] |
| 280 | } |
| 281 | |
| 282 | pw_source_set("flash_partition_test_2_iterations_256_write") { |
| 283 | deps = [ |
| 284 | ":config", |
| 285 | ":flash_test_partition", |
| 286 | dir_pw_kvs, |
| 287 | dir_pw_log, |
| 288 | dir_pw_unit_test, |
| 289 | ] |
| 290 | sources = [ "flash_partition_test.cc" ] |
| 291 | defines = [ |
| 292 | "PW_FLASH_TEST_ITERATIONS=2", |
| 293 | "PW_FLASH_TEST_WRITE_SIZE=256", |
| 294 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | pw_source_set("key_value_store_initialized_test") { |
| 298 | deps = [ |
| 299 | ":crc16", |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 300 | ":flash_test_partition", |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 301 | ":pw_kvs", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 302 | dir_pw_bytes, |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 303 | dir_pw_checksum, |
| 304 | dir_pw_log, |
| 305 | dir_pw_unit_test, |
| 306 | ] |
| 307 | sources = [ "key_value_store_initialized_test.cc" ] |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 308 | } |
| 309 | |
David Rogers | 67cf06d | 2021-04-15 14:56:46 -0700 | [diff] [blame] | 310 | pw_source_set("key_value_store_fuzz_test") { |
| 311 | deps = [ |
| 312 | ":crc16", |
| 313 | ":flash_test_partition", |
| 314 | ":pw_kvs", |
| 315 | dir_pw_bytes, |
| 316 | dir_pw_checksum, |
| 317 | dir_pw_log, |
| 318 | dir_pw_unit_test, |
| 319 | ] |
| 320 | sources = [ "key_value_store_fuzz_test.cc" ] |
| 321 | } |
| 322 | |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 323 | pw_source_set("test_key_value_store_test") { |
| 324 | deps = [ |
| 325 | ":pw_kvs", |
| 326 | ":test_key_value_store", |
Ewout van Bekkum | 1d0aa6d | 2021-09-22 12:38:10 -0700 | [diff] [blame] | 327 | "$dir_pw_sync:borrow", |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 328 | dir_pw_unit_test, |
| 329 | ] |
| 330 | sources = [ "test_key_value_store_test.cc" ] |
| 331 | } |
| 332 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 333 | pw_source_set("test_partition") { |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 334 | public_configs = [ ":public_include_path" ] |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 335 | public = [ "public/pw_kvs/flash_partition_with_stats.h" ] |
Wyatt Hepler | a8557ef | 2020-05-04 16:29:23 -0700 | [diff] [blame] | 336 | sources = [ "flash_partition_with_stats.cc" ] |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 337 | visibility = [ ":*" ] |
| 338 | public_deps = [ |
| 339 | dir_pw_kvs, |
| 340 | dir_pw_log, |
| 341 | dir_pw_status, |
| 342 | ] |
Wyatt Hepler | ae222dc | 2020-10-14 10:46:27 -0700 | [diff] [blame] | 343 | deps = [ ":config" ] |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 344 | } |
| 345 | |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 346 | pw_test_group("tests") { |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 347 | tests = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 348 | ":alignment_test", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 349 | ":checksum_test", |
Wyatt Hepler | 2debeb6 | 2020-12-03 08:19:57 -0800 | [diff] [blame] | 350 | ":converts_to_span_test", |
Rob Oliver | e64daf4 | 2020-11-24 11:50:03 -0500 | [diff] [blame] | 351 | ":key_test", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 352 | ] |
Wyatt Hepler | 70a6210 | 2022-02-11 15:14:35 -0800 | [diff] [blame] | 353 | |
| 354 | if (defined(pw_toolchain_SCOPE.is_host_toolchain) && |
| 355 | pw_toolchain_SCOPE.is_host_toolchain) { |
| 356 | # TODO(pwbug/196): KVS tests are not compatible with device builds as they |
| 357 | # use features such as std::map and are computationally expensive. Solving |
| 358 | # this requires a more complex capabilities-based build and configuration |
| 359 | # system which allowing enabling specific tests for targets that support |
| 360 | # them and modifying test parameters for different targets. |
| 361 | |
| 362 | tests += [ |
| 363 | ":entry_test", |
| 364 | ":entry_cache_test", |
| 365 | ":flash_partition_1_stream_test", |
| 366 | ":flash_partition_1_alignment_test", |
| 367 | ":flash_partition_16_alignment_test", |
| 368 | ":flash_partition_64_alignment_test", |
| 369 | ":flash_partition_256_alignment_test", |
| 370 | ":flash_partition_256_write_size_test", |
| 371 | ":key_value_store_test", |
| 372 | ":key_value_store_1_alignment_flash_test", |
| 373 | ":key_value_store_16_alignment_flash_test", |
| 374 | ":key_value_store_64_alignment_flash_test", |
| 375 | ":key_value_store_256_alignment_flash_test", |
| 376 | ":key_value_store_fuzz_1_alignment_flash_test", |
| 377 | ":key_value_store_fuzz_64_alignment_flash_test", |
| 378 | ":key_value_store_binary_format_test", |
| 379 | ":key_value_store_put_test", |
| 380 | ":key_value_store_map_test", |
| 381 | ":key_value_store_wear_test", |
| 382 | ":fake_flash_test_key_value_store_test", |
| 383 | ":sectors_test", |
| 384 | ] |
| 385 | } |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 386 | } |
| 387 | |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 388 | pw_test("alignment_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 389 | deps = [ ":pw_kvs" ] |
| 390 | sources = [ "alignment_test.cc" ] |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 391 | } |
| 392 | |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 393 | pw_test("checksum_test") { |
| 394 | deps = [ |
| 395 | ":crc16", |
| 396 | ":pw_kvs", |
| 397 | dir_pw_log, |
| 398 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 399 | sources = [ "checksum_test.cc" ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 400 | } |
| 401 | |
Wyatt Hepler | 2debeb6 | 2020-12-03 08:19:57 -0800 | [diff] [blame] | 402 | pw_test("converts_to_span_test") { |
| 403 | deps = [ ":pw_kvs" ] |
| 404 | sources = [ "converts_to_span_test.cc" ] |
| 405 | } |
| 406 | |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 407 | pw_test("entry_test") { |
| 408 | deps = [ |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 409 | ":crc16", |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 410 | ":fake_flash", |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 411 | ":pw_kvs", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 412 | dir_pw_bytes, |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 413 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 414 | sources = [ "entry_test.cc" ] |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 415 | } |
| 416 | |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 417 | pw_test("entry_cache_test") { |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 418 | deps = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 419 | ":fake_flash", |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 420 | ":pw_kvs", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 421 | dir_pw_bytes, |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 422 | ] |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 423 | sources = [ "entry_cache_test.cc" ] |
| 424 | } |
| 425 | |
David Rogers | b9acbb0 | 2022-02-11 14:19:55 -0800 | [diff] [blame] | 426 | pw_test("flash_partition_1_stream_test") { |
| 427 | deps = [ |
| 428 | ":fake_flash", |
| 429 | ":fake_flash_1_aligned_partition", |
| 430 | ":flash_partition_stream_test", |
| 431 | dir_pw_log, |
| 432 | ] |
| 433 | } |
| 434 | |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 435 | pw_test("flash_partition_1_alignment_test") { |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 436 | deps = [ |
| 437 | ":fake_flash", |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 438 | ":fake_flash_1_aligned_partition", |
| 439 | ":flash_partition_test_100_iterations", |
| 440 | dir_pw_log, |
| 441 | ] |
| 442 | } |
| 443 | |
| 444 | pw_test("flash_partition_16_alignment_test") { |
| 445 | deps = [ |
| 446 | ":fake_flash", |
| 447 | ":fake_flash_16_aligned_partition", |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 448 | ":flash_partition_test_100_iterations", |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 449 | dir_pw_log, |
| 450 | ] |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | pw_test("flash_partition_64_alignment_test") { |
| 454 | deps = [ |
| 455 | ":fake_flash", |
| 456 | ":fake_flash_64_aligned_partition", |
| 457 | ":flash_partition_test_100_iterations", |
| 458 | dir_pw_log, |
| 459 | ] |
| 460 | } |
| 461 | |
| 462 | pw_test("flash_partition_256_alignment_test") { |
| 463 | deps = [ |
| 464 | ":fake_flash", |
| 465 | ":fake_flash_256_aligned_partition", |
| 466 | ":flash_partition_test_100_iterations", |
| 467 | dir_pw_log, |
| 468 | ] |
David Rogers | ca59296 | 2020-07-01 09:21:54 -0700 | [diff] [blame] | 469 | } |
| 470 | |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 471 | pw_test("flash_partition_256_write_size_test") { |
| 472 | deps = [ |
| 473 | ":fake_flash", |
| 474 | ":fake_flash_1_aligned_partition", |
| 475 | ":flash_partition_test_100_iterations_256_write", |
| 476 | dir_pw_log, |
| 477 | ] |
| 478 | } |
| 479 | |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 480 | pw_test("key_value_store_test") { |
| 481 | deps = [ |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 482 | ":crc16", |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 483 | ":fake_flash", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 484 | ":pw_kvs", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 485 | dir_pw_bytes, |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 486 | dir_pw_checksum, |
| 487 | dir_pw_log, |
| 488 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 489 | sources = [ "key_value_store_test.cc" ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 490 | } |
| 491 | |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 492 | pw_test("key_value_store_1_alignment_flash_test") { |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 493 | deps = [ |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 494 | ":fake_flash_1_aligned_partition", |
| 495 | ":key_value_store_initialized_test", |
| 496 | ] |
| 497 | } |
| 498 | |
| 499 | pw_test("key_value_store_16_alignment_flash_test") { |
| 500 | deps = [ |
| 501 | ":fake_flash_16_aligned_partition", |
David Rogers | 6a262b4 | 2020-07-09 03:27:41 -0700 | [diff] [blame] | 502 | ":key_value_store_initialized_test", |
| 503 | ] |
| 504 | } |
| 505 | |
| 506 | pw_test("key_value_store_64_alignment_flash_test") { |
| 507 | deps = [ |
| 508 | ":fake_flash_64_aligned_partition", |
| 509 | ":key_value_store_initialized_test", |
| 510 | ] |
| 511 | } |
| 512 | |
| 513 | pw_test("key_value_store_256_alignment_flash_test") { |
| 514 | deps = [ |
| 515 | ":fake_flash_256_aligned_partition", |
| 516 | ":key_value_store_initialized_test", |
| 517 | ] |
| 518 | } |
| 519 | |
David Rogers | 2d4fa78 | 2021-07-08 21:07:28 -0700 | [diff] [blame] | 520 | pw_test("key_value_store_fuzz_1_alignment_flash_test") { |
| 521 | deps = [ |
| 522 | ":fake_flash_1_aligned_partition", |
| 523 | ":key_value_store_fuzz_test", |
| 524 | ] |
| 525 | } |
| 526 | |
| 527 | pw_test("key_value_store_fuzz_64_alignment_flash_test") { |
| 528 | deps = [ |
| 529 | ":fake_flash_64_aligned_partition", |
| 530 | ":key_value_store_fuzz_test", |
| 531 | ] |
| 532 | } |
| 533 | |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 534 | pw_test("key_value_store_binary_format_test") { |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 535 | deps = [ |
| 536 | ":crc16", |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 537 | ":fake_flash", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 538 | ":pw_kvs", |
Wyatt Hepler | 6b3a6c9 | 2020-08-03 10:15:56 -0700 | [diff] [blame] | 539 | dir_pw_bytes, |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 540 | dir_pw_log, |
| 541 | ] |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 542 | sources = [ "key_value_store_binary_format_test.cc" ] |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 543 | } |
| 544 | |
David Rogers | 67cf06d | 2021-04-15 14:56:46 -0700 | [diff] [blame] | 545 | pw_test("key_value_store_put_test") { |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 546 | deps = [ |
| 547 | ":crc16", |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 548 | ":fake_flash", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 549 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 550 | ":test_partition", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 551 | ] |
David Rogers | 67cf06d | 2021-04-15 14:56:46 -0700 | [diff] [blame] | 552 | sources = [ "key_value_store_put_test.cc" ] |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 553 | } |
| 554 | |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 555 | pw_test("fake_flash_test_key_value_store_test") { |
| 556 | deps = [ |
| 557 | ":fake_flash_test_key_value_store", |
David Rogers | a5c39a5 | 2020-08-07 18:18:56 -0700 | [diff] [blame] | 558 | ":test_key_value_store_test", |
Ewout van Bekkum | 1d0aa6d | 2021-09-22 12:38:10 -0700 | [diff] [blame] | 559 | "$dir_pw_sync:borrow", |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 560 | ] |
David Rogers | eaa2a69 | 2020-08-07 00:48:16 -0700 | [diff] [blame] | 561 | } |
| 562 | |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 563 | pw_test("key_value_store_map_test") { |
| 564 | deps = [ |
| 565 | ":crc16", |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 566 | ":fake_flash", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 567 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 568 | ":test_partition", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 569 | dir_pw_checksum, |
| 570 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 571 | sources = [ "key_value_store_map_test.cc" ] |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 572 | } |
| 573 | |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 574 | pw_test("sectors_test") { |
| 575 | deps = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 576 | ":fake_flash", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 577 | ":pw_kvs", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 578 | ] |
| 579 | sources = [ "sectors_test.cc" ] |
| 580 | } |
| 581 | |
Rob Oliver | e64daf4 | 2020-11-24 11:50:03 -0500 | [diff] [blame] | 582 | pw_test("key_test") { |
| 583 | deps = [ ":pw_kvs" ] |
| 584 | sources = [ "key_test.cc" ] |
| 585 | } |
| 586 | |
David Rogers | d5138f3 | 2020-04-28 15:18:56 -0700 | [diff] [blame] | 587 | pw_test("key_value_store_wear_test") { |
Armando Montanez | f9e93e1 | 2020-04-22 07:44:14 -0700 | [diff] [blame] | 588 | deps = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 589 | ":fake_flash", |
Armando Montanez | f9e93e1 | 2020-04-22 07:44:14 -0700 | [diff] [blame] | 590 | ":pw_kvs", |
David Rogers | d5138f3 | 2020-04-28 15:18:56 -0700 | [diff] [blame] | 591 | ":test_partition", |
Armando Montanez | f9e93e1 | 2020-04-22 07:44:14 -0700 | [diff] [blame] | 592 | dir_pw_log, |
| 593 | ] |
| 594 | sources = [ "key_value_store_wear_test.cc" ] |
| 595 | } |
| 596 | |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 597 | pw_doc_group("docs") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 598 | sources = [ "docs.rst" ] |
David Rogers | a2c4d1d | 2021-01-15 03:17:28 -0800 | [diff] [blame] | 599 | report_deps = [ ":kvs_size" ] |
| 600 | } |
| 601 | |
| 602 | pw_size_report("kvs_size") { |
| 603 | title = "Pigweed KVS size report" |
| 604 | |
| 605 | # To see all the symbols, uncomment the following: |
| 606 | # Note: The size report RST table won't be generated when full_report = true. |
| 607 | # full_report = true |
| 608 | |
| 609 | binaries = [ |
| 610 | { |
| 611 | target = "size_report:with_kvs" |
| 612 | base = "size_report:base_with_only_flash" |
| 613 | label = "KeyValueStore" |
| 614 | }, |
| 615 | ] |
| 616 | |
| 617 | binaries += [ |
| 618 | { |
| 619 | target = "size_report:base_with_only_flash" |
| 620 | base = "size_report:base" |
| 621 | label = "FlashPartition" |
| 622 | }, |
| 623 | ] |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 624 | } |