From 41a1cc1f51229bcb0a6afa8a0ee8ff501433d2e2 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 5 Jan 2025 17:24:41 +0100 Subject: [PATCH] run benchee tests with the builtin profilers automatically as well --- lib/benchee/profile.ex | 6 ++++-- test/benchee_test.exs | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/benchee/profile.ex b/lib/benchee/profile.ex index 17a057c9..a1c94162 100644 --- a/lib/benchee/profile.ex +++ b/lib/benchee/profile.ex @@ -26,8 +26,10 @@ defmodule Benchee.Profile do @builtin_profilers [:cprof, :eprof, :fprof] # https://hexdocs.pm/mix/1.17.0/Mix.Tasks.Profile.Tprof.html # Tprof was introduced in elixir 1.17.0 and requires OTP 27 - # Elixir errors out fine, but our test kind of put their trust into `builtin_profilers` being runnable. - if Version.match?(System.version(), ">= 1.17.0") && String.to_integer(System.otp_release()) >= 27 do + # Elixir errors out fine, but our test kind of put their trust into `builtin_profilers` + # being runnable. + if Version.match?(System.version(), ">= 1.17.0") && + String.to_integer(System.otp_release()) >= 27 do @builtin_profilers [:tprof | @builtin_profilers] end diff --git a/test/benchee_test.exs b/test/benchee_test.exs index c04e0eab..f39ba816 100644 --- a/test/benchee_test.exs +++ b/test/benchee_test.exs @@ -925,8 +925,7 @@ defmodule BencheeTest do assert output =~ end_of_profiling_regex(Profile.default_profiler()) end - @profilers [:cprof, :eprof, :fprof] - for profiler <- @profilers do + for profiler <- Benchee.Profile.builtin_profilers() do @profiler profiler test "integration profiling runs #{inspect(@profiler)} profiler" do output =