From nobody Tue Dec 16 14:04:55 2025 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40BB12BD035 for ; Sun, 5 Oct 2025 18:25:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759688723; cv=none; b=A/crfz3q761KWKWmH+7ERDy0wwLKbdGRrN9MxKY3E7SZzsTEXLiBsRtadL+eNWZDKWIRd9IboLcWB+wZQ9OkURv0TzuEuxQXcBAV5YzaHTdALLFccvbREEO0YYolmm+Ml5Y1kRoIAXGxHktgIkNxW4yTnOcADetycwmvscLGFag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759688723; c=relaxed/simple; bh=owA6Dul8xuC7liXoWhhYtUEG1P4QsUcK4S5KKArIyR8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lIhqjjscueSF2FaBwUwTz4xQ0LBQp1R78hlazjPpyGO3FEamVrsP7KlCN75yByhuN69SVfBZPc4BeWMnQLPuRiXdL6yy5shOFPXSbGpCKkSgnzquyW7dS5ycB7XkZAsA9ya6F+tHSFsCQ2GsnkQG5OQGbc28SWtRJRfnHEoPgn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PkZh2peW; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PkZh2peW" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-269af520712so43510215ad.2 for ; Sun, 05 Oct 2025 11:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1759688720; x=1760293520; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=W7qNK5iIDpNPKKxVeNdUCEZsA+mwQ+oJdAT5gU/Wb8E=; b=PkZh2peW2uy5FQV84zrJesazGeNKfEjB4DRWzAzWF2rqdqx47R2Np46wpLzuAhovqb Cmj2Safp/RD8rjPAARw3CF1Ti2TxbQD+6ElZFQ4gOAX7OzUsUKzAwXgOBE3NbmZI0gj3 HLYqO08dQCTe2gQGKpAolGK172Ru2YRN0DFG1jStaKddGZkIIo4+UGbI2lYr3g2jvUOQ dZrTX/5dP0n5fEBydzkBQlsLJhERs9faKh4zl3g0NrYMrqfEnvVrsjS+yY7QAqI24pF5 uf5ImYPvZnLNWFhsvaoQMtYuDzGDvP9XzkUrGfF+Yph7L3nezeu2A2gXEtUtvWoitpbv dC/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759688720; x=1760293520; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W7qNK5iIDpNPKKxVeNdUCEZsA+mwQ+oJdAT5gU/Wb8E=; b=IuP9fYEUvLMPRjMf/ZXr/JTrngHJoKwXdqyT/iEWZV2WyfunvPNse0cpFWwzzHUBS0 awwSA1JpIiIRlGsn8svvMzscjt0DJQo/+KMKLZ+s8CIkXa+FQGDTUKM3A17tG+pXHzw6 xQSpMs8eHIBhErHQvtQdxJg8VSz++nEpY1AwmH2uheZ/piskceOOZmcLi/5lODyXyxlE V9f32wzrjBYWj48zignpTh7/wZvPMmDcX1v6AylLuvwGRokJ0i5IbRI7pqGN7GUsgC/W sbwncT6cvVVAaGenruIUmNa+YOcZzGEsJif8EpkX9a2uh/iFsjM82Q9ChisiJn8kKKV9 Btqw== X-Forwarded-Encrypted: i=1; AJvYcCUy73bt9K4cemg0edHohcLq0uqr56/gAIomCDPsXJzldlAeo1uGkNK6o/KSZpLVFz2kM/fGsKIdKU5kwE4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxnd87Qxqa2z39nnfe/3OUvjQPO50UFwqX4zNKgGncCF89yl3bf /OOcQwoB+vEb6JRm+Ox+RJjAulX7+hiNBr+bK2dv4l1uYbMwEwBH8a3J4BBnhF887OnO0BokVJB cCoPo7pIidA== X-Google-Smtp-Source: AGHT+IG3KGj1URQ3+t4KcGrErnRLkbLPAiEbVPHcN8t7u0pQskOL7LpOgK6xBFzk3xlTrSWNryj81hlzW3OV X-Received: from plblw4.prod.google.com ([2002:a17:903:2ac4:b0:248:7db1:3800]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:f8b:b0:26b:5346:5857 with SMTP id d9443c01a7336-28e9a5a8788mr123575145ad.24.1759688719756; Sun, 05 Oct 2025 11:25:19 -0700 (PDT) Date: Sun, 5 Oct 2025 11:24:24 -0700 In-Reply-To: <20251005182430.2791371-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251005182430.2791371-1-irogers@google.com> X-Mailer: git-send-email 2.51.0.618.g983fd99d29-goog Message-ID: <20251005182430.2791371-22-irogers@google.com> Subject: [PATCH v7 21/27] perf test parse-events: Use evsel__match for legacy events From: Ian Rogers To: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Xu Yang , Thomas Falcon , Andi Kleen , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Atish Patra , Beeman Strong , Leo Yan , Vince Weaver Cc: Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Switch from the test's assert_hw/test_config to the common evsel__match code that appropriately handles events with both legacy and sysfs/json encoding. For tests asserting that a config value matches that placed in the perf_event_attr just directly compare the config values. Signed-off-by: Ian Rogers --- tools/perf/tests/parse-events.c | 299 ++++++++------------------------ 1 file changed, 74 insertions(+), 225 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-event= s.c index 13c1e4c45ea2..f6cd994f75cf 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -155,60 +155,38 @@ static int test__checkevent_numeric(struct evlist *ev= list) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", 1 =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); + TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); return TEST_OK; } =20 =20 -static int assert_hw(struct perf_evsel *evsel, enum perf_hw_id id, const c= har *name) -{ - struct perf_pmu *pmu; - - if (evsel->attr.type =3D=3D PERF_TYPE_HARDWARE) { - TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, id)); - return 0; - } - pmu =3D perf_pmus__find_by_type(evsel->attr.type); - - TEST_ASSERT_VAL("unexpected PMU type", pmu); - TEST_ASSERT_VAL("PMU missing event", perf_pmu__have_event(pmu, name)); - return 0; -} - static int test__checkevent_symbolic_name(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_VAL("wrong number of entries", 0 !=3D evlist->core.nr_entries= ); =20 - perf_evlist__for_each_evsel(&evlist->core, evsel) { - int ret =3D assert_hw(evsel, PERF_COUNT_HW_INSTRUCTIONS, "instructions"); - - if (ret) - return ret; - } + evlist__for_each_entry(evlist, evsel) + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); =20 return TEST_OK; } =20 static int test__checkevent_symbolic_name_config(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_VAL("wrong number of entries", 0 !=3D evlist->core.nr_entries= ); =20 - perf_evlist__for_each_evsel(&evlist->core, evsel) { - int ret =3D assert_hw(evsel, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - - if (ret) - return ret; + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); /* * The period value gets configured within evlist__config, * while this test executes only parse events method. */ - TEST_ASSERT_VAL("wrong period", 0 =3D=3D evsel->attr.sample_period); - TEST_ASSERT_VAL("wrong config1", 0 =3D=3D evsel->attr.config1); - TEST_ASSERT_VAL("wrong config2", 1 =3D=3D evsel->attr.config2); + TEST_ASSERT_VAL("wrong period", 0 =3D=3D evsel->core.attr.sample_period); + TEST_ASSERT_VAL("wrong config1", 0 =3D=3D evsel->core.attr.config1); + TEST_ASSERT_VAL("wrong config2", 1 =3D=3D evsel->core.attr.config2); } return TEST_OK; } @@ -218,8 +196,7 @@ static int test__checkevent_symbolic_alias(struct evlis= t *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE =3D=3D evsel->core.attr.= type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_SW_PAGE_FAU= LTS)); + TEST_ASSERT_VAL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_PAG= E_FAULTS)); return TEST_OK; } =20 @@ -242,7 +219,7 @@ static int test__checkevent_breakpoint(struct evlist *e= vlist) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) =3D= =3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 =3D=3D @@ -256,7 +233,7 @@ static int test__checkevent_breakpoint_x(struct evlist = *evlist) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_X =3D=3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", default_breakpoint_len() =3D=3D evsel->co= re.attr.bp_len); @@ -270,7 +247,7 @@ static int test__checkevent_breakpoint_r(struct evlist = *evlist) TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_R =3D=3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", @@ -285,7 +262,7 @@ static int test__checkevent_breakpoint_w(struct evlist = *evlist) TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W =3D=3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", @@ -300,7 +277,7 @@ static int test__checkevent_breakpoint_rw(struct evlist= *evlist) TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R|HW_BREAKPOINT_W) =3D=3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", @@ -633,7 +610,7 @@ static int test__checkevent_list(struct evlist *evlist) /* r1 */ TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT !=3D evsel->core.attr.= type); while (evsel->core.attr.type !=3D PERF_TYPE_TRACEPOINT) { - TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); + TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong config1", 0 =3D=3D evsel->core.attr.config1); TEST_ASSERT_VAL("wrong config2", 0 =3D=3D evsel->core.attr.config2); TEST_ASSERT_VAL("wrong config3", 0 =3D=3D evsel->core.attr.config3); @@ -657,7 +634,7 @@ static int test__checkevent_list(struct evlist *evlist) /* 1:1:hp */ evsel =3D evsel__next(evsel); TEST_ASSERT_VAL("wrong type", 1 =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); + TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -673,14 +650,14 @@ static int test__checkevent_pmu_name(struct evlist *e= vlist) /* cpu/config=3D1,name=3Dkrava/u */ TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); + TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "krava")); =20 /* cpu/config=3D2/u" */ evsel =3D evsel__next(evsel); TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 2)); + TEST_ASSERT_VAL("wrong config", 2 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "cpu/config=3D2/u")); =20 return TEST_OK; @@ -693,7 +670,7 @@ static int test__checkevent_pmu_partial_time_callgraph(= struct evlist *evlist) /* cpu/config=3D1,call-graph=3Dfp,time,period=3D100000/ */ TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 1)); + TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); /* * The period, time and callgraph value gets configured within evlist__co= nfig, * while this test executes only parse events method. @@ -705,7 +682,7 @@ static int test__checkevent_pmu_partial_time_callgraph(= struct evlist *evlist) /* cpu/config=3D2,call-graph=3Dno,time=3D0,period=3D2000/ */ evsel =3D evsel__next(evsel); TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 2)); + TEST_ASSERT_VAL("wrong config", 2 =3D=3D evsel->core.attr.config); /* * The period, time and callgraph value gets configured within evlist__co= nfig, * while this test executes only parse events method. @@ -855,7 +832,7 @@ static int test__checkterms_simple(struct parse_events_= terms *terms) =20 static int test__group1(struct evlist *evlist) { - struct evsel *evsel, *leader; + struct evsel *evsel =3D NULL, *leader; =20 TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries =3D=3D (num_core_entries() * 2)); @@ -863,14 +840,9 @@ static int test__group1(struct evlist *evlist) evlist__nr_groups(evlist) =3D=3D num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* instructions:k */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -884,10 +856,7 @@ static int test__group1(struct evlist *evlist) =20 /* cycles:upp */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -914,13 +883,9 @@ static int test__group2(struct evlist *evlist) TEST_ASSERT_VAL("wrong number of groups", 1 =3D=3D evlist__nr_groups(evli= st)); =20 evlist__for_each_entry(evlist, evsel) { - int ret; - - if (evsel->core.attr.type =3D=3D PERF_TYPE_SOFTWARE) { + if (evsel__match(evsel, SOFTWARE, SW_PAGE_FAULTS)) { /* faults + :ku modifier */ leader =3D evsel; - TEST_ASSERT_VAL("wrong config", - test_config(evsel, PERF_COUNT_SW_PAGE_FAULTS)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -933,8 +898,7 @@ static int test__group2(struct evlist *evlist) TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); continue; } - if (evsel->core.attr.type =3D=3D PERF_TYPE_HARDWARE && - test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) { + if (evsel__match(evsel, HARDWARE, HW_BRANCH_INSTRUCTIONS)) { /* branches + :u modifier */ TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= ); @@ -948,10 +912,7 @@ static int test__group2(struct evlist *evlist) continue; } /* cycles:k */ - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -967,7 +928,6 @@ static int test__group2(struct evlist *evlist) static int test__group3(struct evlist *evlist __maybe_unused) { struct evsel *evsel, *group1_leader =3D NULL, *group2_leader =3D NULL; - int ret; =20 TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries =3D=3D (3 * perf_pmus__num_core_pmus() + 2)); @@ -998,8 +958,7 @@ static int test__group3(struct evlist *evlist __maybe_u= nused) TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); continue; } - if (evsel->core.attr.type =3D=3D PERF_TYPE_HARDWARE && - test_config(evsel, PERF_COUNT_HW_CPU_CYCLES)) { + if (evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) { if (evsel->core.attr.exclude_user) { /* group1 cycles:kppp */ TEST_ASSERT_VAL("wrong exclude_user", @@ -1042,7 +1001,7 @@ static int test__group3(struct evlist *evlist __maybe= _unused) } if (evsel->core.attr.type =3D=3D 1) { /* group2 1:3 + G modifier */ - TEST_ASSERT_VAL("wrong config", test_config(evsel, 3)); + TEST_ASSERT_VAL("wrong config", 3 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1055,10 +1014,7 @@ static int test__group3(struct evlist *evlist __mayb= e_unused) continue; } /* instructions:u */ - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1073,7 +1029,7 @@ static int test__group3(struct evlist *evlist __maybe= _unused) =20 static int test__group4(struct evlist *evlist __maybe_unused) { - struct evsel *evsel, *leader; + struct evsel *evsel =3D NULL, *leader; =20 TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries =3D=3D (num_core_entries() * 2)); @@ -1081,14 +1037,9 @@ static int test__group4(struct evlist *evlist __mayb= e_unused) num_core_entries() =3D=3D evlist__nr_groups(evlist)); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles:u + p */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1103,10 +1054,7 @@ static int test__group4(struct evlist *evlist __mayb= e_unused) =20 /* instructions:kp + p */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1123,7 +1071,6 @@ static int test__group4(struct evlist *evlist __maybe= _unused) static int test__group5(struct evlist *evlist __maybe_unused) { struct evsel *evsel =3D NULL, *leader; - int ret; =20 TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries =3D=3D (5 * num_core_entries())); @@ -1133,10 +1080,7 @@ static int test__group5(struct evlist *evlist __mayb= e_unused) for (int i =3D 0; i < num_core_entries(); i++) { /* cycles + G */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1151,10 +1095,7 @@ static int test__group5(struct evlist *evlist __mayb= e_unused) =20 /* instructions + G */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1168,10 +1109,7 @@ static int test__group5(struct evlist *evlist __mayb= e_unused) for (int i =3D 0; i < num_core_entries(); i++) { /* cycles:G */ evsel =3D leader =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1186,10 +1124,7 @@ static int test__group5(struct evlist *evlist __mayb= e_unused) =20 /* instructions:G */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1202,10 +1137,7 @@ static int test__group5(struct evlist *evlist __mayb= e_unused) for (int i =3D 0; i < num_core_entries(); i++) { /* cycles */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1227,14 +1159,9 @@ static int test__group_gh1(struct evlist *evlist) evlist__nr_groups(evlist) =3D=3D num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles + :H group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1248,10 +1175,7 @@ static int test__group_gh1(struct evlist *evlist) =20 /* cache-misses:G + :H group modifier */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1274,14 +1198,9 @@ static int test__group_gh2(struct evlist *evlist) evlist__nr_groups(evlist) =3D=3D num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles + :G group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1295,10 +1214,7 @@ static int test__group_gh2(struct evlist *evlist) =20 /* cache-misses:H + :G group modifier */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1321,14 +1237,9 @@ static int test__group_gh3(struct evlist *evlist) evlist__nr_groups(evlist) =3D=3D num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles:G + :u group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1342,10 +1253,7 @@ static int test__group_gh3(struct evlist *evlist) =20 /* cache-misses:H + :u group modifier */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1368,14 +1276,9 @@ static int test__group_gh4(struct evlist *evlist) evlist__nr_groups(evlist) =3D=3D num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles:G + :uG group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1389,10 +1292,7 @@ static int test__group_gh4(struct evlist *evlist) =20 /* cache-misses:H + :uG group modifier */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1413,14 +1313,9 @@ static int test__leader_sample1(struct evlist *evlis= t) evlist->core.nr_entries =3D=3D (3 * num_core_entries())); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles - sampling group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1433,10 +1328,7 @@ static int test__leader_sample1(struct evlist *evlis= t) =20 /* cache-misses - not sampling */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1448,10 +1340,8 @@ static int test__leader_sample1(struct evlist *evlis= t) =20 /* branch-misses - not sampling */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_BRANCH_MISSES, "branch-mis= ses"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel= ); TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv); @@ -1473,14 +1363,9 @@ static int test__leader_sample2(struct evlist *evlis= t __maybe_unused) evlist->core.nr_entries =3D=3D (2 * num_core_entries())); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* instructions - sampling group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instruction= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1493,10 +1378,8 @@ static int test__leader_sample2(struct evlist *evlis= t __maybe_unused) =20 /* branch-misses - not sampling */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_BRANCH_MISSES, "branch-mis= ses"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); @@ -1536,14 +1419,9 @@ static int test__pinned_group(struct evlist *evlist) evlist->core.nr_entries =3D=3D (3 * num_core_entries())); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles - group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong group name", !evsel->group_name); TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); /* TODO: The group modifier is not copied to the split group leader. */ @@ -1552,18 +1430,13 @@ static int test__pinned_group(struct evlist *evlist) =20 /* cache-misses - can not be pinned, but will go on with the leader */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); =20 /* branch-misses - ditto */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_BRANCH_MISSES, "branch-mis= ses"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); } return TEST_OK; @@ -1590,14 +1463,9 @@ static int test__exclusive_group(struct evlist *evli= st) evlist->core.nr_entries =3D=3D 3 * num_core_entries()); =20 for (int i =3D 0; i < num_core_entries(); i++) { - int ret; - /* cycles - group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); TEST_ASSERT_VAL("wrong group name", !evsel->group_name); TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); /* TODO: The group modifier is not copied to the split group leader. */ @@ -1606,18 +1474,13 @@ static int test__exclusive_group(struct evlist *evl= ist) =20 /* cache-misses - can not be pinned, but will go on with the leader */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CACHE_MISSES, "cache-misse= s"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); =20 /* branch-misses - ditto */ evsel =3D evsel__next(evsel); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_BRANCH_MISSES, "branch-mis= ses"); - if (ret) - return ret; - + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); } return TEST_OK; @@ -1628,7 +1491,7 @@ static int test__checkevent_breakpoint_len(struct evl= ist *evlist) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) =3D= =3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 =3D=3D @@ -1643,7 +1506,7 @@ static int test__checkevent_breakpoint_len_w(struct e= vlist *evlist) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0)); + TEST_ASSERT_VAL("wrong config", 0 =3D=3D evsel->core.attr.config); TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W =3D=3D evsel->core.attr.bp_type); TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 =3D=3D @@ -1671,8 +1534,7 @@ static int test__checkevent_precise_max_modifier(stru= ct evlist *evlist) =20 TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries =3D=3D 1 + num_core_entries()); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE =3D=3D evsel->core.attr.= type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_SW_TASK_CLO= CK)); + TEST_ASSERT_VAL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_TAS= K_CLOCK)); return TEST_OK; } =20 @@ -1751,7 +1613,6 @@ static bool test__acr_valid(void) static int test__ratio_to_prev(struct evlist *evlist) { struct evsel *evsel; - int ret; =20 TEST_ASSERT_VAL("wrong number of entries", 2 * perf_pmus__num_core_pmus()= =3D=3D evlist->core.nr_entries); =20 @@ -1764,16 +1625,16 @@ static int test__ratio_to_prev(struct evlist *evlis= t) TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members =3D=3D = 2); TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)); } else { TEST_ASSERT_VAL("wrong config2", 0 =3D=3D evsel->core.attr.config2); TEST_ASSERT_VAL("wrong leader", !evsel__is_group_leader(evsel)); TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members =3D=3D = 0); TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_INSTRUCTIONS, "instructio= ns"); + TEST_ASSERT_VAL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)); } - if (ret) - return ret; /* * The period value gets configured within evlist__config, * while this test executes only parse events method. @@ -1799,18 +1660,15 @@ static int test__checkevent_raw_pmu(struct evlist *= evlist) =20 TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE =3D=3D evsel->core.attr.= type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a)); + TEST_ASSERT_VAL("wrong config", 0x1a =3D=3D evsel->core.attr.config); return TEST_OK; } =20 static int test__sym_event_slash(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); - int ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - - if (ret) - return ret; =20 + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU_= CYCLES)); TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); return TEST_OK; } @@ -1818,11 +1676,8 @@ static int test__sym_event_slash(struct evlist *evli= st) static int test__sym_event_dc(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); - int ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - - if (ret) - return ret; =20 + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU_= CYCLES)); TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user); return TEST_OK; } @@ -1830,11 +1685,8 @@ static int test__sym_event_dc(struct evlist *evlist) static int test__term_equal_term(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); - int ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - - if (ret) - return ret; =20 + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU_= CYCLES)); TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "name") =3D=3D = 0); return TEST_OK; } @@ -1842,11 +1694,8 @@ static int test__term_equal_term(struct evlist *evli= st) static int test__term_equal_legacy(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); - int ret =3D assert_hw(&evsel->core, PERF_COUNT_HW_CPU_CYCLES, "cycles"); - - if (ret) - return ret; =20 + TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU_= CYCLES)); TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "l1d") =3D=3D 0= ); return TEST_OK; } --=20 2.51.0.618.g983fd99d29-goog