blob: dcf7f664558cbf0a221b93c89d9005b55c093eaa [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
15load(
16 "//pw_build:pigweed.bzl",
17 "pw_cc_library",
18 "pw_cc_test",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"]) # Apache License 2.0
24
25pw_cc_library(
26 name = "pw_kvs",
27 srcs = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080028 "alignment.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080029 "checksum.cc",
Wyatt Heplerd31d9702020-02-14 08:46:36 -080030 "entry.cc",
Wyatt Hepler7ded6da2020-03-11 18:24:43 -070031 "entry_cache.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080032 "flash_memory.cc",
Wyatt Hepler22d0d9f2020-03-05 14:57:11 -080033 "format.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080034 "key_value_store.cc",
Wyatt Heplerbdd8e5a2020-02-20 19:27:26 -080035 "public/pw_kvs/internal/entry.h",
Wyatt Hepler7ded6da2020-03-11 18:24:43 -070036 "public/pw_kvs/internal/entry_cache.h",
Wyatt Hepler1fc11042020-02-19 17:17:51 -080037 "public/pw_kvs/internal/hash.h",
38 "public/pw_kvs/internal/key_descriptor.h",
Wyatt Hepler2454f2d2020-03-20 12:54:35 -070039 "public/pw_kvs/internal/sectors.h",
Keir Mierle0dd24a82020-02-21 16:08:59 -080040 "public/pw_kvs/internal/span_traits.h",
David Rogersca592962020-07-01 09:21:54 -070041 "pw_kvs_private/config.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080042 "pw_kvs_private/macros.h",
Wyatt Heplerc84393f2020-03-20 11:23:24 -070043 "sectors.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080044 ],
45 hdrs = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080046 "public/pw_kvs/alignment.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080047 "public/pw_kvs/checksum.h",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080048 "public/pw_kvs/crc16_checksum.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080049 "public/pw_kvs/flash_memory.h",
Wyatt Hepler88adfe82020-02-20 19:33:27 -080050 "public/pw_kvs/format.h",
Wyatt Hepler06b1b0b2020-03-09 08:26:34 -070051 "public/pw_kvs/io.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080052 "public/pw_kvs/key_value_store.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080053 ],
54 includes = ["public"],
55 deps = [
David Rogersc0104462020-05-08 15:50:23 -070056 "//pw_assert",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080057 "//pw_checksum",
Wyatt Hepler1c329ca2020-02-07 18:07:23 -080058 "//pw_containers",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080059 "//pw_log",
Rob Mohr06819482020-04-06 13:25:43 -070060 "//pw_log:facade",
61 "//pw_span",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080062 "//pw_status",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080063 ],
64)
65
Wyatt Heplerec4b9352020-01-31 15:51:50 -080066pw_cc_library(
67 name = "crc16",
68 hdrs = [
69 "public/pw_kvs/crc16_checksum.h",
70 ],
71 deps = [
72 ":pw_kvs",
73 "//pw_checksum",
Rob Mohr06819482020-04-06 13:25:43 -070074 "//pw_span",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080075 ],
76)
77
Wyatt Heplerad684a12020-02-04 17:17:29 -080078pw_cc_library(
David Rogersd64cc012020-05-26 12:37:37 -070079 name = "fake_flash",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080080 srcs = [
David Rogersd64cc012020-05-26 12:37:37 -070081 "fake_flash_memory.cc",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080082 ],
Wyatt Heplerad684a12020-02-04 17:17:29 -080083 hdrs = [
David Rogersd64cc012020-05-26 12:37:37 -070084 "public/pw_kvs/fake_flash_memory.h",
Wyatt Heplerad684a12020-02-04 17:17:29 -080085 ],
Wyatt Heplerad684a12020-02-04 17:17:29 -080086 deps = [
David Rogersd64cc012020-05-26 12:37:37 -070087 ":pw_kvs",
Rob Mohr06819482020-04-06 13:25:43 -070088 "//pw_containers",
Wyatt Heplerad684a12020-02-04 17:17:29 -080089 "//pw_log",
Rob Mohr06819482020-04-06 13:25:43 -070090 "//pw_log:facade",
91 "//pw_span",
Wyatt Heplerad684a12020-02-04 17:17:29 -080092 "//pw_status",
93 ],
94)
95
David Rogers5cc5ce82020-03-13 19:19:03 -070096pw_cc_library(
David Rogersca592962020-07-01 09:21:54 -070097 name = "flash_partition_test",
98 srcs = [
99 "flash_partition_test.cc",
100 ],
101 hdrs = [
102 "public/pw_kvs/flash_partition_test.h",
103 ],
104 deps = [
105 ":pw_kvs",
106 "//pw_log",
107 "//pw_span",
108 ],
109)
110
111pw_cc_library(
David Rogersd64cc012020-05-26 12:37:37 -0700112 name = "test_utils",
113 hdrs = [
114 "pw_kvs_private/byte_utils.h",
115 ],
116 includes = ["public"],
117 visibility = ["//visibility:private"],
118)
119
120pw_cc_library(
David Rogers5cc5ce82020-03-13 19:19:03 -0700121 name = "test_partition",
122 srcs = [
123 "flash_partition_with_stats.cc",
124 ],
125 hdrs = [
126 "public/pw_kvs/flash_partition_with_stats.h",
127 ],
128 includes = ["public"],
129 visibility = ["//visibility:private"],
130 deps = [
Rob Mohr06819482020-04-06 13:25:43 -0700131 "//pw_containers",
David Rogers5cc5ce82020-03-13 19:19:03 -0700132 "//pw_kvs",
133 "//pw_log",
Rob Mohr06819482020-04-06 13:25:43 -0700134 "//pw_log:facade",
David Rogers5cc5ce82020-03-13 19:19:03 -0700135 "//pw_status",
136 ],
137)
138
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800139pw_cc_test(
Wyatt Hepler1927c282020-02-11 16:45:02 -0800140 name = "alignment_test",
141 srcs = [
142 "alignment_test.cc",
143 ],
144 deps = [
145 ":pw_kvs",
Rob Mohr06819482020-04-06 13:25:43 -0700146 "//pw_status",
147 "//pw_unit_test",
Wyatt Hepler1927c282020-02-11 16:45:02 -0800148 ],
149)
150
151pw_cc_test(
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800152 name = "checksum_test",
153 srcs = ["checksum_test.cc"],
154 deps = [
155 ":crc16",
156 ":pw_kvs",
157 "//pw_checksum",
158 "//pw_log",
Rob Mohr06819482020-04-06 13:25:43 -0700159 "//pw_unit_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800160 ],
161)
162
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800163pw_cc_test(
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800164 name = "entry_test",
165 srcs = [
166 "entry_test.cc",
167 ],
168 deps = [
169 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800170 ":test_utils",
Rob Mohr4d615402020-04-03 12:13:19 -0700171 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700172 "//pw_span",
173 "//pw_unit_test",
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800174 ],
175)
176
177pw_cc_test(
Wyatt Hepler7ded6da2020-03-11 18:24:43 -0700178 name = "entry_cache_test",
179 srcs = ["entry_cache_test.cc"],
Wyatt Hepler02946272020-03-18 10:36:22 -0700180 deps = [
181 ":pw_kvs",
182 ":test_utils",
Rob Mohr4d615402020-04-03 12:13:19 -0700183 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700184 "//pw_unit_test",
Wyatt Hepler02946272020-03-18 10:36:22 -0700185 ],
Wyatt Hepler7ded6da2020-03-11 18:24:43 -0700186)
187
188pw_cc_test(
David Rogersca592962020-07-01 09:21:54 -0700189 name = "fake_flash_partition_test",
190 srcs = ["fake_flash_partition_test.cc"],
191 deps = [
192 ":pw_kvs",
193 ":flash_partition_test",
194 "//pw_log:backend",
195 "//pw_unit_test",
196 ],
197)
198
199pw_cc_test(
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800200 name = "key_value_store_test",
201 srcs = ["key_value_store_test.cc"],
202 deps = [
203 ":crc16",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800204 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800205 ":test_utils",
Rob Mohr06819482020-04-06 13:25:43 -0700206 "//pw_checksum",
Rob Mohr4d615402020-04-03 12:13:19 -0700207 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700208 "//pw_log:facade",
209 "//pw_span",
210 "//pw_status",
211 "//pw_string",
212 "//pw_unit_test",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800213 ],
214)
215
216pw_cc_test(
Wyatt Hepler8e94ed62020-03-05 16:45:32 -0800217 name = "key_value_store_binary_format_test",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800218 srcs = [
Wyatt Hepler8e94ed62020-03-05 16:45:32 -0800219 "key_value_store_binary_format_test.cc",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800220 ],
221 deps = [
222 ":crc16",
223 ":pw_kvs",
224 ":test_utils",
Rob Mohr4d615402020-04-03 12:13:19 -0700225 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700226 "//pw_unit_test",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800227 ],
228)
229
230pw_cc_test(
Wyatt Hepler16b04522020-02-07 16:00:14 -0800231 name = "key_value_store_fuzz_test",
232 srcs = ["key_value_store_fuzz_test.cc"],
233 deps = [
234 ":crc16",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800235 ":pw_kvs",
David Rogers5cc5ce82020-03-13 19:19:03 -0700236 ":test_partition",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800237 ":test_utils",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800238 "//pw_checksum",
Rob Mohr4d615402020-04-03 12:13:19 -0700239 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700240 "//pw_unit_test",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800241 ],
242)
243
244pw_cc_test(
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800245 name = "key_value_store_map_test",
246 srcs = ["key_value_store_map_test.cc"],
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800247 deps = [
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800248 ":crc16",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800249 ":pw_kvs",
David Rogers5cc5ce82020-03-13 19:19:03 -0700250 ":test_partition",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800251 ":test_utils",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800252 "//pw_checksum",
Rob Mohr4d615402020-04-03 12:13:19 -0700253 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700254 "//pw_log:facade",
255 "//pw_span",
256 "//pw_unit_test",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800257 ],
258)
Wyatt Heplerd6216822020-02-04 16:39:15 -0800259
Wyatt Heplerc84393f2020-03-20 11:23:24 -0700260pw_cc_test(
261 name = "sectors_test",
262 srcs = ["sectors_test.cc"],
263 deps = [
264 ":pw_kvs",
265 ":test_utils",
Rob Mohr4d615402020-04-03 12:13:19 -0700266 "//pw_log:backend",
Rob Mohr06819482020-04-06 13:25:43 -0700267 "//pw_unit_test",
Wyatt Heplerc84393f2020-03-20 11:23:24 -0700268 ],
269)
270
Armando Montanezf9e93e12020-04-22 07:44:14 -0700271pw_cc_test(
272 name = "key_value_store_wear_test",
273 srcs = [
274 "key_value_store_wear_test.cc",
275 ],
276 deps = [
277 ":pw_kvs",
David Rogersd5138f32020-04-28 15:18:56 -0700278 ":test_partition",
Armando Montanezf9e93e12020-04-22 07:44:14 -0700279 ":test_utils",
280 "//pw_log:backend",
281 "//pw_unit_test",
282 ],
283)