pw_allocator: Refactor test support and example allocator

This CL does the following:
 * It move the SimpleAllocator previously described in Block's
   class-level comments to an actual source file, and adds a test for
   it. The class is now included directly into the module docs.
 * It refactors the FakeAllocator to use SimpleAllocator and renames it
   to AllocatorForTest. It also moves this from pw_allocator_private/ to
   public/pw_allocator/, as these utilities may be useful for testing
   custom allocators provided by downstream projects.
 * It updates the callers of FakeAllocator to use AllocatorForTest.

Bug: b/306686936

Change-Id: I41953e3b64fa831bd23418496ffa683917944b3f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/177653
Commit-Queue: Aaron Green <aarongreen@google.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
16 files changed
tree: d5d96f74042fc0385245f98ea2333281bb75d8d7
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. kudzu/
  7. pw_alignment/
  8. pw_allocator/
  9. pw_analog/
  10. pw_android_toolchain/
  11. pw_arduino_build/
  12. pw_assert/
  13. pw_assert_basic/
  14. pw_assert_log/
  15. pw_assert_tokenized/
  16. pw_assert_zephyr/
  17. pw_async/
  18. pw_async_basic/
  19. pw_base64/
  20. pw_bloat/
  21. pw_blob_store/
  22. pw_bluetooth/
  23. pw_bluetooth_hci/
  24. pw_bluetooth_profiles/
  25. pw_boot/
  26. pw_boot_cortex_m/
  27. pw_build/
  28. pw_build_info/
  29. pw_build_mcuxpresso/
  30. pw_bytes/
  31. pw_checksum/
  32. pw_chre/
  33. pw_chrono/
  34. pw_chrono_embos/
  35. pw_chrono_freertos/
  36. pw_chrono_rp2040/
  37. pw_chrono_stl/
  38. pw_chrono_threadx/
  39. pw_chrono_zephyr/
  40. pw_cli/
  41. pw_compilation_testing/
  42. pw_console/
  43. pw_containers/
  44. pw_cpu_exception/
  45. pw_cpu_exception_cortex_m/
  46. pw_crypto/
  47. pw_digital_io/
  48. pw_digital_io_mcuxpresso/
  49. pw_digital_io_rp2040/
  50. pw_docgen/
  51. pw_doctor/
  52. pw_emu/
  53. pw_env_setup/
  54. pw_file/
  55. pw_format/
  56. pw_function/
  57. pw_fuzzer/
  58. pw_hdlc/
  59. pw_hex_dump/
  60. pw_i2c/
  61. pw_i2c_linux/
  62. pw_i2c_mcuxpresso/
  63. pw_ide/
  64. pw_interrupt/
  65. pw_interrupt_cortex_m/
  66. pw_interrupt_xtensa/
  67. pw_interrupt_zephyr/
  68. pw_intrusive_ptr/
  69. pw_kvs/
  70. pw_libc/
  71. pw_libcxx/
  72. pw_log/
  73. pw_log_android/
  74. pw_log_basic/
  75. pw_log_null/
  76. pw_log_rpc/
  77. pw_log_string/
  78. pw_log_tokenized/
  79. pw_log_zephyr/
  80. pw_malloc/
  81. pw_malloc_freelist/
  82. pw_metric/
  83. pw_minimal_cpp_stdlib/
  84. pw_module/
  85. pw_multibuf/
  86. pw_multisink/
  87. pw_package/
  88. pw_perf_test/
  89. pw_persistent_ram/
  90. pw_polyfill/
  91. pw_preprocessor/
  92. pw_presubmit/
  93. pw_protobuf/
  94. pw_protobuf_compiler/
  95. pw_random/
  96. pw_result/
  97. pw_ring_buffer/
  98. pw_router/
  99. pw_rpc/
  100. pw_rpc_transport/
  101. pw_rust/
  102. pw_snapshot/
  103. pw_software_update/
  104. pw_span/
  105. pw_spi/
  106. pw_spi_mcuxpresso/
  107. pw_status/
  108. pw_stm32cube_build/
  109. pw_stream/
  110. pw_stream_shmem_mcuxpresso/
  111. pw_stream_uart_linux/
  112. pw_stream_uart_mcuxpresso/
  113. pw_string/
  114. pw_symbolizer/
  115. pw_sync/
  116. pw_sync_baremetal/
  117. pw_sync_embos/
  118. pw_sync_freertos/
  119. pw_sync_stl/
  120. pw_sync_threadx/
  121. pw_sync_zephyr/
  122. pw_sys_io/
  123. pw_sys_io_ambiq_sdk/
  124. pw_sys_io_arduino/
  125. pw_sys_io_baremetal_lm3s6965evb/
  126. pw_sys_io_baremetal_stm32f429/
  127. pw_sys_io_emcraft_sf2/
  128. pw_sys_io_mcuxpresso/
  129. pw_sys_io_rp2040/
  130. pw_sys_io_stdio/
  131. pw_sys_io_stm32cube/
  132. pw_sys_io_zephyr/
  133. pw_system/
  134. pw_target_runner/
  135. pw_thread/
  136. pw_thread_embos/
  137. pw_thread_freertos/
  138. pw_thread_stl/
  139. pw_thread_threadx/
  140. pw_thread_zephyr/
  141. pw_tls_client/
  142. pw_tls_client_boringssl/
  143. pw_tls_client_mbedtls/
  144. pw_tokenizer/
  145. pw_tool/
  146. pw_toolchain/
  147. pw_toolchain_bazel/
  148. pw_trace/
  149. pw_trace_tokenized/
  150. pw_transfer/
  151. pw_unit_test/
  152. pw_unit_test_zephyr/
  153. pw_varint/
  154. pw_watch/
  155. pw_web/
  156. pw_work_queue/
  157. seed/
  158. targets/
  159. third_party/
  160. ts/
  161. zephyr/
  162. .bazelignore
  163. .bazelrc
  164. .black.toml
  165. .clang-format
  166. .clang-tidy
  167. .eslintrc.cjs
  168. .git-blame-ignore-revs
  169. .gitattributes
  170. .gitignore
  171. .gn
  172. .mypy.ini
  173. .prettierignore
  174. .prettierrc.cjs
  175. .pw_ide.yaml
  176. .pylintrc
  177. activate.bat
  178. Android.bp
  179. AUTHORS
  180. bootstrap.bat
  181. bootstrap.sh
  182. BUILD.bazel
  183. BUILD.gn
  184. BUILDCONFIG.gn
  185. CMakeLists.txt
  186. jest.config.ts
  187. Kconfig.zephyr
  188. LICENSE
  189. modules.gni
  190. OWNERS
  191. package-lock.json
  192. package.json
  193. pigweed.json
  194. PIGWEED_MODULES
  195. README.md
  196. rollup.config.js
  197. tsconfig.json
  198. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links