Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4778826imm; Mon, 25 Jun 2018 23:55:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcogUmDR2shAYQJ89RfwRdVUKCRPNQFcGpKArUe4+7qO+Ajw3aK0eHCegSj4em6uM5YRARF X-Received: by 2002:a62:2785:: with SMTP id n127-v6mr297886pfn.129.1529996117946; Mon, 25 Jun 2018 23:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529996117; cv=none; d=google.com; s=arc-20160816; b=xVIYVq8JvcJ7w6EQApjWLybXdrP4p3IaRWNMALniMYp3tsu32D0f3TH0G/MEpkvNsD ZlDnCBCUxWyRQj+QIKW2qc3xO6dLagWzMRibqp14Hg7CepUmfk15OpRNqhZ1NZjsoVkr Zv4dPLzBjP4rntthnifP/AKoCB5V4gftjE/X1tUQRkA8UNDxBCoaRWhzNVyMN7nLvAbw 5zpcxqcJ5spurlJBGceF5SIG9OImZ5Uhn7cfPHuq0PMP76IXXRJEIi0LqA1pwWVO1XU1 P2kBiThLQW/dxvL7hBFrC1goyEJINdsTtGgL1/Z5MAhXhF5qOqklJCcCbcvejiIJbeDv FogA== 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=VF3vMOzTxbTwCCYwyE7dITEySOVi7Xl6SzMZZGiQi/E=; b=gWUMGvnpUKzYsfxXrFH5LGZGEbGNIscaztI7ZfSX4VWFk7dThiw82hQEPbuNtXUeJe PAW33WCAa1HMIkwooEgqgJL8nHYHJEYMASNnqmMamDqDxSpw5dLdWfNwtBZsA6JqYEJf POWGlI+l58vc/3MB5aqJcpMfgdUyCWh3VV+bASsn02V+T7Wck+XNFYCt8j0eVvpux4WA 5mJv4qmtCFE3KGez/859Jjc/xQx2Inclblh/Qavo8RZHatLAHI83tIh7bIkl+oSp86Rz Xq1Rodjj2QKuR2d17WOiCJwPsWSf2oaioZVgttZdkTcFSbJqsX69Nipi1Ig6qDfeCUCc bftw== 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 c7-v6si975931pfd.89.2018.06.25.23.55.03; Mon, 25 Jun 2018 23:55:17 -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 S1751846AbeFZGyI (ORCPT + 99 others); Tue, 26 Jun 2018 02:54:08 -0400 Received: from terminus.zytor.com ([198.137.202.136]:44851 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919AbeFZGyG (ORCPT ); Tue, 26 Jun 2018 02:54:06 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5Q6rHk11591190 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 25 Jun 2018 23:53:17 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5Q6rHFq1591187; Mon, 25 Jun 2018 23:53:17 -0700 Date: Mon, 25 Jun 2018 23:53:17 -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: namhyung@kernel.org, mingo@kernel.org, jolsa@kernel.org, tglx@linutronix.de, brueckner@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, tmricht@linux.ibm.com, dsahern@gmail.com, hpa@zytor.com, kim.phillips@arm.com, schwidefsky@de.ibm.com, peterz@infradead.org, acme@redhat.com, heiko.carstens@de.ibm.com, alexander.shishkin@linux.intel.com Reply-To: kim.phillips@arm.com, schwidefsky@de.ibm.com, peterz@infradead.org, acme@redhat.com, alexander.shishkin@linux.intel.com, heiko.carstens@de.ibm.com, mingo@kernel.org, namhyung@kernel.org, tglx@linutronix.de, jolsa@kernel.org, brueckner@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, tmricht@linux.ibm.com, dsahern@gmail.com, hpa@zytor.com In-Reply-To: <20180611093422.1005-1-jolsa@kernel.org> References: <20180611093422.1005-1-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tests: Add event parsing error handling to parse events test Git-Commit-ID: 933ccf2002aaef1037cb676622a694f5390c3d59 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: 933ccf2002aaef1037cb676622a694f5390c3d59 Gitweb: https://git.kernel.org/tip/933ccf2002aaef1037cb676622a694f5390c3d59 Author: Jiri Olsa AuthorDate: Mon, 11 Jun 2018 11:34:21 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 25 Jun 2018 11:59:36 -0300 perf tests: Add event parsing error handling to parse events test Add missing error handling for parse_events calls in test_event function that led to following segfault on s390: running test 52 'intel_pt//u' perf: Segmentation fault ... /lib64/libc.so.6(vasprintf+0xe6) [0x3fffca3f106] /lib64/libc.so.6(asprintf+0x46) [0x3fffca1aa96] ./perf(parse_events_add_pmu+0xb8) [0x80132088] ./perf(parse_events_parse+0xc62) [0x8019529a] ./perf(parse_events+0x98) [0x801341c0] ./perf(test__parse_events+0x48) [0x800cd140] ./perf(cmd_test+0x26a) [0x800bd44a] test child interrupted Adding the struct parse_events_error argument to parse_events call. Also adding parse_events_print_error to get more details on the parsing failures, like: # perf test 6 -v running test 52 'intel_pt//u'failed to parse event 'intel_pt//u', err 1, str 'Cannot find PMU `intel_pt'. Missing kernel support?' event syntax error: 'intel_pt//u' \___ Cannot find PMU `intel_pt'. Missing kernel support? Committer note: Use named initializers in the struct parse_events_error variable to avoid breaking the build on centos5, 6 and others with a similar gcc: cc1: warnings being treated as errors tests/parse-events.c: In function 'test_event': tests/parse-events.c:1696: error: missing initializer tests/parse-events.c:1696: error: (near initialization for 'err.str') Reported-by: Kim Phillips Signed-off-by: Jiri Olsa Tested-by: Kim Phillips Cc: Alexander Shishkin Cc: David Ahern Cc: Heiko Carstens Cc: Hendrik Brueckner Cc: Martin Schwidefsky Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Thomas Richter Link: http://lkml.kernel.org/r/20180611093422.1005-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/parse-events.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 7d4077068454..9751e7563a45 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1686,6 +1686,7 @@ static struct terms_test test__terms[] = { static int test_event(struct evlist_test *e) { + struct parse_events_error err = { .idx = 0, }; struct perf_evlist *evlist; int ret; @@ -1693,10 +1694,11 @@ static int test_event(struct evlist_test *e) if (evlist == NULL) return -ENOMEM; - ret = parse_events(evlist, e->name, NULL); + ret = parse_events(evlist, e->name, &err); if (ret) { - pr_debug("failed to parse event '%s', err %d\n", - e->name, ret); + pr_debug("failed to parse event '%s', err %d, str '%s'\n", + e->name, ret, err.str); + parse_events_print_error(&err, e->name); } else { ret = e->check(evlist); }