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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_bloat/bloat.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_docgen/docs.gni") 20import("$dir_pw_sync/backend.gni") 21import("$dir_pw_unit_test/test.gni") 22 23config("public_include_path") { 24 include_dirs = [ "public" ] 25 visibility = [ ":*" ] 26} 27 28pw_source_set("pw_blob_store") { 29 public_configs = [ ":public_include_path" ] 30 public = [ 31 "public/pw_blob_store/blob_store.h", 32 "public/pw_blob_store/internal/metadata_format.h", 33 ] 34 sources = [ "blob_store.cc" ] 35 public_deps = [ 36 "$dir_pw_sync:borrow", 37 dir_pw_bytes, 38 dir_pw_kvs, 39 dir_pw_preprocessor, 40 dir_pw_status, 41 dir_pw_stream, 42 ] 43 deps = [ 44 dir_pw_assert, 45 dir_pw_checksum, 46 dir_pw_log, 47 ] 48} 49 50pw_source_set("flat_file_system_entry") { 51 public_configs = [ ":public_include_path" ] 52 public_deps = [ 53 ":pw_blob_store", 54 "$dir_pw_file:flat_file_system", 55 "$dir_pw_sync:lock_annotations", 56 "$dir_pw_sync:virtual_basic_lockable", 57 dir_pw_status, 58 ] 59 public = [ "public/pw_blob_store/flat_file_system_entry.h" ] 60 sources = [ "flat_file_system_entry.cc" ] 61 deps = [ dir_pw_assert ] 62} 63 64pw_test_group("tests") { 65 tests = [ 66 ":blob_store_test_1_alignment", 67 ":blob_store_test_16_alignment", 68 ":blob_store_deferred_write_test", 69 ":blob_store_chunk_write_test", 70 ":flat_file_system_entry_test", 71 ] 72} 73 74pw_test("blob_store_test_1_alignment") { 75 deps = [ 76 ":pw_blob_store", 77 "$dir_pw_kvs:crc16", 78 "$dir_pw_kvs:fake_flash", 79 "$dir_pw_kvs:fake_flash_test_key_value_store", 80 "$dir_pw_sync:borrow", 81 dir_pw_log, 82 dir_pw_random, 83 ] 84 sources = [ "blob_store_test.cc" ] 85} 86 87pw_test("blob_store_test_16_alignment") { 88 deps = [ 89 ":pw_blob_store", 90 "$dir_pw_kvs:crc16", 91 "$dir_pw_kvs:fake_flash", 92 "$dir_pw_kvs:fake_flash_test_key_value_store", 93 "$dir_pw_sync:borrow", 94 dir_pw_log, 95 dir_pw_random, 96 ] 97 sources = [ "blob_store_test.cc" ] 98 defines = [ "PW_FLASH_TEST_ALIGNMENT=16U" ] 99} 100 101pw_test("blob_store_chunk_write_test") { 102 deps = [ 103 ":pw_blob_store", 104 "$dir_pw_kvs:crc16", 105 "$dir_pw_kvs:fake_flash", 106 "$dir_pw_kvs:fake_flash_test_key_value_store", 107 dir_pw_log, 108 dir_pw_random, 109 ] 110 sources = [ "blob_store_chunk_write_test.cc" ] 111} 112 113pw_test("blob_store_deferred_write_test") { 114 deps = [ 115 ":pw_blob_store", 116 "$dir_pw_kvs:crc16", 117 "$dir_pw_kvs:fake_flash", 118 "$dir_pw_kvs:fake_flash_test_key_value_store", 119 dir_pw_log, 120 dir_pw_random, 121 ] 122 sources = [ "blob_store_deferred_write_test.cc" ] 123} 124 125pw_test("flat_file_system_entry_test") { 126 enable_if = pw_sync_MUTEX_BACKEND != "" 127 deps = [ 128 ":flat_file_system_entry", 129 ":pw_blob_store", 130 "$dir_pw_kvs:crc16", 131 "$dir_pw_kvs:fake_flash", 132 "$dir_pw_kvs:fake_flash_test_key_value_store", 133 "$dir_pw_sync:mutex", 134 dir_pw_random, 135 ] 136 sources = [ "flat_file_system_entry_test.cc" ] 137} 138 139pw_doc_group("docs") { 140 sources = [ "docs.rst" ] 141 report_deps = [ ":blob_size" ] 142} 143 144pw_size_report("blob_size") { 145 title = "Pigweed BlobStore size report" 146 147 # To see all the symbols, uncomment the following: 148 # Note: The size report RST table won't be generated when full_report = true. 149 # full_report = true 150 151 binaries = [ 152 { 153 target = "size_report:basic_blob" 154 base = "size_report:base" 155 label = "BlobStore" 156 }, 157 ] 158 159 binaries += [ 160 { 161 target = "size_report:deferred_write_blob" 162 base = "size_report:base" 163 label = "BlobStore with deferred write" 164 }, 165 ] 166} 167