diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72c3762189d..a6b9f3580d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -339,6 +339,7 @@ jobs: with: run: ${{ steps.build.outputs.binary }} token: ${{ secrets.CODSPEED_TOKEN }} + mode: simulation clang-tidy-single: name: ${{ matrix.name }} diff --git a/script/test_helpers.py b/script/test_helpers.py index 1941168dafa..3a7e23c0a78 100644 --- a/script/test_helpers.py +++ b/script/test_helpers.py @@ -248,7 +248,9 @@ def compile_and_get_binary( domain_list = config.setdefault(domain, []) CORE.testing_ensure_platform_registered(domain) domain_list.append({CONF_PLATFORM: component}) - else: + # Skip "core" — it's a pseudo-component handled by the build + # system, not a real loadable component (get_component returns None) + elif get_component(component_name) is not None: config.setdefault(component_name, []) # Register platforms from the extra config (benchmark.yaml) so diff --git a/tests/benchmarks/components/api/bench_application_loop.cpp b/tests/benchmarks/components/core/bench_application_loop.cpp similarity index 100% rename from tests/benchmarks/components/api/bench_application_loop.cpp rename to tests/benchmarks/components/core/bench_application_loop.cpp diff --git a/tests/benchmarks/components/core/bench_helpers.cpp b/tests/benchmarks/components/core/bench_helpers.cpp new file mode 100644 index 00000000000..15e0bc5ab1a --- /dev/null +++ b/tests/benchmarks/components/core/bench_helpers.cpp @@ -0,0 +1,26 @@ +#include + +#include "esphome/core/helpers.h" + +namespace esphome::benchmarks { + +// --- random_float() --- +// Ported from ol.yaml:148 "Random Float Benchmark" + +static void BM_RandomFloat(benchmark::State &state) { + for (auto _ : state) { + benchmark::DoNotOptimize(random_float()); + } +} +BENCHMARK(BM_RandomFloat); + +// --- random_uint32() --- + +static void BM_RandomUint32(benchmark::State &state) { + for (auto _ : state) { + benchmark::DoNotOptimize(random_uint32()); + } +} +BENCHMARK(BM_RandomUint32); + +} // namespace esphome::benchmarks diff --git a/tests/benchmarks/components/api/bench_scheduler.cpp b/tests/benchmarks/components/core/bench_scheduler.cpp similarity index 100% rename from tests/benchmarks/components/api/bench_scheduler.cpp rename to tests/benchmarks/components/core/bench_scheduler.cpp