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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | "pw_cc_test", |
| 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
| 25 | pw_cc_library( |
| 26 | name = "pw_kvs", |
| 27 | srcs = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 28 | "alignment.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 29 | "checksum.cc", |
Wyatt Hepler | d31d970 | 2020-02-14 08:46:36 -0800 | [diff] [blame] | 30 | "entry.cc", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 31 | "entry_cache.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 32 | "flash_memory.cc", |
Wyatt Hepler | 22d0d9f | 2020-03-05 14:57:11 -0800 | [diff] [blame] | 33 | "format.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 34 | "key_value_store.cc", |
Wyatt Hepler | bdd8e5a | 2020-02-20 19:27:26 -0800 | [diff] [blame] | 35 | "public/pw_kvs/internal/entry.h", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 36 | "public/pw_kvs/internal/entry_cache.h", |
Wyatt Hepler | 1fc1104 | 2020-02-19 17:17:51 -0800 | [diff] [blame] | 37 | "public/pw_kvs/internal/hash.h", |
| 38 | "public/pw_kvs/internal/key_descriptor.h", |
Wyatt Hepler | 2454f2d | 2020-03-20 12:54:35 -0700 | [diff] [blame] | 39 | "public/pw_kvs/internal/sectors.h", |
Keir Mierle | 0dd24a8 | 2020-02-21 16:08:59 -0800 | [diff] [blame] | 40 | "public/pw_kvs/internal/span_traits.h", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 41 | "pw_kvs_private/macros.h", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 42 | "sectors.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 43 | ], |
| 44 | hdrs = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 45 | "public/pw_kvs/alignment.h", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 46 | "public/pw_kvs/checksum.h", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 47 | "public/pw_kvs/crc16_checksum.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 48 | "public/pw_kvs/flash_memory.h", |
Wyatt Hepler | 88adfe8 | 2020-02-20 19:33:27 -0800 | [diff] [blame] | 49 | "public/pw_kvs/format.h", |
Wyatt Hepler | 06b1b0b | 2020-03-09 08:26:34 -0700 | [diff] [blame] | 50 | "public/pw_kvs/io.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 51 | "public/pw_kvs/key_value_store.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 52 | ], |
| 53 | includes = ["public"], |
| 54 | deps = [ |
David Rogers | c010446 | 2020-05-08 15:50:23 -0700 | [diff] [blame] | 55 | "//pw_assert", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 56 | "//pw_checksum", |
Wyatt Hepler | 1c329ca | 2020-02-07 18:07:23 -0800 | [diff] [blame] | 57 | "//pw_containers", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 58 | "//pw_log", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 59 | "//pw_log:facade", |
| 60 | "//pw_span", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 61 | "//pw_status", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 62 | ], |
| 63 | ) |
| 64 | |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 65 | pw_cc_library( |
| 66 | name = "crc16", |
| 67 | hdrs = [ |
| 68 | "public/pw_kvs/crc16_checksum.h", |
| 69 | ], |
| 70 | deps = [ |
| 71 | ":pw_kvs", |
| 72 | "//pw_checksum", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 73 | "//pw_span", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 74 | ], |
| 75 | ) |
| 76 | |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 77 | pw_cc_library( |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 78 | name = "fake_flash", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 79 | srcs = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 80 | "fake_flash_memory.cc", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 81 | ], |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 82 | hdrs = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 83 | "public/pw_kvs/fake_flash_memory.h", |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 84 | ], |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 85 | deps = [ |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 86 | ":pw_kvs", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 87 | "//pw_containers", |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 88 | "//pw_log", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 89 | "//pw_log:facade", |
| 90 | "//pw_span", |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 91 | "//pw_status", |
| 92 | ], |
| 93 | ) |
| 94 | |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 95 | pw_cc_library( |
David Rogers | d64cc01 | 2020-05-26 12:37:37 -0700 | [diff] [blame] | 96 | name = "test_utils", |
| 97 | hdrs = [ |
| 98 | "pw_kvs_private/byte_utils.h", |
| 99 | ], |
| 100 | includes = ["public"], |
| 101 | visibility = ["//visibility:private"], |
| 102 | ) |
| 103 | |
| 104 | pw_cc_library( |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 105 | name = "test_partition", |
| 106 | srcs = [ |
| 107 | "flash_partition_with_stats.cc", |
| 108 | ], |
| 109 | hdrs = [ |
| 110 | "public/pw_kvs/flash_partition_with_stats.h", |
| 111 | ], |
| 112 | includes = ["public"], |
| 113 | visibility = ["//visibility:private"], |
| 114 | deps = [ |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 115 | "//pw_containers", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 116 | "//pw_kvs", |
| 117 | "//pw_log", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 118 | "//pw_log:facade", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 119 | "//pw_status", |
| 120 | ], |
| 121 | ) |
| 122 | |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 123 | pw_cc_test( |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 124 | name = "alignment_test", |
| 125 | srcs = [ |
| 126 | "alignment_test.cc", |
| 127 | ], |
| 128 | deps = [ |
| 129 | ":pw_kvs", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 130 | "//pw_status", |
| 131 | "//pw_unit_test", |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 132 | ], |
| 133 | ) |
| 134 | |
| 135 | pw_cc_test( |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 136 | name = "checksum_test", |
| 137 | srcs = ["checksum_test.cc"], |
| 138 | deps = [ |
| 139 | ":crc16", |
| 140 | ":pw_kvs", |
| 141 | "//pw_checksum", |
| 142 | "//pw_log", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 143 | "//pw_unit_test", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 144 | ], |
| 145 | ) |
| 146 | |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 147 | pw_cc_test( |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 148 | name = "entry_test", |
| 149 | srcs = [ |
| 150 | "entry_test.cc", |
| 151 | ], |
| 152 | deps = [ |
| 153 | ":pw_kvs", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 154 | ":test_utils", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 155 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 156 | "//pw_span", |
| 157 | "//pw_unit_test", |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 158 | ], |
| 159 | ) |
| 160 | |
| 161 | pw_cc_test( |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 162 | name = "entry_cache_test", |
| 163 | srcs = ["entry_cache_test.cc"], |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 164 | deps = [ |
| 165 | ":pw_kvs", |
| 166 | ":test_utils", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 167 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 168 | "//pw_unit_test", |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 169 | ], |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 170 | ) |
| 171 | |
| 172 | pw_cc_test( |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 173 | name = "key_value_store_test", |
| 174 | srcs = ["key_value_store_test.cc"], |
| 175 | deps = [ |
| 176 | ":crc16", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 177 | ":pw_kvs", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 178 | ":test_utils", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 179 | "//pw_checksum", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 180 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 181 | "//pw_log:facade", |
| 182 | "//pw_span", |
| 183 | "//pw_status", |
| 184 | "//pw_string", |
| 185 | "//pw_unit_test", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 186 | ], |
| 187 | ) |
| 188 | |
| 189 | pw_cc_test( |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 190 | name = "key_value_store_binary_format_test", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 191 | srcs = [ |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 192 | "key_value_store_binary_format_test.cc", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 193 | ], |
| 194 | deps = [ |
| 195 | ":crc16", |
| 196 | ":pw_kvs", |
| 197 | ":test_utils", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 198 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 199 | "//pw_unit_test", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 200 | ], |
| 201 | ) |
| 202 | |
| 203 | pw_cc_test( |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 204 | name = "key_value_store_fuzz_test", |
| 205 | srcs = ["key_value_store_fuzz_test.cc"], |
| 206 | deps = [ |
| 207 | ":crc16", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 208 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 209 | ":test_partition", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 210 | ":test_utils", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 211 | "//pw_checksum", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 212 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 213 | "//pw_unit_test", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 214 | ], |
| 215 | ) |
| 216 | |
| 217 | pw_cc_test( |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 218 | name = "key_value_store_map_test", |
| 219 | srcs = ["key_value_store_map_test.cc"], |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 220 | deps = [ |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 221 | ":crc16", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 222 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 223 | ":test_partition", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 224 | ":test_utils", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 225 | "//pw_checksum", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 226 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 227 | "//pw_log:facade", |
| 228 | "//pw_span", |
| 229 | "//pw_unit_test", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 230 | ], |
| 231 | ) |
Wyatt Hepler | d621682 | 2020-02-04 16:39:15 -0800 | [diff] [blame] | 232 | |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 233 | pw_cc_test( |
| 234 | name = "sectors_test", |
| 235 | srcs = ["sectors_test.cc"], |
| 236 | deps = [ |
| 237 | ":pw_kvs", |
| 238 | ":test_utils", |
Rob Mohr | 4d61540 | 2020-04-03 12:13:19 -0700 | [diff] [blame] | 239 | "//pw_log:backend", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 240 | "//pw_unit_test", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 241 | ], |
| 242 | ) |
| 243 | |
Armando Montanez | f9e93e1 | 2020-04-22 07:44:14 -0700 | [diff] [blame] | 244 | pw_cc_test( |
| 245 | name = "key_value_store_wear_test", |
| 246 | srcs = [ |
| 247 | "key_value_store_wear_test.cc", |
| 248 | ], |
| 249 | deps = [ |
| 250 | ":pw_kvs", |
David Rogers | d5138f3 | 2020-04-28 15:18:56 -0700 | [diff] [blame] | 251 | ":test_partition", |
Armando Montanez | f9e93e1 | 2020-04-22 07:44:14 -0700 | [diff] [blame] | 252 | ":test_utils", |
| 253 | "//pw_log:backend", |
| 254 | "//pw_unit_test", |
| 255 | ], |
| 256 | ) |