From nobody Thu Oct 2 03:34:09 2025 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.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 8B25B321454 for ; Tue, 23 Sep 2025 22:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758666859; cv=none; b=AjaUeiaxMrkCYmUO17is5iYO6lExdi6xxcKpvZTjZSVD29mk1taFlM9J/8wxXb7c4MamkWghGHoC0jaNwlvdcU/LyVucyaKZbNwkEbeSW+28lbJY791qzufNOKD9CA8l32ct8nZCunaWwNeEf22+WIZj6ajKBlaPKa4SjjVaiAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758666859; c=relaxed/simple; bh=tw4jqUWwc/Znb9lyhws3y+TkgQfeI4svTkZ+MQxfgmc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=nEpGyPIGcQUnSYjpdmrdg4gQMm0YT4wsWYz6kwarOxTHW/WOzPfu4OVEVV0ZfKEAKklNuV0rpzxTJNLzFSQjTsSYuCbcJTW2acjfMpPjBvMlCUZJUlNWkSzDUbp7wVkpyQpQH/B+dhRaYUtHVxGdOrTWpr5a3qwsQoDr0DhEEWo= 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=tfPAqga2; arc=none smtp.client-ip=209.85.210.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="tfPAqga2" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-77f14f6a553so285294b3a.1 for ; Tue, 23 Sep 2025 15:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758666852; x=1759271652; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=q20eE+rsQPE/8luB1RnFjPQ5ou7XmokZP4U+c2IW/+w=; b=tfPAqga21fuDU52mgdTPZG9thNY936yOIrHpgTHK8pIFNl0YmeWAjHqCADajeKeeEN nu2p4W0Bo/Cloj0CuWD7F8isP+4+eJ8ZEABa9EpvseR7kS1e7VITIkJ4tDuICae0Ad2P UHViGvChGId295zSAUyO5awhhd1+EjxPVyrZVvWGXssDh4awAxBjOi6Q7ige+WL/DDAx BGRea2xDVMjNrSzn5DsR8xXLEb4vfmlrH40rBnHYn58cpGHIhP87g/IRJ+MXYxFAjgso KeiUZ1G+7WSXfjzeIiR7/seFz/bcGcMHm6+t4eJIdNvB058/Qry2ga3U/A+zPUYi17Lv QSUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758666852; x=1759271652; h=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=q20eE+rsQPE/8luB1RnFjPQ5ou7XmokZP4U+c2IW/+w=; b=n9d3rruQQvRfzXhSs4xqC6nKdcmQaY+fkb9baGqdBsXzDjHjKuwz+fGs831sp/w3nI XHHbeibLEKapXQjwFxSMtXMY3l7VYEa5UnPrHjchs4n28QuXv+IYtkrwEjyTCKa6KXgH OKPvn8KTCq8cRuntiN8ZShA9KvBfzjjCHNWEbjNDVHUZjBY+ITUJsNhYhAEf7dTy8zMq FCjqTpc3jBARdnumHLTm2HlYJM56bvWImJh+ijnJ2i2BZTaXXiJ1Twqhpn7Zymwumsgo n8ZMYdtYl79QfilZWi9yFUBvjX8d4bxGMs8urg4B2WqL27HjrS7rrNv1prsI864cIafS HfEA== X-Forwarded-Encrypted: i=1; AJvYcCX/huBzUy5OklmqYqWlbuyV7Zuy62OG6AMX/C6Orh68OFMb2GxtUBRtiXzvEOmWGLbXMvGUE/aE1CO08BU=@vger.kernel.org X-Gm-Message-State: AOJu0YwhM+yWycEZOO0bqK2QcoS9GozBBqAoaqZnI9kPzb0jxPbxNsJj 1Pl5VLfOqtngimpIpd1H1UWKAk6OZeoIcZcnAT4a0Kv+e+MQNbuYeAua+bkfCVpDxvVle0BNdeg 5Wd1+gOUQxA== X-Google-Smtp-Source: AGHT+IHkEqq9pV4vUB0ehxdkg5u9vMTutITIk8FDvV3SJu/JvqpJ3JGv5UIfyoeZ9LfbMuacdt4RgfhF/Ml9 X-Received: from pfbk15.prod.google.com ([2002:a05:6a00:b00f:b0:77f:2a5e:8d0e]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:8c0a:b0:2da:f4be:c8c2 with SMTP id adf61e73a8af0-2de97106f6cmr216699637.31.1758666851792; Tue, 23 Sep 2025 15:34:11 -0700 (PDT) Date: Tue, 23 Sep 2025 15:33:12 -0700 In-Reply-To: <20250923223312.238185-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: <20250923223312.238185-1-irogers@google.com> X-Mailer: git-send-email 2.51.0.534.gc79095c0ca-goog Message-ID: <20250923223312.238185-29-irogers@google.com> Subject: [PATCH v6 28/28] perf test parse-events: Add evsel test helper From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add TEST_ASSERT_EVSEL to dump the failing evsel in the event of a failure. Signed-off-by: Ian Rogers --- tools/perf/tests/parse-events.c | 1370 +++++++++++++++++-------------- 1 file changed, 736 insertions(+), 634 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-event= s.c index 8950677ead15..643d093b6d98 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "parse-events.h" #include "evsel.h" +#include "evsel_fprintf.h" #include "evlist.h" #include #include "tests.h" @@ -37,6 +38,21 @@ static bool check_evlist(const char *test, int line, boo= l cond, struct evlist *e if (!check_evlist(test, __LINE__, cond, evlist)) \ return TEST_FAIL =20 +static bool check_evsel(const char *test, int line, bool cond, struct evse= l *evsel) +{ + struct perf_attr_details details =3D { .verbose =3D true, }; + + if (cond) + return true; + + pr_debug("FAILED %s:%d: %s\nFor evsel: ", __FILE__, line, test); + evsel__fprintf(evsel, &details, debug_file()); + return false; +} +#define TEST_ASSERT_EVSEL(test, cond, evsel) \ + if (!check_evsel(test, __LINE__, cond, evsel)) \ + return TEST_FAIL + static int num_core_entries(struct evlist *evlist) { /* @@ -58,9 +74,9 @@ static int num_core_entries(struct evlist *evlist) return 1; } =20 -static bool test_hw_config(const struct perf_evsel *evsel, __u64 expected_= config) +static bool test_hw_config(const struct evsel *evsel, __u64 expected_confi= g) { - return (evsel->attr.config & PERF_HW_EVENT_MASK) =3D=3D expected_config; + return (evsel->core.attr.config & PERF_HW_EVENT_MASK) =3D=3D expected_con= fig; } =20 #if defined(__s390x__) @@ -95,10 +111,10 @@ static int test__checkevent_tracepoint(struct evlist *= evlist) =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); TEST_ASSERT_EVLIST("wrong number of groups", 0 =3D=3D evlist__nr_groups(e= vlist), evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong sample_type", - PERF_TP_SAMPLE_TYPE =3D=3D evsel->core.attr.sample_type); - TEST_ASSERT_VAL("wrong sample_period", 1 =3D=3D evsel->core.attr.sample_p= eriod); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_TRACEPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong sample_type", + PERF_TP_SAMPLE_TYPE =3D=3D evsel->core.attr.sample_type, evsel); + TEST_ASSERT_EVSEL("wrong sample_period", 1 =3D=3D evsel->core.attr.sample= _period, evsel); return TEST_OK; } =20 @@ -110,30 +126,34 @@ static int test__checkevent_tracepoint_multi(struct e= vlist *evlist) TEST_ASSERT_EVLIST("wrong number of groups", 0 =3D=3D evlist__nr_groups(e= vlist), evlist); =20 evlist__for_each_entry(evlist, evsel) { - TEST_ASSERT_VAL("wrong type", - PERF_TYPE_TRACEPOINT =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong sample_type", - PERF_TP_SAMPLE_TYPE =3D=3D evsel->core.attr.sample_type); - TEST_ASSERT_VAL("wrong sample_period", - 1 =3D=3D evsel->core.attr.sample_period); + TEST_ASSERT_EVSEL("wrong type", + PERF_TYPE_TRACEPOINT =3D=3D evsel->core.attr.type, + evsel); + TEST_ASSERT_EVSEL("wrong sample_type", + PERF_TP_SAMPLE_TYPE =3D=3D evsel->core.attr.sample_type, + evsel); + TEST_ASSERT_EVSEL("wrong sample_period", + 1 =3D=3D evsel->core.attr.sample_period, + evsel); } return TEST_OK; } =20 static int test__checkevent_raw(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; bool raw_type_match =3D false; =20 TEST_ASSERT_EVLIST("wrong number of entries", 0 !=3D evlist->core.nr_entr= ies, evlist); =20 - perf_evlist__for_each_evsel(&evlist->core, evsel) { + evlist__for_each_entry(evlist, evsel) { struct perf_pmu *pmu __maybe_unused =3D NULL; bool type_matched =3D false; =20 - TEST_ASSERT_VAL("wrong config", test_hw_config(evsel, 0x1a)); - TEST_ASSERT_VAL("event not parsed as raw type", - evsel->attr.type =3D=3D PERF_TYPE_RAW); + TEST_ASSERT_EVSEL("wrong config", test_hw_config(evsel, 0x1a), evsel); + TEST_ASSERT_EVSEL("event not parsed as raw type", + evsel->core.attr.type =3D=3D PERF_TYPE_RAW, + evsel); #if defined(__aarch64__) /* * Arm doesn't have a real raw type PMU in sysfs, so raw events @@ -144,15 +164,15 @@ static int test__checkevent_raw(struct evlist *evlist) type_matched =3D raw_type_match =3D true; #else while ((pmu =3D perf_pmus__scan(pmu)) !=3D NULL) { - if (pmu->type =3D=3D evsel->attr.type) { - TEST_ASSERT_VAL("PMU type expected once", !type_matched); + if (pmu->type =3D=3D evsel->core.attr.type) { + TEST_ASSERT_EVSEL("PMU type expected once", !type_matched, evsel); type_matched =3D true; if (pmu->type =3D=3D PERF_TYPE_RAW) raw_type_match =3D true; } } #endif - TEST_ASSERT_VAL("No PMU found for type", type_matched); + TEST_ASSERT_EVSEL("No PMU found for type", type_matched, evsel); } TEST_ASSERT_VAL("Raw PMU not matched", raw_type_match); return TEST_OK; @@ -163,8 +183,8 @@ static int test__checkevent_numeric(struct evlist *evli= st) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", 1 =3D=3D evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); + TEST_ASSERT_EVSEL("wrong type", 1 =3D=3D evsel->core.attr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 1 =3D=3D evsel->core.attr.config, evsel= ); return TEST_OK; } =20 @@ -175,9 +195,11 @@ static int test__checkevent_symbolic_name(struct evlis= t *evlist) =20 TEST_ASSERT_EVLIST("wrong number of entries", 0 !=3D evlist->core.nr_entr= ies, evlist); =20 - evlist__for_each_entry(evlist, evsel) - TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_INS= TRUCTIONS)); - + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + } return TEST_OK; } =20 @@ -188,14 +210,16 @@ static int test__checkevent_symbolic_name_config(stru= ct evlist *evlist) TEST_ASSERT_EVLIST("wrong number of entries", 0 !=3D evlist->core.nr_entr= ies, evlist); =20 evlist__for_each_entry(evlist, evsel) { - TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU= _CYCLES)); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); /* * 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->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); + TEST_ASSERT_EVSEL("wrong period", 0 =3D=3D evsel->core.attr.sample_perio= d, evsel); + TEST_ASSERT_EVSEL("wrong config1", 0 =3D=3D evsel->core.attr.config1, ev= sel); + TEST_ASSERT_EVSEL("wrong config2", 1 =3D=3D evsel->core.attr.config2, ev= sel); } return TEST_OK; } @@ -205,19 +229,20 @@ static int test__checkevent_symbolic_alias(struct evl= ist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_PAG= E_FAULTS)); + TEST_ASSERT_EVSEL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_P= AGE_FAULTS), + evsel); return TEST_OK; } =20 static int test__checkevent_genhw(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", 0 !=3D evlist->core.nr_entr= ies, evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE =3D=3D evsel->attr.type= ); - TEST_ASSERT_VAL("wrong config", test_hw_config(evsel, 1 << 16)); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_HW_CACHE =3D=3D evsel->core.at= tr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", test_hw_config(evsel, 1 << 16), evsel); } return TEST_OK; } @@ -227,12 +252,12 @@ static int test__checkevent_breakpoint(struct evlist = *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - 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 - evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", + (HW_BREAKPOINT_R | HW_BREAKPOINT_W) =3D=3D evsel->core.attr.bp_type, + evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_4 =3D=3D evsel->core.= attr.bp_len, evsel); return TEST_OK; } =20 @@ -241,11 +266,11 @@ static int test__checkevent_breakpoint_x(struct evlis= t *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - 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); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", HW_BREAKPOINT_X =3D=3D evsel->core.att= r.bp_type, evsel); + TEST_ASSERT_EVSEL("wrong bp_len", default_breakpoint_len() =3D=3D evsel->= core.attr.bp_len, + evsel); return TEST_OK; } =20 @@ -254,13 +279,10 @@ static int test__checkevent_breakpoint_r(struct evlis= t *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", - PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - 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", - HW_BREAKPOINT_LEN_4 =3D=3D evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", HW_BREAKPOINT_R =3D=3D evsel->core.att= r.bp_type, evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_4 =3D=3D evsel->core.= attr.bp_len, evsel); return TEST_OK; } =20 @@ -269,13 +291,10 @@ static int test__checkevent_breakpoint_w(struct evlis= t *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", - PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - 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_4 =3D=3D evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", HW_BREAKPOINT_W =3D=3D evsel->core.att= r.bp_type, evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_4 =3D=3D evsel->core.= attr.bp_len, evsel); return TEST_OK; } =20 @@ -284,13 +303,12 @@ static int test__checkevent_breakpoint_rw(struct evli= st *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", - PERF_TYPE_BREAKPOINT =3D=3D evsel->core.attr.type); - 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 evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", + (HW_BREAKPOINT_R|HW_BREAKPOINT_W) =3D=3D evsel->core.attr.bp_type, + evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_4 =3D=3D evsel->core.= attr.bp_len, evsel); return TEST_OK; } =20 @@ -299,10 +317,10 @@ static int test__checkevent_tracepoint_modifier(struc= t evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 return test__checkevent_tracepoint(evlist); } @@ -310,15 +328,15 @@ static int test__checkevent_tracepoint_modifier(struc= t evlist *evlist) static int test__checkevent_tracepoint_multi_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries > 1= , evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); - TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); } =20 return test__checkevent_tracepoint_multi(evlist); @@ -326,77 +344,77 @@ test__checkevent_tracepoint_multi_modifier(struct evl= ist *evlist) =20 static int test__checkevent_raw_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); - TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); - TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel= ); } return test__checkevent_raw(evlist); } =20 static int test__checkevent_numeric_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); - TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); - TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel= ); } return test__checkevent_numeric(evlist); } =20 static int test__checkevent_symbolic_name_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); - TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); } return test__checkevent_symbolic_name(evlist); } =20 static int test__checkevent_exclude_host_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); } return test__checkevent_symbolic_name(evlist); } =20 static int test__checkevent_exclude_guest_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude guest", evsel->core.attr.exclude_guest,= evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); } return test__checkevent_symbolic_name(evlist); } @@ -406,27 +424,27 @@ static int test__checkevent_symbolic_alias_modifier(s= truct evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 return test__checkevent_symbolic_alias(evlist); } =20 static int test__checkevent_genhw_modifier(struct evlist *evlist) { - struct perf_evsel *evsel; + struct evsel *evsel; =20 TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - perf_evlist__for_each_entry(&evlist->core, evsel) { - TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); - TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); - TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); + evlist__for_each_entry(evlist, evsel) { + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel= ); } return test__checkevent_genhw(evlist); } @@ -439,13 +457,13 @@ static int test__checkevent_exclude_idle_modifier(str= uct evlist *evlist) evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong exclude idle", evsel->core.attr.exclude_idle, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest,= evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 return test__checkevent_symbolic_name(evlist); } @@ -458,13 +476,13 @@ static int test__checkevent_exclude_idle_modifier_1(s= truct evlist *evlist) evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); =20 - TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong exclude idle", evsel->core.attr.exclude_idle, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest,= evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 return test__checkevent_symbolic_name(evlist); } @@ -474,11 +492,11 @@ static int test__checkevent_breakpoint_modifier(struc= t evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:u")); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "mem:0:u"), evsel); =20 return test__checkevent_breakpoint(evlist); } @@ -487,11 +505,11 @@ static int test__checkevent_breakpoint_x_modifier(str= uct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:x:k")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "mem:0:x:k"), evsel= ); =20 return test__checkevent_breakpoint_x(evlist); } @@ -500,11 +518,11 @@ static int test__checkevent_breakpoint_r_modifier(str= uct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:r:hp")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "mem:0:r:hp"), evse= l); =20 return test__checkevent_breakpoint_r(evlist); } @@ -513,11 +531,11 @@ static int test__checkevent_breakpoint_w_modifier(str= uct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:w:up")); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "mem:0:w:up"), evse= l); =20 return test__checkevent_breakpoint_w(evlist); } @@ -526,11 +544,11 @@ static int test__checkevent_breakpoint_rw_modifier(st= ruct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:rw:kp")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "mem:0:rw:kp"), evs= el); =20 return test__checkevent_breakpoint_rw(evlist); } @@ -539,11 +557,11 @@ static int test__checkevent_breakpoint_modifier_name(= struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint"), evse= l); =20 return test__checkevent_breakpoint(evlist); } @@ -552,11 +570,11 @@ static int test__checkevent_breakpoint_x_modifier_nam= e(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint"), evse= l); =20 return test__checkevent_breakpoint_x(evlist); } @@ -565,11 +583,11 @@ static int test__checkevent_breakpoint_r_modifier_nam= e(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint"), evse= l); =20 return test__checkevent_breakpoint_r(evlist); } @@ -578,11 +596,11 @@ static int test__checkevent_breakpoint_w_modifier_nam= e(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint"), evse= l); =20 return test__checkevent_breakpoint_w(evlist); } @@ -591,11 +609,11 @@ static int test__checkevent_breakpoint_rw_modifier_na= me(struct evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint")); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint"), evse= l); =20 return test__checkevent_breakpoint_rw(evlist); } @@ -604,15 +622,15 @@ static int test__checkevent_breakpoint_2_events(struc= t evlist *evlist) { struct evsel *evsel =3D evlist__first(evlist); =20 - TEST_ASSERT_VAL("wrong number of entries", 2 =3D=3D evlist->core.nr_entri= es); + TEST_ASSERT_EVSEL("wrong number of entries", 2 =3D=3D evlist->core.nr_ent= ries, evsel); =20 - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint1")); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint1"), evs= el); =20 evsel =3D evsel__next(evsel); =20 - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint2")); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "breakpoint2"), evs= el); =20 return TEST_OK; } @@ -623,17 +641,17 @@ static int test__checkevent_pmu(struct evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); struct perf_pmu *core_pmu =3D perf_pmus__find_core_pmu(); =20 - TEST_ASSERT_VAL("wrong number of entries", 1 =3D=3D evlist->core.nr_entri= es); - TEST_ASSERT_VAL("wrong type", core_pmu->type =3D=3D evsel->core.attr.type= ); - TEST_ASSERT_VAL("wrong config", test_hw_config(&evsel->core, 10)); - TEST_ASSERT_VAL("wrong config1", 1 =3D=3D evsel->core.attr.config1); - TEST_ASSERT_VAL("wrong config2", 3 =3D=3D evsel->core.attr.config2); - TEST_ASSERT_VAL("wrong config3", 0 =3D=3D evsel->core.attr.config3); + TEST_ASSERT_EVSEL("wrong number of entries", 1 =3D=3D evlist->core.nr_ent= ries, evsel); + TEST_ASSERT_EVSEL("wrong type", core_pmu->type =3D=3D evsel->core.attr.ty= pe, evsel); + TEST_ASSERT_EVSEL("wrong config", test_hw_config(evsel, 10), evsel); + TEST_ASSERT_EVSEL("wrong config1", 1 =3D=3D evsel->core.attr.config1, = evsel); + TEST_ASSERT_EVSEL("wrong config2", 3 =3D=3D evsel->core.attr.config2, = evsel); + TEST_ASSERT_EVSEL("wrong config3", 0 =3D=3D evsel->core.attr.config3, = evsel); /* * 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->core.attr.sample_peri= od); + TEST_ASSERT_EVSEL("wrong period", 0 =3D=3D evsel->core.attr.sample_pe= riod, evsel); =20 return TEST_OK; } @@ -642,40 +660,40 @@ static int test__checkevent_list(struct evlist *evlis= t) { struct evsel *evsel =3D evlist__first(evlist); =20 - TEST_ASSERT_VAL("wrong number of entries", 3 <=3D evlist->core.nr_entries= ); + TEST_ASSERT_EVSEL("wrong number of entries", 3 <=3D evlist->core.nr_entri= es, evsel); =20 /* r1 */ - TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT !=3D evsel->core.attr.= type); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_TRACEPOINT !=3D evsel->core.att= r.type, evsel); while (evsel->core.attr.type !=3D PERF_TYPE_TRACEPOINT) { - 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); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong config", 1 =3D=3D evsel->core.attr.config, evse= l); + TEST_ASSERT_EVSEL("wrong config1", 0 =3D=3D evsel->core.attr.config1, ev= sel); + TEST_ASSERT_EVSEL("wrong config2", 0 =3D=3D evsel->core.attr.config2, ev= sel); + TEST_ASSERT_EVSEL("wrong config3", 0 =3D=3D evsel->core.attr.config3, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); evsel =3D evsel__next(evsel); } =20 /* syscalls:sys_enter_openat:k */ - TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT =3D=3D evsel->core.att= r.type); - TEST_ASSERT_VAL("wrong sample_type", - PERF_TP_SAMPLE_TYPE =3D=3D evsel->core.attr.sample_type); - TEST_ASSERT_VAL("wrong sample_period", 1 =3D=3D evsel->core.attr.sample_p= eriod); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_TRACEPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong sample_type", PERF_TP_SAMPLE_TYPE =3D=3D evsel->= core.attr.sample_type, + evsel); + TEST_ASSERT_EVSEL("wrong sample_period", 1 =3D=3D evsel->core.attr.sample= _period, evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 /* 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", 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong type", 1 =3D=3D evsel->core.attr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 1 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); =20 return TEST_OK; } @@ -688,17 +706,17 @@ static int test__checkevent_pmu_name(struct evlist *e= vlist) =20 /* default_core/config=3D1,name=3Dkrava/u */ TEST_ASSERT_EVLIST("wrong number of entries", 2 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", core_pmu->type =3D=3D evsel->core.attr.type= ); - TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "krava")); + TEST_ASSERT_EVSEL("wrong type", core_pmu->type =3D=3D evsel->core.attr.ty= pe, evsel); + TEST_ASSERT_EVSEL("wrong config", 1 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, "krava"), evsel); =20 /* default_core/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", core_pmu->type =3D=3D evsel->core.attr.type= ); - TEST_ASSERT_VAL("wrong config", 2 =3D=3D evsel->core.attr.config); + TEST_ASSERT_EVSEL("wrong number of entries", 2 =3D=3D evlist->core.nr_ent= ries, evsel); + TEST_ASSERT_EVSEL("wrong type", core_pmu->type =3D=3D evsel->core.attr.ty= pe, evsel); + TEST_ASSERT_EVSEL("wrong config", 2 =3D=3D evsel->core.attr.config, evsel= ); snprintf(buf, sizeof(buf), "%s/config=3D2/u", core_pmu->name); - TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, buf)); + TEST_ASSERT_EVSEL("wrong name", evsel__name_is(evsel, buf), evsel); =20 return TEST_OK; } @@ -710,27 +728,27 @@ static int test__checkevent_pmu_partial_time_callgrap= h(struct evlist *evlist) =20 /* default_core/config=3D1,call-graph=3Dfp,time,period=3D100000/ */ TEST_ASSERT_EVLIST("wrong number of entries", 2 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", core_pmu->type =3D=3D evsel->core.attr.type= ); - TEST_ASSERT_VAL("wrong config", 1 =3D=3D evsel->core.attr.config); + TEST_ASSERT_EVSEL("wrong type", core_pmu->type =3D=3D evsel->core.attr.ty= pe, evsel); + TEST_ASSERT_EVSEL("wrong config", 1 =3D=3D evsel->core.attr.config, evsel= ); /* * The period, time and callgraph value gets configured within evlist__co= nfig, * while this test executes only parse events method. */ - TEST_ASSERT_VAL("wrong period", 0 =3D=3D evsel->core.attr.sample_peri= od); - TEST_ASSERT_VAL("wrong callgraph", !evsel__has_callchain(evsel)); - TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.samp= le_type)); + TEST_ASSERT_EVSEL("wrong period", 0 =3D=3D evsel->core.attr.sample_pe= riod, evsel); + TEST_ASSERT_EVSEL("wrong callgraph", !evsel__has_callchain(evsel), evsel= ); + TEST_ASSERT_EVSEL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.sa= mple_type), evsel); =20 /* default_core/config=3D2,call-graph=3Dno,time=3D0,period=3D2000/ */ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("wrong type", core_pmu->type =3D=3D evsel->core.attr.type= ); - TEST_ASSERT_VAL("wrong config", 2 =3D=3D evsel->core.attr.config); + TEST_ASSERT_EVSEL("wrong type", core_pmu->type =3D=3D evsel->core.attr.ty= pe, evsel); + TEST_ASSERT_EVSEL("wrong config", 2 =3D=3D evsel->core.attr.config, evsel= ); /* * The period, time and callgraph value gets configured within evlist__co= nfig, * while this test executes only parse events method. */ - TEST_ASSERT_VAL("wrong period", 0 =3D=3D evsel->core.attr.sample_peri= od); - TEST_ASSERT_VAL("wrong callgraph", !evsel__has_callchain(evsel)); - TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.samp= le_type)); + TEST_ASSERT_EVSEL("wrong period", 0 =3D=3D evsel->core.attr.sample_pe= riod, evsel); + TEST_ASSERT_EVSEL("wrong callgraph", !evsel__has_callchain(evsel), evsel= ); + TEST_ASSERT_EVSEL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.sa= mple_type), evsel); =20 return TEST_OK; } @@ -743,15 +761,17 @@ static int test__checkevent_pmu_events(struct evlist = *evlist) TEST_ASSERT_EVLIST("wrong number of entries", 1 <=3D evlist->core.nr_entr= ies, evlist); =20 evlist__for_each_entry(evlist, evsel) { - TEST_ASSERT_VAL("wrong type", core_pmu->type =3D=3D evsel->core.attr.typ= e || - !strncmp(evsel__name(evsel), evsel->pmu->name, - strlen(evsel->pmu->name))); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); - TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("wrong type", + core_pmu->type =3D=3D evsel->core.attr.type || + !strncmp(evsel__name(evsel), evsel->pmu->name, + strlen(evsel->pmu->name)), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong pinned", !evsel->core.attr.pinned, evsel); + TEST_ASSERT_EVSEL("wrong exclusive", !evsel->core.attr.exclusive, evsel); } return TEST_OK; } @@ -769,26 +789,22 @@ static int test__checkevent_pmu_events_mix(struct evl= ist *evlist) for (int i =3D 0; i < evlist->core.nr_entries - 1; i++) { evsel =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(evsel)); /* pmu-event:u */ - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); - TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong pinned", !evsel->core.attr.pinned, evsel); + TEST_ASSERT_EVSEL("wrong exclusive", !evsel->core.attr.exclusive, evsel); } /* default_core/pmu-event/u*/ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("wrong type", evsel__find_pmu(evsel)->is_core); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); - TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.pinned); + TEST_ASSERT_EVSEL("wrong type", evsel__find_pmu(evsel)->is_core, evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong pinned", !evsel->core.attr.pinned, evsel); + TEST_ASSERT_EVSEL("wrong exclusive", !evsel->core.attr.pinned, evsel); =20 return TEST_OK; } @@ -887,30 +903,33 @@ static int test__group1(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* instructions:k */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); =20 /* cycles:upp */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D 2= ); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_C= PU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } return TEST_OK; } @@ -932,41 +951,53 @@ static int test__group2(struct evlist *evlist) if (evsel__match(evsel, SOFTWARE, SW_PAGE_FAULTS)) { /* faults + :ku modifier */ leader =3D evsel; - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_ker= nel, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_gues= t, + evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, + evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evs= el); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D= =3D 2, + evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, = evsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); continue; } 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= ); - TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - if (evsel__has_leader(evsel, leader)) - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kern= el, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_gues= t, + evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, + evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evs= el); + if (evsel__has_leader(evsel, leader)) { + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, + evsel); + } + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); continue; } /* cycles:k */ - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_C= PU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } return TEST_OK; } @@ -989,87 +1020,110 @@ static int test__group3(struct evlist *evlist __may= be_unused) if (evsel->core.attr.type =3D=3D PERF_TYPE_TRACEPOINT) { /* group1 syscalls:sys_enter_openat:H */ group1_leader =3D evsel; - TEST_ASSERT_VAL("wrong sample_type", - evsel->core.attr.sample_type =3D=3D PERF_TP_SAMPLE_TYPE); - TEST_ASSERT_VAL("wrong sample_period", 1 =3D=3D evsel->core.attr.sample= _period); - 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); - TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); - TEST_ASSERT_VAL("wrong group name", !strcmp(evsel->group_name, "group1"= )); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong sample_type", + evsel->core.attr.sample_type =3D=3D PERF_TP_SAMPLE_TYPE, + evsel); + TEST_ASSERT_EVSEL("wrong sample_period", + 1 =3D=3D evsel->core.attr.sample_period, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_ker= nel, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evs= el); + TEST_ASSERT_EVSEL("wrong exclude guest", evsel->core.attr.exclude_guest, + evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, + evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evs= el); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong group name", !strcmp(evsel->group_name, "group= 1"), + evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D= =3D 2, + evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, = evsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); continue; } if (evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) { if (evsel->core.attr.exclude_user) { /* group1 cycles:kppp */ - 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); - TEST_ASSERT_VAL("wrong exclude guest", - !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", - !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", - evsel->core.attr.precise_ip =3D=3D 3); + TEST_ASSERT_EVSEL("wrong exclude_user", + evsel->core.attr.exclude_user, evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", + !evsel->core.attr.exclude_kernel, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, + evsel); + TEST_ASSERT_EVSEL("wrong exclude guest", + !evsel->core.attr.exclude_guest, evsel); + TEST_ASSERT_EVSEL("wrong exclude host", + !evsel->core.attr.exclude_host, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", + evsel->core.attr.precise_ip =3D=3D 3, evsel); if (evsel__has_leader(evsel, group1_leader)) { - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - TEST_ASSERT_VAL("wrong group_idx", - evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, + evsel); + TEST_ASSERT_EVSEL("wrong group_idx", + evsel__group_idx(evsel) =3D=3D 1, + evsel); } - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } else { /* group2 cycles + G modifier */ group2_leader =3D evsel; - TEST_ASSERT_VAL("wrong exclude_kernel", - !evsel->core.attr.exclude_kernel); - TEST_ASSERT_VAL("wrong exclude_hv", - !evsel->core.attr.exclude_hv); - TEST_ASSERT_VAL("wrong exclude guest", - !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", - evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); + TEST_ASSERT_EVSEL("wrong exclude_kernel", + !evsel->core.attr.exclude_kernel, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", + !evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong exclude guest", + !evsel->core.attr.exclude_guest, evsel); + TEST_ASSERT_EVSEL("wrong exclude host", + evsel->core.attr.exclude_host, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, + evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), + evsel); if (evsel->core.nr_members =3D=3D 2) { - TEST_ASSERT_VAL("wrong group_idx", - evsel__group_idx(evsel) =3D=3D 0); + TEST_ASSERT_EVSEL("wrong group_idx", + evsel__group_idx(evsel) =3D=3D 0, + evsel); } - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } continue; } if (evsel->core.attr.type =3D=3D 1) { /* group2 1:3 + G modifier */ - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - if (evsel__has_leader(evsel, group2_leader)) - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("wrong config", 3 =3D=3D evsel->core.attr.config, evs= el); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_ker= nel, + evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evs= el); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_gues= t, + evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, + evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evs= el); + if (evsel__has_leader(evsel, group2_leader)) { + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, + evsel); + } + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); continue; } /* instructions:u */ - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } return TEST_OK; } @@ -1088,31 +1142,35 @@ static int test__group4(struct evlist *evlist __may= be_unused) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles:u + p */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D 1= ); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D= 1, evsel); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); =20 /* instructions:kp + p */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D 2= ); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } return TEST_OK; } @@ -1131,71 +1189,81 @@ static int test__group5(struct evlist *evlist __may= be_unused) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles + G */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); =20 /* instructions + G */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); } for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles:G */ evsel =3D leader =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); - TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); + TEST_ASSERT_EVSEL("wrong sample_read", !evsel->sample_read, evsel); =20 /* instructions:G */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); } for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); } return TEST_OK; } @@ -1214,29 +1282,33 @@ static int test__group_gh1(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles + :H group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", evsel->core.attr.exclude_guest,= evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); =20 /* cache-misses:G + :H group modifier */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); } return TEST_OK; } @@ -1255,29 +1327,33 @@ static int test__group_gh2(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles + :G group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); =20 /* cache-misses:H + :G group modifier */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); } return TEST_OK; } @@ -1296,29 +1372,33 @@ static int test__group_gh3(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles:G + :u group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); =20 /* cache-misses:H + :u group modifier */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", evsel->core.attr.exclude_guest,= evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); } return TEST_OK; } @@ -1337,29 +1417,33 @@ static int test__group_gh4(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles:G + :uG group modifier */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - 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); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", evsel->core.attr.exclude_host, e= vsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__is_group_leader(evsel), evsel); + TEST_ASSERT_EVSEL("wrong core.nr_members", evsel->core.nr_members =3D=3D= 2, evsel); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 0, e= vsel); =20 /* cache-misses:H + :uG group modifier */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong group_idx", evsel__group_idx(evsel) =3D=3D 1, e= vsel); } return TEST_OK; } @@ -1375,42 +1459,47 @@ static int test__leader_sample1(struct evlist *evli= st) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles - sampling group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong sample_read", evsel->sample_read, evsel); =20 /* cache-misses - not sampling */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong sample_read", evsel->sample_read, evsel); =20 /* branch-misses - not sampling */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", !evsel->core.attr.exclude_kern= el, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", !evsel->core.attr.exclude_hv, evse= l); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong sample_read", evsel->sample_read, evsel); } return TEST_OK; } @@ -1426,30 +1515,33 @@ static int test__leader_sample2(struct evlist *evli= st __maybe_unused) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* instructions - sampling group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong sample_read", evsel->sample_read, evsel); =20 /* branch-misses - not sampling */ evsel =3D evsel__next(evsel); - 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); - TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); - TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong group name", !evsel->group_name); - TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader)); - TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong exclude guest", !evsel->core.attr.exclude_guest= , evsel); + TEST_ASSERT_EVSEL("wrong exclude host", !evsel->core.attr.exclude_host, = evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evse= l); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); + TEST_ASSERT_EVSEL("wrong sample_read", evsel->sample_read, evsel); } return TEST_OK; } @@ -1464,11 +1556,11 @@ static int test__checkevent_pinned_modifier(struct = evlist *evlist) =20 for (int i =3D 0; i < num_core_entries(evlist); i++) { evsel =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(evsel)); - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, = evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kerne= l, evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel= ); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel= ); + TEST_ASSERT_EVSEL("wrong pinned", evsel->core.attr.pinned, evsel); } return test__checkevent_symbolic_name(evlist); } @@ -1484,23 +1576,28 @@ static int test__pinned_group(struct evlist *evlist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles - group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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)); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); /* TODO: The group modifier is not copied to the split group leader. */ if (perf_pmus__num_core_pmus() =3D=3D 1) - TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned); + TEST_ASSERT_EVSEL("wrong pinned", evsel->core.attr.pinned, evsel); =20 /* cache-misses - can not be pinned, but will go on with the leader */ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); - TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong pinned", !evsel->core.attr.pinned, evsel); =20 /* branch-misses - ditto */ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("unexpected event", - evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); - TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong pinned", !evsel->core.attr.pinned, evsel); } return TEST_OK; } @@ -1512,11 +1609,11 @@ static int test__checkevent_exclusive_modifier(stru= ct evlist *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - 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); - TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip); - TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", evsel->core.attr.precise_ip, evsel); + TEST_ASSERT_EVSEL("wrong exclusive", evsel->core.attr.exclusive, evsel); =20 return test__checkevent_symbolic_name(evlist); } @@ -1532,23 +1629,28 @@ static int test__exclusive_group(struct evlist *evl= ist) for (int i =3D 0; i < num_core_entries(evlist); i++) { /* cycles - group leader */ evsel =3D leader =3D (i =3D=3D 0 ? evlist__first(evlist) : evsel__next(e= vsel)); - 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)); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CPU_CYCLES), + evsel); + TEST_ASSERT_EVSEL("wrong group name", !evsel->group_name, evsel); + TEST_ASSERT_EVSEL("wrong leader", evsel__has_leader(evsel, leader), evse= l); /* TODO: The group modifier is not copied to the split group leader. */ if (perf_pmus__num_core_pmus() =3D=3D 1) - TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("wrong exclusive", evsel->core.attr.exclusive, evsel); =20 /* cache-misses - can not be pinned, but will go on with the leader */ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CAC= HE_MISSES)); - TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_CACHE_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclusive", !evsel->core.attr.exclusive, evsel); =20 /* branch-misses - ditto */ evsel =3D evsel__next(evsel); - TEST_ASSERT_VAL("unexpected event", - evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)); - TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive); + TEST_ASSERT_EVSEL("unexpected event", + evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES), + evsel); + TEST_ASSERT_EVSEL("wrong exclusive", !evsel->core.attr.exclusive, evsel); } return TEST_OK; } @@ -1557,12 +1659,12 @@ static int test__checkevent_breakpoint_len(struct e= vlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - 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 - evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", + (HW_BREAKPOINT_R | HW_BREAKPOINT_W) =3D=3D evsel->core.attr.bp_type, + evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_1 =3D=3D evsel->core.= attr.bp_len, evsel); =20 return TEST_OK; } @@ -1572,12 +1674,10 @@ static int test__checkevent_breakpoint_len_w(struct= evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.att= r.type); - 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 - evsel->core.attr.bp_len); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_BREAKPOINT =3D=3D evsel->core.a= ttr.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0 =3D=3D evsel->core.attr.config, evsel= ); + TEST_ASSERT_EVSEL("wrong bp_type", HW_BREAKPOINT_W =3D=3D evsel->core.att= r.bp_type, evsel); + TEST_ASSERT_EVSEL("wrong bp_len", HW_BREAKPOINT_LEN_2 =3D=3D evsel->core.= attr.bp_len, evsel); =20 return TEST_OK; } @@ -1588,10 +1688,10 @@ test__checkevent_breakpoint_len_rw_modifier(struct = evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - 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); - TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); + TEST_ASSERT_EVSEL("wrong exclude_user", !evsel->core.attr.exclude_user, e= vsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); + TEST_ASSERT_EVSEL("wrong exclude_hv", evsel->core.attr.exclude_hv, evsel); + TEST_ASSERT_EVSEL("wrong precise_ip", !evsel->core.attr.precise_ip, evsel= ); =20 return test__checkevent_breakpoint_rw(evlist); } @@ -1603,7 +1703,7 @@ static int test__checkevent_precise_max_modifier(stru= ct evlist *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D 1 + num_core_entries(evlist), evlist); - TEST_ASSERT_VAL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_TAS= K_CLOCK)); + TEST_ASSERT_EVSEL("wrong type/config", evsel__match(evsel, SOFTWARE, SW_T= ASK_CLOCK), evsel); return TEST_OK; } =20 @@ -1614,7 +1714,7 @@ static int test__checkevent_config_symbol(struct evli= st *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "insn")); + TEST_ASSERT_EVSEL("wrong name setting", evsel__name_is(evsel, "insn"), ev= sel); return TEST_OK; } =20 @@ -1623,7 +1723,7 @@ static int test__checkevent_config_raw(struct evlist = *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "rawpmu")); + TEST_ASSERT_EVSEL("wrong name setting", evsel__name_is(evsel, "rawpmu"), = evsel); return TEST_OK; } =20 @@ -1632,7 +1732,7 @@ static int test__checkevent_config_num(struct evlist = *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "numpmu")); + TEST_ASSERT_EVSEL("wrong name setting", evsel__name_is(evsel, "numpmu"), = evsel); return TEST_OK; } =20 @@ -1643,7 +1743,7 @@ static int test__checkevent_config_cache(struct evlis= t *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "cachepmu")); + TEST_ASSERT_EVSEL("wrong name setting", evsel__name_is(evsel, "cachepmu")= , evsel); return test__checkevent_genhw(evlist); } =20 @@ -1667,7 +1767,7 @@ static int test__intel_pt(struct evlist *evlist) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "intel_pt//u"= )); + TEST_ASSERT_EVSEL("wrong name setting", evsel__name_is(evsel, "intel_pt//= u"), evsel); return TEST_OK; } =20 @@ -1678,9 +1778,10 @@ static int test__checkevent_complex_name(struct evli= st *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - TEST_ASSERT_VAL("wrong complex name parsing", - evsel__name_is(evsel, - "COMPLEX_CYCLES_NAME:orig=3Dcpu-cycles,desc=3Dchip-clock-ticks"= )); + TEST_ASSERT_EVSEL("wrong complex name parsing", + evsel__name_is(evsel, + "COMPLEX_CYCLES_NAME:orig=3Dcpu-cycles,desc=3Dchip-clock-ticks"), + evsel); return TEST_OK; } =20 @@ -1689,8 +1790,8 @@ static int test__checkevent_raw_pmu(struct evlist *ev= list) struct evsel *evsel =3D evlist__first(evlist); =20 TEST_ASSERT_EVLIST("wrong number of entries", 1 =3D=3D evlist->core.nr_en= tries, evlist); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE =3D=3D evsel->core.attr.= type); - TEST_ASSERT_VAL("wrong config", 0x1a =3D=3D evsel->core.attr.config); + TEST_ASSERT_EVSEL("wrong type", PERF_TYPE_SOFTWARE =3D=3D evsel->core.att= r.type, evsel); + TEST_ASSERT_EVSEL("wrong config", 0x1a =3D=3D evsel->core.attr.config, ev= sel); return TEST_OK; } =20 @@ -1701,8 +1802,8 @@ static int test__sym_event_slash(struct evlist *evlis= t) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - TEST_ASSERT_VAL("unexpected event", evsel__match(evsel, HARDWARE, HW_CPU_= CYCLES)); - TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); + TEST_ASSERT_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_CP= U_CYCLES), evsel); + TEST_ASSERT_EVSEL("wrong exclude_kernel", evsel->core.attr.exclude_kernel= , evsel); return TEST_OK; } =20 @@ -1713,8 +1814,8 @@ static int test__sym_event_dc(struct evlist *evlist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - 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_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_CP= U_CYCLES), evsel); + TEST_ASSERT_EVSEL("wrong exclude_user", evsel->core.attr.exclude_user, ev= sel); return TEST_OK; } =20 @@ -1725,8 +1826,8 @@ static int test__term_equal_term(struct evlist *evlis= t) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - 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); + TEST_ASSERT_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_CP= U_CYCLES), evsel); + TEST_ASSERT_EVSEL("wrong name setting", strcmp(evsel->name, "name") =3D= =3D 0, evsel); return TEST_OK; } =20 @@ -1737,8 +1838,8 @@ static int test__term_equal_legacy(struct evlist *evl= ist) TEST_ASSERT_EVLIST("wrong number of entries", evlist->core.nr_entries =3D=3D num_core_entries(evlist), evlist); - 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= ); + TEST_ASSERT_EVSEL("unexpected event", evsel__match(evsel, HARDWARE, HW_CP= U_CYCLES), evsel); + TEST_ASSERT_EVSEL("wrong name setting", strcmp(evsel->name, "l1d") =3D=3D= 0, evsel); return TEST_OK; } =20 @@ -2701,8 +2802,9 @@ static int test__checkevent_pmu_events_alias(struct e= vlist *evlist) struct evsel *evsel1 =3D evlist__first(evlist); struct evsel *evsel2 =3D evlist__last(evlist); =20 - TEST_ASSERT_VAL("wrong type", evsel1->core.attr.type =3D=3D evsel2->core.= attr.type); - TEST_ASSERT_VAL("wrong config", evsel1->core.attr.config =3D=3D evsel2->c= ore.attr.config); + TEST_ASSERT_EVSEL("wrong type", evsel1->core.attr.type =3D=3D evsel2->cor= e.attr.type, evsel1); + TEST_ASSERT_EVSEL("wrong config", evsel1->core.attr.config =3D=3D evsel2-= >core.attr.config, + evsel1); return TEST_OK; } =20 --=20 2.51.0.534.gc79095c0ca-goog