From 328ef819e6d4b4445bacb708cad5a425ec2a0f27 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 20 Mar 2026 16:02:44 -1000 Subject: [PATCH] [benchmark] Fix plaintext frame benchmark build: enable api codegen --- tests/benchmarks/components/api/__init__.py | 8 ++++++++ tests/benchmarks/components/api/bench_plaintext_frame.cpp | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 tests/benchmarks/components/api/__init__.py diff --git a/tests/benchmarks/components/api/__init__.py b/tests/benchmarks/components/api/__init__.py new file mode 100644 index 0000000000..c0b5788993 --- /dev/null +++ b/tests/benchmarks/components/api/__init__.py @@ -0,0 +1,8 @@ +from tests.testing_helpers import ComponentManifestOverride + + +def override_manifest(manifest: ComponentManifestOverride) -> None: + # api must run its to_code during benchmark builds because it + # defines USE_API, USE_API_PLAINTEXT, and USE_API_NOISE which + # are needed by the frame helper headers. + manifest.enable_codegen() diff --git a/tests/benchmarks/components/api/bench_plaintext_frame.cpp b/tests/benchmarks/components/api/bench_plaintext_frame.cpp index ea1f890989..85de6ee347 100644 --- a/tests/benchmarks/components/api/bench_plaintext_frame.cpp +++ b/tests/benchmarks/components/api/bench_plaintext_frame.cpp @@ -1,3 +1,6 @@ +#include "esphome/core/defines.h" +#ifdef USE_API_PLAINTEXT + #include #include #include @@ -122,3 +125,5 @@ static void PlaintextFrame_WriteBatch5(benchmark::State &state) { BENCHMARK(PlaintextFrame_WriteBatch5); } // namespace esphome::api::benchmarks + +#endif // USE_API_PLAINTEXT