Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4779806imm; Mon, 25 Jun 2018 23:56:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe+FnvesEEKHCz/TE5mitszEr5XYUrarK+sjC867Bvf8cK/5NldEXExx2Lx+WcM5rG55N/M X-Received: by 2002:a62:c9ce:: with SMTP id l75-v6mr289665pfk.179.1529996209038; Mon, 25 Jun 2018 23:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529996209; cv=none; d=google.com; s=arc-20160816; b=rL50R78xTuW0tPsVye2AXRyEuL9uKF/r6Tvu/cAX3pprCejsklqgGg1sM7PARkg0SU QhW/iYm8m3vq9t2CN40fF9UzgT9jFjFgemSjSKVeWYoA28ExMufYfiiKS6tc9CJQXfyI SaYEOKZAxDb4f2dSnldGRVBgLwmAsVd8JjB+QSyz1x5z2GmSUHh1sdkqkxDKXbIxJyAP +Ik141R2ok+kNVaE+SJk7pLqEwpxLbd+hCG5NKgJhysyx9ZTQYkId0wowOLU5gl0c2F8 tKKN8topTmYol3mlne7f3Z3jIJa94Bf0y2tbx1P2/Phh7BCP/cn9LaN+T/pwdag0YI29 DTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=HqLBBobwh9qLJ7KVnApZ4xN4j/TK7SDXuNdOqM6dKlE=; b=GXetARyL19CvpTHZVyXADfGDUkmjPAFsrqiMRNAEPLjcoKqu/PeYnN7u2kew3+XzND lhID7UurnG2f+vIK24myNsjSHdPyTZDCPzLuB/OKj1vWl0O2fu07jCNCkWvlHurCzYxz ZL9xMmBqS9szBH6FcfAdAQoYyp5EXJEJzyUFsJ0KbqLze1+xeRGLmuug6eNMdw/MY0Ln TDvUtCXnUgCKD4WMdn08dLOI+veqriy5NjD/XBUAbsrHTMI7+bornCo5yC9lwcR2cZKO oWBRgye3UDT9mT8zI2e1gPX+8cSz3Ls00a85zyp0esyYv2OD8TKAyMY1W6M1FUmhARHW ywoA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g125-v6si840138pgc.569.2018.06.25.23.56.34; Mon, 25 Jun 2018 23:56:49 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbeFZGyS (ORCPT + 99 others); Tue, 26 Jun 2018 02:54:18 -0400 Received: from terminus.zytor.com ([198.137.202.136]:47185 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751998AbeFZGyQ (ORCPT ); Tue, 26 Jun 2018 02:54:16 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5Q6rlTt1591209 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Jun 2018 23:53:47 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5Q6rlrI1591206; Mon, 25 Jun 2018 23:53:47 -0700 Date: Mon, 25 Jun 2018 23:53:47 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jiri Olsa Message-ID: Cc: mingo@kernel.org, alexander.shishkin@linux.intel.com, namhyung@kernel.org, dsahern@gmail.com, kim.phillips@arm.com, peterz@infradead.org, linux-kernel@vger.kernel.org, tmricht@linux.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, brueckner@linux.vnet.ibm.com, acme@redhat.com, hpa@zytor.com, tglx@linutronix.de, jolsa@kernel.org Reply-To: hpa@zytor.com, acme@redhat.com, tglx@linutronix.de, jolsa@kernel.org, heiko.carstens@de.ibm.com, brueckner@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, tmricht@linux.ibm.com, schwidefsky@de.ibm.com, peterz@infradead.org, kim.phillips@arm.com, dsahern@gmail.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, namhyung@kernel.org In-Reply-To: <20180611093422.1005-2-jolsa@kernel.org> References: <20180611093422.1005-2-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tests: Add valid callback for parse-events test Git-Commit-ID: 16ddcfbf7f3d07aa781e26b39f2c28636a4ed2fd X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 16ddcfbf7f3d07aa781e26b39f2c28636a4ed2fd Gitweb: https://git.kernel.org/tip/16ddcfbf7f3d07aa781e26b39f2c28636a4ed2fd Author: Jiri Olsa AuthorDate: Mon, 11 Jun 2018 11:34:22 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 25 Jun 2018 11:59:36 -0300 perf tests: Add valid callback for parse-events test 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 Committer note: Use named initializers in the struct evlist_test variable to avoid breaking the build on centos:5, 6 and others with a similar gcc: cc1: warnings being treated as errors tests/parse-events.c: In function 'test_pmu_events': tests/parse-events.c:1817: error: missing initializer tests/parse-events.c:1817: error: (near initialization for 'e.type') Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: David Ahern Cc: Heiko Carstens Cc: Hendrik Brueckner Cc: Kim Phillips Cc: Martin Schwidefsky Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Thomas Richter Link: http://lkml.kernel.org/r/20180611093422.1005-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 9751e7563a45..61211918bfba 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 = { .id = 0, }; char name[2 * NAME_MAX + 1 + 12 + 3]; /* Names containing . are special and cannot be used directly */