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