pw_unit_test: Fix googletest backend

With this change, you can use the googletest backend with
simple_printing_main.

The most important changes here are,

1. Making //pw_unit_test directly expose the pw_unit_test/framework.h
   header.
2. Adding the dep on googletest_handler_adapter to the googletest
   target. This was a missing dependency before.

But doing (2) requires removing a bunch of target_compatible_with
attributes that produced a circular dependency. When the backend is set
to googletest, pw_unit_test depends on googletest, which depends on
googletest_handler_adapter. But the googletest_handler_adapter used to
have a dependency on pw_unit_test itself, through the config_setting
that depends on pw_unit_test.

I also remove the target_compatible_with on the "framework_test". This
test should be compatible with all backends, and indeed passes for the
googletest backend.

Internal-only consequences: this change makes is a layering check
violation to #include "gtest/gtest.h" from a pw_cc_test that doesn't
directly depend on googletest. This is good: tests that use pw_unit_test
as a framework should #include "pw_unit_test/framework.h" instead,
which provides only that subset of gtest.h symbols that are actually
supported when building an on-device test.

Test: bazel test --//targets:pw_unit_test_backend=//pw_unit_test:googletest //...
Fixed: b/324116813
Change-Id: I1bd77d936adcfcbcf5122fabd6a9b9f158926188
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/190593
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
1 file changed
tree: b0ed6e808f5dbeb955ffe396b8963ed6ad3d6ffe
  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_async2/
  19. pw_async2_basic/
  20. pw_async_basic/
  21. pw_base64/
  22. pw_bloat/
  23. pw_blob_store/
  24. pw_bluetooth/
  25. pw_bluetooth_hci/
  26. pw_bluetooth_profiles/
  27. pw_bluetooth_sapphire/
  28. pw_boot/
  29. pw_boot_cortex_m/
  30. pw_build/
  31. pw_build_info/
  32. pw_build_mcuxpresso/
  33. pw_bytes/
  34. pw_channel/
  35. pw_checksum/
  36. pw_chre/
  37. pw_chrono/
  38. pw_chrono_embos/
  39. pw_chrono_freertos/
  40. pw_chrono_rp2040/
  41. pw_chrono_stl/
  42. pw_chrono_threadx/
  43. pw_chrono_zephyr/
  44. pw_cli/
  45. pw_compilation_testing/
  46. pw_config_loader/
  47. pw_console/
  48. pw_containers/
  49. pw_cpu_exception/
  50. pw_cpu_exception_cortex_m/
  51. pw_crypto/
  52. pw_digital_io/
  53. pw_digital_io_mcuxpresso/
  54. pw_digital_io_rp2040/
  55. pw_docgen/
  56. pw_doctor/
  57. pw_emu/
  58. pw_env_setup/
  59. pw_env_setup_zephyr/
  60. pw_file/
  61. pw_format/
  62. pw_function/
  63. pw_fuzzer/
  64. pw_grpc/
  65. pw_hdlc/
  66. pw_hex_dump/
  67. pw_i2c/
  68. pw_i2c_linux/
  69. pw_i2c_mcuxpresso/
  70. pw_ide/
  71. pw_interrupt/
  72. pw_interrupt_cortex_m/
  73. pw_interrupt_xtensa/
  74. pw_interrupt_zephyr/
  75. pw_intrusive_ptr/
  76. pw_json/
  77. pw_kvs/
  78. pw_libc/
  79. pw_libcxx/
  80. pw_log/
  81. pw_log_android/
  82. pw_log_basic/
  83. pw_log_null/
  84. pw_log_rpc/
  85. pw_log_string/
  86. pw_log_tokenized/
  87. pw_log_zephyr/
  88. pw_malloc/
  89. pw_malloc_freelist/
  90. pw_malloc_freertos/
  91. pw_metric/
  92. pw_minimal_cpp_stdlib/
  93. pw_module/
  94. pw_multibuf/
  95. pw_multisink/
  96. pw_package/
  97. pw_perf_test/
  98. pw_persistent_ram/
  99. pw_polyfill/
  100. pw_preprocessor/
  101. pw_presubmit/
  102. pw_protobuf/
  103. pw_protobuf_compiler/
  104. pw_random/
  105. pw_result/
  106. pw_ring_buffer/
  107. pw_router/
  108. pw_rpc/
  109. pw_rpc_transport/
  110. pw_rust/
  111. pw_snapshot/
  112. pw_software_update/
  113. pw_span/
  114. pw_spi/
  115. pw_spi_mcuxpresso/
  116. pw_spi_rp2040/
  117. pw_status/
  118. pw_stm32cube_build/
  119. pw_stream/
  120. pw_stream_shmem_mcuxpresso/
  121. pw_stream_uart_linux/
  122. pw_stream_uart_mcuxpresso/
  123. pw_string/
  124. pw_symbolizer/
  125. pw_sync/
  126. pw_sync_baremetal/
  127. pw_sync_embos/
  128. pw_sync_freertos/
  129. pw_sync_stl/
  130. pw_sync_threadx/
  131. pw_sync_zephyr/
  132. pw_sys_io/
  133. pw_sys_io_ambiq_sdk/
  134. pw_sys_io_arduino/
  135. pw_sys_io_baremetal_lm3s6965evb/
  136. pw_sys_io_baremetal_stm32f429/
  137. pw_sys_io_emcraft_sf2/
  138. pw_sys_io_mcuxpresso/
  139. pw_sys_io_rp2040/
  140. pw_sys_io_stdio/
  141. pw_sys_io_stm32cube/
  142. pw_sys_io_zephyr/
  143. pw_system/
  144. pw_target_runner/
  145. pw_thread/
  146. pw_thread_embos/
  147. pw_thread_freertos/
  148. pw_thread_stl/
  149. pw_thread_threadx/
  150. pw_thread_zephyr/
  151. pw_tls_client/
  152. pw_tls_client_boringssl/
  153. pw_tls_client_mbedtls/
  154. pw_tokenizer/
  155. pw_toolchain/
  156. pw_toolchain_bazel/
  157. pw_trace/
  158. pw_trace_tokenized/
  159. pw_transfer/
  160. pw_unit_test/
  161. pw_unit_test_zephyr/
  162. pw_varint/
  163. pw_watch/
  164. pw_web/
  165. pw_work_queue/
  166. seed/
  167. targets/
  168. third_party/
  169. ts/
  170. zephyr/
  171. .bazelignore
  172. .bazelrc
  173. .black.toml
  174. .clang-format
  175. .clang-tidy
  176. .eslintrc.cjs
  177. .git-blame-ignore-revs
  178. .gitattributes
  179. .gitignore
  180. .gn
  181. .mypy.ini
  182. .prettierignore
  183. .prettierrc.cjs
  184. .pw_ide.yaml
  185. .pylintrc
  186. activate.bat
  187. Android.bp
  188. AUTHORS
  189. bootstrap.bat
  190. bootstrap.sh
  191. BUILD.bazel
  192. BUILD.gn
  193. BUILDCONFIG.gn
  194. CMakeLists.txt
  195. jest.config.ts
  196. Kconfig.zephyr
  197. LICENSE
  198. modules.gni
  199. OWNERS
  200. package-lock.json
  201. package.json
  202. pigweed.json
  203. PIGWEED_MODULES
  204. README.md
  205. rollup.config.js
  206. tsconfig.json
  207. 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