blob: 10b0545322aad87f2e4c44731fb52081924046ec [file] [log] [blame]
Wyatt Hepler2ad60672020-01-21 08:00:16 -08001# 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 Montanezfb3d3fb2020-06-09 18:12:12 -070015import("//build_overrides/pigweed.gni")
16
David Rogersa2c4d1d2021-01-15 03:17:28 -080017import("$dir_pw_bloat/bloat.gni")
Wyatt Heplerae222dc2020-10-14 10:46:27 -070018import("$dir_pw_build/module_config.gni")
Alexei Frolovedd2f142020-06-09 19:11:27 -070019import("$dir_pw_build/target_types.gni")
Wyatt Hepler2ad60672020-01-21 08:00:16 -080020import("$dir_pw_docgen/docs.gni")
Wyatt Hepler70a62102022-02-11 15:14:35 -080021import("$dir_pw_toolchain/generate_toolchain.gni")
Wyatt Hepler2ad60672020-01-21 08:00:16 -080022import("$dir_pw_unit_test/test.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070023
Wyatt Heplerae222dc2020-10-14 10:46:27 -070024declare_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
31config("public_include_path") {
Wyatt Hepler2ad60672020-01-21 08:00:16 -080032 include_dirs = [ "public" ]
Wyatt Heplerae222dc2020-10-14 10:46:27 -070033 visibility = [ ":*" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080034}
35
Alexei Frolovedd2f142020-06-09 19:11:27 -070036pw_source_set("pw_kvs") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -070037 public_configs = [ ":public_include_path" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080038 public = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080039 "public/pw_kvs/alignment.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080040 "public/pw_kvs/checksum.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080041 "public/pw_kvs/flash_memory.h",
David Rogers6a262b42020-07-09 03:27:41 -070042 "public/pw_kvs/flash_test_partition.h",
Wyatt Hepler88adfe82020-02-20 19:33:27 -080043 "public/pw_kvs/format.h",
Wyatt Hepler06b1b0b2020-03-09 08:26:34 -070044 "public/pw_kvs/io.h",
Rob Olivere64daf42020-11-24 11:50:03 -050045 "public/pw_kvs/key.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080046 "public/pw_kvs/key_value_store.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080047 ]
48 sources = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080049 "alignment.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080050 "checksum.cc",
Wyatt Heplerd31d9702020-02-14 08:46:36 -080051 "entry.cc",
Wyatt Hepler7ded6da2020-03-11 18:24:43 -070052 "entry_cache.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080053 "flash_memory.cc",
Wyatt Hepler22d0d9f2020-03-05 14:57:11 -080054 "format.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080055 "key_value_store.cc",
Wyatt Heplerbdd8e5a2020-02-20 19:27:26 -080056 "public/pw_kvs/internal/entry.h",
Wyatt Hepler7ded6da2020-03-11 18:24:43 -070057 "public/pw_kvs/internal/entry_cache.h",
Wyatt Hepler1fc11042020-02-19 17:17:51 -080058 "public/pw_kvs/internal/hash.h",
59 "public/pw_kvs/internal/key_descriptor.h",
Wyatt Hepler2454f2d2020-03-20 12:54:35 -070060 "public/pw_kvs/internal/sectors.h",
Keir Mierle0dd24a82020-02-21 16:08:59 -080061 "public/pw_kvs/internal/span_traits.h",
Wyatt Heplerc84393f2020-03-20 11:23:24 -070062 "sectors.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080063 ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080064 public_deps = [
David Rogers02892d22020-07-30 00:33:00 -070065 dir_pw_assert,
Rob Oliverf61adbd2020-12-09 13:46:46 -050066 dir_pw_bytes,
Wyatt Hepler1c329ca2020-02-07 18:07:23 -080067 dir_pw_containers,
Wyatt Heplerad684a12020-02-04 17:17:29 -080068 dir_pw_status,
David Rogersb9acbb02022-02-11 14:19:55 -080069 dir_pw_stream,
Rob Oliverf61adbd2020-12-09 13:46:46 -050070 dir_pw_string,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080071 ]
72 deps = [
Wyatt Heplerae222dc2020-10-14 10:46:27 -070073 ":config",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080074 dir_pw_checksum,
75 dir_pw_log,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080076 ]
Wyatt Heplera8557ef2020-05-04 16:29:23 -070077 friend = [ ":*" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080078}
79
Wyatt Heplerae222dc2020-10-14 10:46:27 -070080pw_source_set("config") {
81 public_deps = [ pw_kvs_CONFIG ]
82 public = [ "pw_kvs_private/config.h" ]
83 visibility = [ ":*" ]
84}
85
Alexei Frolovedd2f142020-06-09 19:11:27 -070086pw_source_set("crc16") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080087 public = [ "public/pw_kvs/crc16_checksum.h" ]
Wyatt Heplerec4b9352020-01-31 15:51:50 -080088 public_deps = [
89 ":pw_kvs",
90 dir_pw_checksum,
91 ]
92}
93
David Rogersa5c39a52020-08-07 18:18:56 -070094pw_source_set("flash_test_partition") {
95 public = [ "public/pw_kvs/flash_test_partition.h" ]
96 public_deps = [ ":pw_kvs" ]
97}
98
99pw_source_set("test_key_value_store") {
100 public = [ "public/pw_kvs/test_key_value_store.h" ]
Ewout van Bekkum1d0aa6d2021-09-22 12:38:10 -0700101 public_deps = [
102 ":pw_kvs",
103 "$dir_pw_sync:borrow",
104 ]
David Rogersa5c39a52020-08-07 18:18:56 -0700105}
106
Alexei Frolovedd2f142020-06-09 19:11:27 -0700107pw_source_set("fake_flash") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700108 public_configs = [ ":public_include_path" ]
David Rogersd64cc012020-05-26 12:37:37 -0700109 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 Rogersd64cc012020-05-26 12:37:37 -0700114 dir_pw_status,
115 ]
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700116 deps = [
117 ":config",
118 dir_pw_log,
119 ]
David Rogersd64cc012020-05-26 12:37:37 -0700120}
121
David Rogersa2c4d1d2021-01-15 03:17:28 -0800122pw_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 Rogers2d4fa782021-07-08 21:07:28 -0700138pw_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
154pw_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 Rogers6a262b42020-07-09 03:27:41 -0700170pw_source_set("fake_flash_64_aligned_partition") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700171 public_configs = [ ":public_include_path" ]
David Rogers6a262b42020-07-09 03:27:41 -0700172 public = [ "public/pw_kvs/flash_test_partition.h" ]
173 sources = [ "fake_flash_test_partition.cc" ]
David Rogersa5c39a52020-08-07 18:18:56 -0700174 public_deps = [ ":flash_test_partition" ]
David Rogers6a262b42020-07-09 03:27:41 -0700175 deps = [
176 ":fake_flash",
177 dir_pw_kvs,
178 ]
David Rogers2d4fa782021-07-08 21:07:28 -0700179 defines = [
180 "PW_FLASH_TEST_SECTORS=6U",
181 "PW_FLASH_TEST_SECTOR_SIZE=4096U",
182 "PW_FLASH_TEST_ALIGNMENT=64U",
183 ]
David Rogers6a262b42020-07-09 03:27:41 -0700184}
185
186pw_source_set("fake_flash_256_aligned_partition") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700187 public_configs = [ ":public_include_path" ]
David Rogers6a262b42020-07-09 03:27:41 -0700188 public = [ "public/pw_kvs/flash_test_partition.h" ]
189 sources = [ "fake_flash_test_partition.cc" ]
David Rogersa5c39a52020-08-07 18:18:56 -0700190 public_deps = [ ":flash_test_partition" ]
David Rogers6a262b42020-07-09 03:27:41 -0700191 deps = [
192 ":fake_flash",
193 dir_pw_kvs,
194 ]
David Rogers2d4fa782021-07-08 21:07:28 -0700195 defines = [
196 "PW_FLASH_TEST_SECTORS=6U",
197 "PW_FLASH_TEST_SECTOR_SIZE=4096U",
198 "PW_FLASH_TEST_ALIGNMENT=256U",
199 ]
David Rogers6a262b42020-07-09 03:27:41 -0700200}
201
David Rogerseaa2a692020-08-07 00:48:16 -0700202pw_source_set("fake_flash_test_key_value_store") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700203 public_configs = [ ":public_include_path" ]
David Rogerseaa2a692020-08-07 00:48:16 -0700204 sources = [ "fake_flash_test_key_value_store.cc" ]
David Rogersa5c39a52020-08-07 18:18:56 -0700205 public_deps = [ ":test_key_value_store" ]
David Rogerseaa2a692020-08-07 00:48:16 -0700206 deps = [
207 ":crc16",
208 ":fake_flash",
209 dir_pw_kvs,
210 ]
211}
212
David Rogersb9acbb02022-02-11 14:19:55 -0800213pw_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 Hepler79525f52022-03-02 11:16:28 -0800221 dir_pw_polyfill,
David Rogersb9acbb02022-02-11 14:19:55 -0800222 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 Rogers6a262b42020-07-09 03:27:41 -0700237pw_source_set("flash_partition_test_100_iterations") {
David Rogersca592962020-07-01 09:21:54 -0700238 deps = [
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700239 ":config",
David Rogersa5c39a52020-08-07 18:18:56 -0700240 ":flash_test_partition",
David Rogersca592962020-07-01 09:21:54 -0700241 dir_pw_kvs,
242 dir_pw_log,
David Rogersca592962020-07-01 09:21:54 -0700243 dir_pw_unit_test,
244 ]
David Rogers6a262b42020-07-09 03:27:41 -0700245 sources = [ "flash_partition_test.cc" ]
David Rogers2d4fa782021-07-08 21:07:28 -0700246 defines = [
247 "PW_FLASH_TEST_ITERATIONS=100",
248 "PW_FLASH_TEST_WRITE_SIZE=1",
249 ]
David Rogers6a262b42020-07-09 03:27:41 -0700250}
251
252pw_source_set("flash_partition_test_2_iterations") {
253 deps = [
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700254 ":config",
David Rogersa5c39a52020-08-07 18:18:56 -0700255 ":flash_test_partition",
David Rogers6a262b42020-07-09 03:27:41 -0700256 dir_pw_kvs,
257 dir_pw_log,
258 dir_pw_unit_test,
259 ]
260 sources = [ "flash_partition_test.cc" ]
David Rogers2d4fa782021-07-08 21:07:28 -0700261 defines = [
262 "PW_FLASH_TEST_ITERATIONS=2",
263 "PW_FLASH_TEST_WRITE_SIZE=1",
264 ]
265}
266
267pw_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
282pw_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 Rogers6a262b42020-07-09 03:27:41 -0700295}
296
297pw_source_set("key_value_store_initialized_test") {
298 deps = [
299 ":crc16",
David Rogersa5c39a52020-08-07 18:18:56 -0700300 ":flash_test_partition",
David Rogers6a262b42020-07-09 03:27:41 -0700301 ":pw_kvs",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -0700302 dir_pw_bytes,
David Rogers6a262b42020-07-09 03:27:41 -0700303 dir_pw_checksum,
304 dir_pw_log,
305 dir_pw_unit_test,
306 ]
307 sources = [ "key_value_store_initialized_test.cc" ]
David Rogersca592962020-07-01 09:21:54 -0700308}
309
David Rogers67cf06d2021-04-15 14:56:46 -0700310pw_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 Rogersa5c39a52020-08-07 18:18:56 -0700323pw_source_set("test_key_value_store_test") {
324 deps = [
325 ":pw_kvs",
326 ":test_key_value_store",
Ewout van Bekkum1d0aa6d2021-09-22 12:38:10 -0700327 "$dir_pw_sync:borrow",
David Rogersa5c39a52020-08-07 18:18:56 -0700328 dir_pw_unit_test,
329 ]
330 sources = [ "test_key_value_store_test.cc" ]
331}
332
Alexei Frolovedd2f142020-06-09 19:11:27 -0700333pw_source_set("test_partition") {
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700334 public_configs = [ ":public_include_path" ]
David Rogers5cc5ce82020-03-13 19:19:03 -0700335 public = [ "public/pw_kvs/flash_partition_with_stats.h" ]
Wyatt Heplera8557ef2020-05-04 16:29:23 -0700336 sources = [ "flash_partition_with_stats.cc" ]
David Rogers5cc5ce82020-03-13 19:19:03 -0700337 visibility = [ ":*" ]
338 public_deps = [
339 dir_pw_kvs,
340 dir_pw_log,
341 dir_pw_status,
342 ]
Wyatt Heplerae222dc2020-10-14 10:46:27 -0700343 deps = [ ":config" ]
David Rogers5cc5ce82020-03-13 19:19:03 -0700344}
345
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800346pw_test_group("tests") {
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800347 tests = [
Wyatt Hepler1927c282020-02-11 16:45:02 -0800348 ":alignment_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800349 ":checksum_test",
Wyatt Hepler2debeb62020-12-03 08:19:57 -0800350 ":converts_to_span_test",
Rob Olivere64daf42020-11-24 11:50:03 -0500351 ":key_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800352 ]
Wyatt Hepler70a62102022-02-11 15:14:35 -0800353
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 Heplerec4b9352020-01-31 15:51:50 -0800386}
387
Wyatt Hepler1927c282020-02-11 16:45:02 -0800388pw_test("alignment_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800389 deps = [ ":pw_kvs" ]
390 sources = [ "alignment_test.cc" ]
Wyatt Hepler1927c282020-02-11 16:45:02 -0800391}
392
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800393pw_test("checksum_test") {
394 deps = [
395 ":crc16",
396 ":pw_kvs",
397 dir_pw_log,
398 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800399 sources = [ "checksum_test.cc" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800400}
401
Wyatt Hepler2debeb62020-12-03 08:19:57 -0800402pw_test("converts_to_span_test") {
403 deps = [ ":pw_kvs" ]
404 sources = [ "converts_to_span_test.cc" ]
405}
406
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800407pw_test("entry_test") {
408 deps = [
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800409 ":crc16",
David Rogersd64cc012020-05-26 12:37:37 -0700410 ":fake_flash",
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800411 ":pw_kvs",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -0700412 dir_pw_bytes,
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800413 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800414 sources = [ "entry_test.cc" ]
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800415}
416
Wyatt Hepler7ded6da2020-03-11 18:24:43 -0700417pw_test("entry_cache_test") {
Wyatt Hepler02946272020-03-18 10:36:22 -0700418 deps = [
David Rogersd64cc012020-05-26 12:37:37 -0700419 ":fake_flash",
Wyatt Hepler02946272020-03-18 10:36:22 -0700420 ":pw_kvs",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -0700421 dir_pw_bytes,
Wyatt Hepler02946272020-03-18 10:36:22 -0700422 ]
Wyatt Hepler7ded6da2020-03-11 18:24:43 -0700423 sources = [ "entry_cache_test.cc" ]
424}
425
David Rogersb9acbb02022-02-11 14:19:55 -0800426pw_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 Rogers2d4fa782021-07-08 21:07:28 -0700435pw_test("flash_partition_1_alignment_test") {
David Rogersca592962020-07-01 09:21:54 -0700436 deps = [
437 ":fake_flash",
David Rogers2d4fa782021-07-08 21:07:28 -0700438 ":fake_flash_1_aligned_partition",
439 ":flash_partition_test_100_iterations",
440 dir_pw_log,
441 ]
442}
443
444pw_test("flash_partition_16_alignment_test") {
445 deps = [
446 ":fake_flash",
447 ":fake_flash_16_aligned_partition",
David Rogers6a262b42020-07-09 03:27:41 -0700448 ":flash_partition_test_100_iterations",
David Rogersca592962020-07-01 09:21:54 -0700449 dir_pw_log,
450 ]
David Rogers6a262b42020-07-09 03:27:41 -0700451}
452
453pw_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
462pw_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 Rogersca592962020-07-01 09:21:54 -0700469}
470
David Rogers2d4fa782021-07-08 21:07:28 -0700471pw_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 Hepler2ad60672020-01-21 08:00:16 -0800480pw_test("key_value_store_test") {
481 deps = [
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800482 ":crc16",
David Rogersd64cc012020-05-26 12:37:37 -0700483 ":fake_flash",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800484 ":pw_kvs",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -0700485 dir_pw_bytes,
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800486 dir_pw_checksum,
487 dir_pw_log,
488 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800489 sources = [ "key_value_store_test.cc" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800490}
491
David Rogers2d4fa782021-07-08 21:07:28 -0700492pw_test("key_value_store_1_alignment_flash_test") {
David Rogers6a262b42020-07-09 03:27:41 -0700493 deps = [
David Rogers2d4fa782021-07-08 21:07:28 -0700494 ":fake_flash_1_aligned_partition",
495 ":key_value_store_initialized_test",
496 ]
497}
498
499pw_test("key_value_store_16_alignment_flash_test") {
500 deps = [
501 ":fake_flash_16_aligned_partition",
David Rogers6a262b42020-07-09 03:27:41 -0700502 ":key_value_store_initialized_test",
503 ]
504}
505
506pw_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
513pw_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 Rogers2d4fa782021-07-08 21:07:28 -0700520pw_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
527pw_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 Hepler8e94ed62020-03-05 16:45:32 -0800534pw_test("key_value_store_binary_format_test") {
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800535 deps = [
536 ":crc16",
David Rogersd64cc012020-05-26 12:37:37 -0700537 ":fake_flash",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800538 ":pw_kvs",
Wyatt Hepler6b3a6c92020-08-03 10:15:56 -0700539 dir_pw_bytes,
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800540 dir_pw_log,
541 ]
Wyatt Hepler8e94ed62020-03-05 16:45:32 -0800542 sources = [ "key_value_store_binary_format_test.cc" ]
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800543}
544
David Rogers67cf06d2021-04-15 14:56:46 -0700545pw_test("key_value_store_put_test") {
Wyatt Hepler16b04522020-02-07 16:00:14 -0800546 deps = [
547 ":crc16",
David Rogersd64cc012020-05-26 12:37:37 -0700548 ":fake_flash",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800549 ":pw_kvs",
David Rogers5cc5ce82020-03-13 19:19:03 -0700550 ":test_partition",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800551 ]
David Rogers67cf06d2021-04-15 14:56:46 -0700552 sources = [ "key_value_store_put_test.cc" ]
Wyatt Hepler16b04522020-02-07 16:00:14 -0800553}
554
David Rogerseaa2a692020-08-07 00:48:16 -0700555pw_test("fake_flash_test_key_value_store_test") {
556 deps = [
557 ":fake_flash_test_key_value_store",
David Rogersa5c39a52020-08-07 18:18:56 -0700558 ":test_key_value_store_test",
Ewout van Bekkum1d0aa6d2021-09-22 12:38:10 -0700559 "$dir_pw_sync:borrow",
David Rogerseaa2a692020-08-07 00:48:16 -0700560 ]
David Rogerseaa2a692020-08-07 00:48:16 -0700561}
562
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800563pw_test("key_value_store_map_test") {
564 deps = [
565 ":crc16",
David Rogersd64cc012020-05-26 12:37:37 -0700566 ":fake_flash",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800567 ":pw_kvs",
David Rogers5cc5ce82020-03-13 19:19:03 -0700568 ":test_partition",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800569 dir_pw_checksum,
570 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800571 sources = [ "key_value_store_map_test.cc" ]
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800572}
573
Wyatt Heplerc84393f2020-03-20 11:23:24 -0700574pw_test("sectors_test") {
575 deps = [
David Rogersd64cc012020-05-26 12:37:37 -0700576 ":fake_flash",
Wyatt Heplerc84393f2020-03-20 11:23:24 -0700577 ":pw_kvs",
Wyatt Heplerc84393f2020-03-20 11:23:24 -0700578 ]
579 sources = [ "sectors_test.cc" ]
580}
581
Rob Olivere64daf42020-11-24 11:50:03 -0500582pw_test("key_test") {
583 deps = [ ":pw_kvs" ]
584 sources = [ "key_test.cc" ]
585}
586
David Rogersd5138f32020-04-28 15:18:56 -0700587pw_test("key_value_store_wear_test") {
Armando Montanezf9e93e12020-04-22 07:44:14 -0700588 deps = [
David Rogersd64cc012020-05-26 12:37:37 -0700589 ":fake_flash",
Armando Montanezf9e93e12020-04-22 07:44:14 -0700590 ":pw_kvs",
David Rogersd5138f32020-04-28 15:18:56 -0700591 ":test_partition",
Armando Montanezf9e93e12020-04-22 07:44:14 -0700592 dir_pw_log,
593 ]
594 sources = [ "key_value_store_wear_test.cc" ]
595}
596
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800597pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800598 sources = [ "docs.rst" ]
David Rogersa2c4d1d2021-01-15 03:17:28 -0800599 report_deps = [ ":kvs_size" ]
600}
601
602pw_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 Hepler2ad60672020-01-21 08:00:16 -0800624}