Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3836013imm; Mon, 11 Jun 2018 02:35:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK4upC8zLTsLNz5qBXG6uJ2VKZ2DCx4XT/E7uk+xaolu9RRJo2XH5TsaWBA43m7KdPFHgLd X-Received: by 2002:a65:63cb:: with SMTP id n11-v6mr13992821pgv.185.1528709755019; Mon, 11 Jun 2018 02:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528709754; cv=none; d=google.com; s=arc-20160816; b=mxw0qM/nsU07NRNR+dCFfNuGqyE6pdjqRwLc12jySEMDd6Ipk3hAgOWHKC4cMlm232 ShxGtg/mNLy8/LwvNQYzbACB8p851DV+1LCWeYCAIsRTGUNlOXXM3y1Kbz/V7r04f8Gq LBFlEcs7F62236pswQ5DTq7Y9sArGWCOQVxST7vlKytepd/MZyqUElq+7U0M1+7mhDDi 03dv8x92ZKelR7Pjglj8byHXe2BKs5nrFDoukMReBox07TKxbBVUVBB3IyDwpcoXaHHE 1D9nnya9B3ndwCk/jcSAQsM6/zSQsmLv31ARVeVxTICx/0pZxdaWaPzZRHvKGmQKMmZd PrlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=POp+0y6vaICYNmFPZMr+sCGS7bqQ94t27ezzoqOu0iY=; b=CDL0FTgWKHA3MI2zYlLFts83DGEm2hbA8MUouXA+w61PHg4/r/AahSIkG8NpLXz6HG NbUhXIistoeJBvi+WSUr0p117/epsDAEIWLuhgtMrsp7kbxXj+XyKX1x7UCKdVJIwVsJ znQ/7neoEAe8RUTBR7hDI7K+kb58vIH6H/IKfRDJdJxdTeuCE3Pr03w5sR4zhW2puegE TgtYj17mWa9+4iytF4m9QpGlCFRTjU4XMeWT6r1no4VwqArS9lsFQCJ6EwqZSMWBx/z/ 58zbu0OGEF6vYQSITDUpxbLlGQcgsu61x4vY134Vd+196Axhh9MMoaBGKoaQ6ehPBslX Z8RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b65-v6si63620210plb.162.2018.06.11.02.35.40; Mon, 11 Jun 2018 02:35:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932755AbeFKJeb (ORCPT + 99 others); Mon, 11 Jun 2018 05:34:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38370 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932745AbeFKJe2 (ORCPT ); Mon, 11 Jun 2018 05:34:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35E92818BAF9; Mon, 11 Jun 2018 09:34:28 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E6132144B29; Mon, 11 Jun 2018 09:34:26 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo , Thomas-Mich Richter , Kim Phillips Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Alexander Shishkin , Peter Zijlstra , linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: [PATCH 2/2] perf tests: Add valid callback for parse-events test Date: Mon, 11 Jun 2018 11:34:22 +0200 Message-Id: <20180611093422.1005-2-jolsa@kernel.org> In-Reply-To: <20180611093422.1005-1-jolsa@kernel.org> References: <0d25bc25-ed0b-81bb-c516-12fd25442427@linux.ibm.com> <20180611093422.1005-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 11 Jun 2018 09:34:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 11 Jun 2018 09:34:28 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@kernel.org' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding optional 'valid' callback for events tests in parse-events object, so we don't try to parse PMUs, which are not supported. Following line is displayed for skipped test: running test 52 'intel_pt//u'... SKIP Link: http://lkml.kernel.org/n/tip-to9naisphr61z23b0br10xhh@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/tests/parse-events.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 3b0bfdf5a594..347378ddaa8b 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1309,6 +1309,11 @@ static int test__checkevent_config_cache(struct perf_evlist *evlist) return 0; } +static bool test__intel_pt_valid(void) +{ + return !!perf_pmu__find("intel_pt"); +} + static int test__intel_pt(struct perf_evlist *evlist) { struct perf_evsel *evsel = perf_evlist__first(evlist); @@ -1375,6 +1380,7 @@ struct evlist_test { const char *name; __u32 type; const int id; + bool (*valid)(void); int (*check)(struct perf_evlist *evlist); }; @@ -1648,6 +1654,7 @@ static struct evlist_test test__events[] = { }, { .name = "intel_pt//u", + .valid = test__intel_pt_valid, .check = test__intel_pt, .id = 52, }, @@ -1690,6 +1697,11 @@ static int test_event(struct evlist_test *e) struct perf_evlist *evlist; int ret; + if (e->valid && !e->valid()) { + pr_debug("... SKIP"); + return 0; + } + evlist = perf_evlist__new(); if (evlist == NULL) return -ENOMEM; @@ -1716,10 +1728,11 @@ static int test_events(struct evlist_test *events, unsigned cnt) for (i = 0; i < cnt; i++) { struct evlist_test *e = &events[i]; - pr_debug("running test %d '%s'\n", e->id, e->name); + pr_debug("running test %d '%s'", e->id, e->name); ret1 = test_event(e); if (ret1) ret2 = ret1; + pr_debug("\n"); } return ret2; @@ -1801,7 +1814,7 @@ static int test_pmu_events(void) } while (!ret && (ent = readdir(dir))) { - struct evlist_test e; + struct evlist_test e = { 0 }; char name[2 * NAME_MAX + 1 + 12 + 3]; /* Names containing . are special and cannot be used directly */ -- 2.13.6