1# Copyright 2024 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_binary", 18 "pw_cc_test", 19) 20 21package(default_visibility = ["//visibility:public"]) 22 23licenses(["notice"]) 24 25# Libraries 26 27cc_library( 28 name = "named_u32", 29 testonly = True, 30 hdrs = ["named_u32.h"], 31 includes = [".."], 32 deps = [ 33 "//pw_bytes", 34 "//pw_string", 35 ], 36) 37 38cc_library( 39 name = "custom_allocator", 40 testonly = True, 41 srcs = ["custom_allocator.cc"], 42 hdrs = ["custom_allocator.h"], 43 includes = [".."], 44 deps = [ 45 "//pw_allocator:allocator", 46 "//pw_log", 47 "//pw_result", 48 ], 49) 50 51cc_library( 52 name = "custom_allocator_test_harness", 53 testonly = True, 54 hdrs = ["custom_allocator_test_harness.h"], 55 includes = [".."], 56 deps = [ 57 ":custom_allocator", 58 "//pw_allocator:test_harness", 59 "//pw_allocator:testing", 60 ], 61) 62 63# Examples 64 65pw_cc_test( 66 name = "basic", 67 srcs = ["basic.cc"], 68 deps = [ 69 ":named_u32", 70 "//pw_allocator:allocator", 71 "//pw_allocator:testing", 72 ], 73) 74 75pw_cc_test( 76 name = "block_allocator", 77 srcs = ["block_allocator.cc"], 78 deps = [ 79 ":named_u32", 80 "//pw_allocator:block_allocator", 81 ], 82) 83 84pw_cc_test( 85 name = "custom_allocator_perf_test", 86 srcs = ["custom_allocator_perf_test.cc"], 87 deps = [ 88 ":custom_allocator_test_harness", 89 "//pw_perf_test", 90 "//pw_random", 91 ], 92) 93 94pw_cc_test( 95 name = "custom_allocator_test", 96 srcs = ["custom_allocator_test.cc"], 97 deps = [ 98 ":custom_allocator", 99 ":custom_allocator_test_harness", 100 ":named_u32", 101 "//pw_allocator:fuzzing", 102 "//pw_allocator:testing", 103 "//pw_containers:vector", 104 "//pw_fuzzer:fuzztest", 105 ], 106) 107 108pw_cc_test( 109 name = "linker_sections", 110 srcs = ["linker_sections.cc"], 111 deps = [ 112 ":named_u32", 113 "//pw_allocator:allocator", 114 "//pw_allocator:block_allocator", 115 ], 116) 117 118pw_cc_test( 119 name = "metrics", 120 srcs = ["metrics.cc"], 121 deps = [ 122 ":named_u32", 123 "//pw_allocator:testing", 124 "//pw_allocator:tracking_allocator", 125 "//pw_tokenizer", 126 ], 127) 128 129pw_cc_test( 130 name = "pmr", 131 testonly = True, 132 srcs = ["pmr.cc"], 133 deps = [ 134 "//pw_allocator:allocator", 135 "//pw_allocator:testing", 136 ], 137) 138 139pw_cc_binary( 140 name = "size_report", 141 testonly = True, 142 srcs = ["size_report.cc"], 143 deps = [ 144 ":custom_allocator", 145 "//pw_allocator:block_allocator", 146 "//pw_allocator:size_reporter", 147 ], 148) 149 150pw_cc_test( 151 name = "spin_lock", 152 srcs = ["spin_lock.cc"], 153 deps = [ 154 ":named_u32", 155 "//pw_allocator:synchronized_allocator", 156 "//pw_allocator:testing", 157 "//pw_assert", 158 "//pw_sync:interrupt_spin_lock", 159 "//pw_thread:test_thread_context", 160 "//pw_thread:thread", 161 "//pw_thread:thread_core", 162 ], 163) 164