[PATCH v5 24/27] perf test event_update: Ensure tools is initialized

From: Ian Rogers
Date: Fri Jul 12 2024 - 14:18:59 EST


Ensure tool is initialized to avoid lazy initialization pattern so
that more uses of struct perf_tool can be made const.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/tests/event_update.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index fdecad920f59..d6b4ce3ef4ee 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -103,6 +103,7 @@ static int test__event_update(struct test_suite *test __maybe_unused, int subtes
TEST_ASSERT_VAL("failed to synthesize attr update scale",
!perf_event__synthesize_event_update_scale(NULL, evsel, process_event_scale));

+ perf_tool__init(&tmp.tool, /*ordered_events=*/false);
tmp.name = evsel__name(evsel);

TEST_ASSERT_VAL("failed to synthesize attr update name",
--
2.45.2.993.g49e7a77208-goog