blob: 10c83d692a62c4f8589b038b1f492854230f4ea0 [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 Hepler88adfe82020-02-20 19:33:27 -080028 "public/pw_kvs/format.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080029 "public/pw_kvs/key_value_store.h",
Wyatt Hepler1927c282020-02-11 16:45:02 -080030 "public/pw_kvs/output.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080031 ]
32 sources = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080033 "alignment.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080034 "checksum.cc",
Wyatt Heplerd31d9702020-02-14 08:46:36 -080035 "entry.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080036 "flash_memory.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080037 "key_value_store.cc",
Wyatt Heplerbdd8e5a2020-02-20 19:27:26 -080038 "public/pw_kvs/internal/entry.h",
Wyatt Hepler1fc11042020-02-19 17:17:51 -080039 "public/pw_kvs/internal/hash.h",
40 "public/pw_kvs/internal/key_descriptor.h",
Wyatt Hepler2c7eca02020-02-18 16:01:42 -080041 "public/pw_kvs/internal/sector_descriptor.h",
Keir Mierle0dd24a82020-02-21 16:08:59 -080042 "public/pw_kvs/internal/span_traits.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080043 "pw_kvs_private/macros.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080044 ]
45 sources += public
46 public_deps = [
Wyatt Hepler1c329ca2020-02-07 18:07:23 -080047 dir_pw_containers,
Wyatt Heplerad684a12020-02-04 17:17:29 -080048 dir_pw_span,
49 dir_pw_status,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080050 ]
51 deps = [
52 dir_pw_checksum,
53 dir_pw_log,
Wyatt Hepler2ad60672020-01-21 08:00:16 -080054 ]
Wyatt Hepler97fc7942020-02-06 15:55:45 -080055 friend = [
56 ":entry_test",
57 ":key_value_store_test",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -080058 ":key_value_store_error_handling_test",
Wyatt Heplera00d1ef2020-02-14 14:31:26 -080059 ":key_value_store_map_test",
Wyatt Hepler97fc7942020-02-06 15:55:45 -080060 ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -080061}
62
Wyatt Heplerec4b9352020-01-31 15:51:50 -080063source_set("crc16") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080064 public = [ "public/pw_kvs/crc16_checksum.h" ]
Wyatt Heplerec4b9352020-01-31 15:51:50 -080065 sources = public
66 public_deps = [
67 ":pw_kvs",
68 dir_pw_checksum,
69 ]
70}
71
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080072source_set("test_utils") {
73 public_configs = [ ":default_config" ]
Wyatt Heplerad684a12020-02-04 17:17:29 -080074 public = [
75 "public/pw_kvs/in_memory_fake_flash.h",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080076 "pw_kvs_private/byte_utils.h",
Wyatt Heplerad684a12020-02-04 17:17:29 -080077 ]
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080078 sources = [ "in_memory_fake_flash.cc" ] + public
Wyatt Heplerad684a12020-02-04 17:17:29 -080079 visibility = [ ":*" ]
80 public_deps = [
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080081 dir_pw_kvs,
Wyatt Heplerad684a12020-02-04 17:17:29 -080082 dir_pw_log,
83 ]
84}
85
Wyatt Heplerd6216822020-02-04 16:39:15 -080086executable("debug_cli") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080087 sources = [ "debug_cli.cc" ]
Wyatt Heplerd6216822020-02-04 16:39:15 -080088 deps = [
89 ":crc16",
Wyatt Heplerd6216822020-02-04 16:39:15 -080090 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -080091 ":test_utils",
Wyatt Heplerd6216822020-02-04 16:39:15 -080092 ]
93}
94
Wyatt Hepler2ad60672020-01-21 08:00:16 -080095pw_test_group("tests") {
Wyatt Heplerec4b9352020-01-31 15:51:50 -080096 tests = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080097 ":alignment_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080098 ":checksum_test",
Wyatt Hepler97fc7942020-02-06 15:55:45 -080099 ":entry_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800100 ":key_value_store_test",
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800101 ":key_value_store_error_handling_test",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800102 ":key_value_store_fuzz_test",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800103 ":key_value_store_map_test",
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800104 ]
105}
106
Wyatt Hepler1927c282020-02-11 16:45:02 -0800107pw_test("alignment_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800108 deps = [ ":pw_kvs" ]
109 sources = [ "alignment_test.cc" ]
Wyatt Hepler1927c282020-02-11 16:45:02 -0800110}
111
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800112pw_test("checksum_test") {
113 deps = [
114 ":crc16",
115 ":pw_kvs",
116 dir_pw_log,
117 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800118 sources = [ "checksum_test.cc" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800119}
120
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800121pw_test("entry_test") {
122 deps = [
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800123 ":crc16",
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800124 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800125 ":test_utils",
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800126 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800127 sources = [ "entry_test.cc" ]
Wyatt Hepler97fc7942020-02-06 15:55:45 -0800128}
129
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800130pw_test("key_value_store_test") {
131 deps = [
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800132 ":crc16",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800133 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800134 ":test_utils",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800135 dir_pw_checksum,
136 dir_pw_log,
137 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800138 sources = [ "key_value_store_test.cc" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800139}
140
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800141pw_test("key_value_store_error_handling_test") {
142 deps = [
143 ":crc16",
144 ":pw_kvs",
145 ":test_utils",
146 dir_pw_log,
147 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800148 sources = [ "key_value_store_error_handling_test.cc" ]
Wyatt Hepler118fc3c2020-02-21 14:23:19 -0800149}
150
Wyatt Hepler16b04522020-02-07 16:00:14 -0800151pw_test("key_value_store_fuzz_test") {
152 deps = [
153 ":crc16",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800154 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800155 ":test_utils",
Wyatt Hepler16b04522020-02-07 16:00:14 -0800156 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800157 sources = [ "key_value_store_fuzz_test.cc" ]
Wyatt Hepler16b04522020-02-07 16:00:14 -0800158}
159
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800160pw_test("key_value_store_map_test") {
161 deps = [
162 ":crc16",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800163 ":pw_kvs",
Wyatt Heplercdd6dfc2020-02-18 12:04:04 -0800164 ":test_utils",
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800165 dir_pw_checksum,
166 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800167 sources = [ "key_value_store_map_test.cc" ]
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800168}
169
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800170pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800171 sources = [ "docs.rst" ]
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800172}