Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1083163imm; Wed, 13 Jun 2018 13:02:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKnN9KxqXbb6ez0HjYdZjYpV5lh3oX0fb0uh6h/3AW4PKwYbO04oAWsbjR5jxSnmf7aUyoQ X-Received: by 2002:a62:1013:: with SMTP id y19-v6mr6233864pfi.166.1528920146820; Wed, 13 Jun 2018 13:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528920146; cv=none; d=google.com; s=arc-20160816; b=jvGvDSWxRv56jFMYxNBTnO7BqRvaJ5qSKhzCc1NCOpVqWeITpW4BYfKIvLay8t55BP R9CYbqXpjR9HyJbV0L4+x2pfKF6XIvosohTq5rx6inwtdK93HuGRGut11FXiTllONR3J rnXLQqAJGtN5oIwteCQsr/cmaI0f8bo+gQzc8EfVnSMIoXdLnVzP3R1BJDwKwMUeQICw laE1RNvGtTIa8vT0cQ/nv5xa3RJdjbcLpy2YrrNGRfa3B/wRdMRhVcYEr2v5bthtgeIC gief0JJxWru4JmkeuYBzR82cNksRxFaS31GE5ZOaF5VdMIP375xZVL7U7YDMNRwDQ7MI xVtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hjDso8aFTlrhOisBoOBHoARsn00w5A7I3zj12b14IYM=; b=Qk2YPWlWi4weRAxkGbsHrObwB3STBjaFMD69a172prZVxTnzcYbh6B4Uny760uj1AO gdHpv4H1M3LFH/CUWLb+ruwYqdNNyb0oI4NjnYjwXEsS0Zy47TCfKv7G2fN618dxp6bZ mkAIhkUw6ZEkOPNQy7ncYbLVph8doFHuuTFh/v2wZVMRsq3FsHaJqRiyoprcVWLW6jNy Kqu5Ok7W5Xd0a+afEqeDv4PpZlAOx0V8DZuBLl8/2q6x/mUN6ni09Bb2lcu+GNDkeB0q p7FMmpVGpQ7OPvP4QSZW5pmr99TKbF4zpud4afp42Q98YW5guVW6T3BXuztaz8xpEj02 vRwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ljD5ycjd; 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=pass (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 l138-v6si3538387pfd.355.2018.06.13.13.02.11; Wed, 13 Jun 2018 13:02:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ljD5ycjd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935682AbeFMUBY (ORCPT + 99 others); Wed, 13 Jun 2018 16:01:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:58560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935291AbeFMUBX (ORCPT ); Wed, 13 Jun 2018 16:01:23 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7DF22208C4; Wed, 13 Jun 2018 20:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528920082; bh=FPNv8l6uh6at53jDcciA1ZU7OH1YVLS/5OQmNmf93p8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ljD5ycjdZqxD6DNBryCy44pzLFLtDMghGrT1nzpuEkFURIvq4zmwKX673dG93syLf 7Z22dI+8Jsg3uhFWRs34QH90RylwjXCxJpOVebjqqnQCkaPBc6RO02ewAQ17F2NWGb V8jweBW9hK11m7d14XmpZme37+qkjx/WqTRFzaIQ= Received: by jouet.infradead.org (Postfix, from userid 1000) id 202301450F4; Wed, 13 Jun 2018 17:01:20 -0300 (-03) Date: Wed, 13 Jun 2018 17:01:20 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Thomas-Mich Richter , Kim Phillips , 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: Re: [PATCH 2/2] perf tests: Add valid callback for parse-events test Message-ID: <20180613200120.GF2686@kernel.org> References: <0d25bc25-ed0b-81bb-c516-12fd25442427@linux.ibm.com> <20180611093422.1005-1-jolsa@kernel.org> <20180611093422.1005-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180611093422.1005-2-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jun 11, 2018 at 11:34:22AM +0200, Jiri Olsa escreveu: > 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 Would be nice to test the _parsing_ of this even on machines where this PMU is not present, as developers using these machines as workstations may end up breaking this. Anyway, intel_pt now is in tons of machines, so should be caught easily, if not by anyone, by me ;-\ - Arnaldo > 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