Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp226927pxb; Sat, 18 Sep 2021 00:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzauHVHdQnqFwmLbPHE7rYk2O7zcfUJHJgagBowKvGDrE2jMHeHIOfKjSOzMz/7VMJr7I5Z X-Received: by 2002:a17:907:7613:: with SMTP id jx19mr17402973ejc.453.1631951144044; Sat, 18 Sep 2021 00:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631951144; cv=none; d=google.com; s=arc-20160816; b=IYkuKyjPGQh+lFDeb/lqGgjRgnNDf7Z0TeYq1pe0knIJPAnpLPThTSNbdGlr610ATv 6QSIdKTOnLVIrgSgRN7bjxGl7hZvzBDeJLvKZ8tJa6OkSt9yEdjAGZY+a0/s1015um2a 2wY10K/VwXMAnUaKpTLcA0evs46MjZYXdsG42tLoKUmr/c/j9JfrvhHusdjg1ve2K7Nd TWFU6anDGjV2uTztyYm3SY/tgmGK9nov3GqQZHVWymLIW/bfNQ+Mitgmacnuh+JArCWb 92fkRpAr7HKW8pWSlY2en1aLTRHvalFJnpGPrNvk+nw9TQiRycUVVXweRbZWZrioBbrj hL6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=otIPOBKTALgDqmbdP0BjYHgFoa0MRSeqshKC5h3969Y=; b=CC/z2fR9Ch+BhiDA9m2noBeAmDPeFCAGj7gyLynVRzKFkH5WfADgU+YhzMnELPP2GB 3gwc/bZrnCT2CZYm46d6gxpdbX43X5IQ8PCH7tgwliM2dKaSofQtW2gWICKIPiBy1TQH 2V6XuzVUVXO/zge8K8k9nUJaZdo9lZ0juEfy2wfjVSCwb1AUXMvMKx4Zo2QCG+ETpdbr pZH1XDklEX3etjPGV3C1SZkJVvI1Lq8XskDgOg/9ZvDPrvbl1mzTbDYJ0T6Gc9spZTdf LqJ7rah8cYaL0SxmiVp6VbLHH99GoDYIlkqgu4g4KqfPPma9ntnwtRwpUtgZoygGZwhI t+QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Hd+4Aiyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si9764539ejl.311.2021.09.18.00.45.19; Sat, 18 Sep 2021 00:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Hd+4Aiyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241157AbhIQTTe (ORCPT + 99 others); Fri, 17 Sep 2021 15:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241158AbhIQTTd (ORCPT ); Fri, 17 Sep 2021 15:19:33 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 046EDC061757 for ; Fri, 17 Sep 2021 12:18:11 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id v16so11427517ilg.3 for ; Fri, 17 Sep 2021 12:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=otIPOBKTALgDqmbdP0BjYHgFoa0MRSeqshKC5h3969Y=; b=Hd+4Aiyrp4nfBdHIyKtNFxYpomaky9COpAb7rrFjoWuG4rB/wWrvTmL6TAhi7IArtC PC0cFHKY+VI6OpfeMlWG/3BsFRpp9WFfLanu+/ZjpuWArtPopTIbU00NbvByamDDJfvf hRyvOupEj5JXm1Tr20b8zVMDofKS+ifaomP6UgeueedB3XYMeC+Pq72m6a/EnsKTJ23s cKin76OAiwd8BBf04fFBbwlbEs4mHsKU9RTAMT/9EXQmy3atgD8I1I+c52VvGOcMinyr C0FnfVZMvNt74O7DqLAIpoZe4PPOadicE8I7j3QtTimUsr5qr7mFe4NSMkeX7O3uH8MX SaJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=otIPOBKTALgDqmbdP0BjYHgFoa0MRSeqshKC5h3969Y=; b=rcK0sxxtGBhBhnDnrtjeC+S9C/DwO+I1A/LrYAsXXM47Nm8v0vYBSgyVmHAd5aF8cj R1u31Llap7JvyaWiNsyh8my4fETZWx8xysar7L6X4J1IJVkLr1aLTnzqM6tpy1PQxZKr WXMXh4SEqMSki8LB+wV9QODXslhHW6CidBULgsRT0IAuAszIVrMZVrzA0N6zVQbdzqY4 /LoZ0X/yraaW5LW4XHLiXZQEhXwZku2jafxSPc48kUNIrFIlHG11nzrsOplaLNLDzRJW hul7JnRAEGB4wxb9ujw7Yg0F0JSbtardF6BeXVxr0py/5wrXePmXcmXsm5fSvOe6R3sN yfZQ== X-Gm-Message-State: AOAM530+tTAox0WBNa69SS/DzKxhMx0imUXBmPl/ixlAaGFGPvs8KzHF XduJMLZh+d0Q8KBcs9rljOc5CD+W4XlFtdRN0s/6yA== X-Received: by 2002:a92:440c:: with SMTP id r12mr9077114ila.174.1631906290176; Fri, 17 Sep 2021 12:18:10 -0700 (PDT) MIME-Version: 1.0 References: <20210916060525.1890638-1-irogers@google.com> <20210916120434.GA4498@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> In-Reply-To: <20210916120434.GA4498@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> From: Ian Rogers Date: Fri, 17 Sep 2021 12:17:58 -0700 Message-ID: Subject: Re: [PATCH v2] perf test: Workload test of metric and metricgroups To: "Paul A. Clarke" , John Garry Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Jin Yao , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, eranian@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 5:04 AM Paul A. Clarke wrote: > > On Wed, Sep 15, 2021 at 11:05:25PM -0700, Ian Rogers wrote: > > Test every metric and metricgroup with 'true' as a workload. > > Good idea! (However...) > > > Signed-off-by: Ian Rogers > > --- > > tools/perf/tests/shell/stat_all_metricgroups.sh | 12 ++++++++++++ > > tools/perf/tests/shell/stat_all_metrics.sh | 16 ++++++++++++++++ > > 2 files changed, 28 insertions(+) > > create mode 100755 tools/perf/tests/shell/stat_all_metricgroups.sh > > create mode 100755 tools/perf/tests/shell/stat_all_metrics.sh > > > > diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh > > new file mode 100755 > > index 000000000000..de24d374ce24 > > --- /dev/null > > +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh > > @@ -0,0 +1,12 @@ > > +#!/bin/sh > > +# perf all metricgroups test > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +set -e > > + > > +for m in $(perf list --raw-dump metricgroups); do > > + echo "Testing $m" > > + perf stat -M "$m" true > > +done > > + > > +exit 0 > > This always succeeds. Is that what you want? > Maybe check the return code from "perf", at least? The "set -e" above means that if the perf command fails then the test exits. > > diff --git a/tools/perf/tests/shell/stat_all_metrics.sh b/tools/perf/tests/shell/stat_all_metrics.sh > > new file mode 100755 > > index 000000000000..81b19ba27e68 > > --- /dev/null > > +++ b/tools/perf/tests/shell/stat_all_metrics.sh > > @@ -0,0 +1,16 @@ > > +#!/bin/sh > > +# perf all metrics test > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +set -e > > + > > +for m in `perf list --raw-dump metrics`; do > > + echo "Testing $m" > > + result=$(perf stat -M "$m" true) > > I don't think this is doing what you want it to do, as it just captures the > output of "true", which is always empty. > > > + if [[ "$result" =~ "$m" ]]; then > > So this always fails to match, and you'll never fail here, either. :-) Doh! Thanks for catching this! > > + echo "Metric not printed: $m" > > + exit 1 > > + fi > > +done > > + > > +exit 0 > > You may want to redirect the output of the "perf" command to a temporary file, > then grep within that. And, you'll need to remove the file before running the > perf command, because if it fails, it will leave any existing file untouched. I fixed it by redirecting stderr. Thanks! Ian > Thanks! :-) > > PC