blob: bd19c75d4aa31f622a0a3cc0468c916cfb3a8c65 [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
15import("$dir_pw_docgen/docs.gni")
16import("$dir_pw_unit_test/test.gni")
17
18config("default_config") {
19 include_dirs = [ "public" ]
20}
21
22source_set("pw_kvs") {
23 public_configs = [ ":default_config" ]
24 public = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080025 "public/pw_kvs/alignment.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080026 "public/pw_kvs/checksum.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080027 "public/pw_kvs/flash_memory.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080028 "public/pw_kvs/key_value_store.h",
Wyatt Hepler1927c282020-02-11 16:45:02 -080029 "public/pw_kvs/output.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080030 ]
31 sources = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080032 "alignment.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080033 "checksum.cc",
34 "flash_memory.cc",
Wyatt Hepler6e3a83b2020-02-04 07:36:45 -080035 "format.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080036 "key_value_store.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080037 "pw_kvs_private/format.h",
38 "pw_kvs_private/macros.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080039 ]
40 sources += public
41 public_deps = [
Wyatt Hepler1c329ca2020-02-07 18:07:23 -080042 dir_pw_containers,
Wyatt Heplerad684a12020-02-04 17:17:29 -080043 dir_pw_span,
44 dir_pw_status,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080045 ]
46 deps = [
47 dir_pw_checksum,
48 dir_pw_log,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080049 ]
Wyatt Hepler97fc7942020-02-06 15:55:45 -080050 friend = [
51 ":entry_test",
52 ":key_value_store_test",
53 ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080054}
55
Wyatt Heplerec4b9352020-01-31 15:51:50 -080056source_set("crc16") {
57 public = [
58 "public/pw_kvs/crc16_checksum.h",
59 ]
60 sources = public
61 public_deps = [
62 ":pw_kvs",
63 dir_pw_checksum,
64 ]
65}
66
Wyatt Heplerad684a12020-02-04 17:17:29 -080067source_set("in_memory_fake_flash") {
68 public = [
69 "public/pw_kvs/in_memory_fake_flash.h",
70 ]
71 sources = public
72 visibility = [ ":*" ]
73 public_deps = [
74 dir_pw_log,
75 ]
76}
77
Wyatt Heplerd6216822020-02-04 16:39:15 -080078executable("debug_cli") {
79 sources = [
80 "debug_cli.cc",
81 ]
82 deps = [
83 ":crc16",
84 ":in_memory_fake_flash",
85 ":pw_kvs",
86 ]
87}
88
Wyatt Hepler2ad60672020-01-21 08:00:16 -080089pw_test_group("tests") {
Wyatt Heplerec4b9352020-01-31 15:51:50 -080090 tests = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080091 ":alignment_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080092 ":checksum_test",
Wyatt Hepler97fc7942020-02-06 15:55:45 -080093 ":entry_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080094 ":key_value_store_test",
Wyatt Hepler16b04522020-02-07 16:00:14 -080095 ":key_value_store_fuzz_test",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -080096 ":key_value_store_map_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080097 ]
98}
99
Wyatt Hepler1927c282020-02-11 16:45:02 -0800100pw_test("alignment_test") {
101 deps = [
102 ":pw_kvs",
103 ]
104 sources = [
105 "alignment_test.cc",
106 ]
107}
108
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800109pw_test("checksum_test") {
110 deps = [
111 ":crc16",
112 ":pw_kvs",
113 dir_pw_log,
114 ]
115 sources = [
116 "checksum_test.cc",
117 ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800118}
119
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800120pw_test("entry_test") {
121 deps = [
122 ":pw_kvs",
123 ]
124 sources = [
125 "entry_test.cc",
126 ]
127}
128
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800129pw_test("key_value_store_test") {
130 deps = [
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800131 ":crc16",
Wyatt Heplerad684a12020-02-04 17:17:29 -0800132 ":in_memory_fake_flash",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800133 ":pw_kvs",
134 dir_pw_checksum,
135 dir_pw_log,
136 ]
137 sources = [
138 "key_value_store_test.cc",
139 ]
140}
141
Wyatt Hepler16b04522020-02-07 16:00:14 -0800142pw_test("key_value_store_fuzz_test") {
143 deps = [
144 ":crc16",
145 ":in_memory_fake_flash",
146 ":pw_kvs",
147 ]
148 sources = [
149 "key_value_store_fuzz_test.cc",
150 ]
151}
152
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800153pw_test("key_value_store_map_test") {
154 deps = [
155 ":crc16",
156 ":in_memory_fake_flash",
157 ":pw_kvs",
158 dir_pw_checksum,
159 ]
160 sources = [
161 "key_value_store_map_test.cc",
162 ]
163}
164
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800165pw_doc_group("docs") {
166 sources = [
167 "docs.rst",
168 ]
169}