Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp222016lqp; Thu, 4 Apr 2024 11:09:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZheinpjGpbtTxu/katioR7zq+qTC6mgjEbJyY3jaBONNTEPDFl1eAVY5RWNH10WqzDubADjMnbA94a0Ic20nT5NRpC/dmdnQXOTJdFw== X-Google-Smtp-Source: AGHT+IGII+q8Y6QRsjKjM+E+gOeXdct+E9W5PPL0losEjV6ZQjQQnGPq8Ss1g+fTuv8Q9UsFu5iK X-Received: by 2002:a05:6214:1d22:b0:699:2b22:ae13 with SMTP id f2-20020a0562141d2200b006992b22ae13mr437457qvd.12.1712254186238; Thu, 04 Apr 2024 11:09:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712254186; cv=pass; d=google.com; s=arc-20160816; b=xboG5Hz/rV0SJ+CwOuMJaqAJLt/l6Nc2P8BnTldYoYugglAV22P8emax8AwRmurZCU gIoBp0rm7J/BKfFhy+xbUbQIEo1c1PjUPMvJCso6qWGaM7ipdI5DILg4RWl7ZVDdlRQ0 0BzwFet/f53trAQyNL3M2fvjWl7bQmxShKP2JYYZE2kkN0XAkRXDG1S+xfQU0j+k5Fe4 wP/IT/Z1QfdfRNKSDETiuo5oddWDYCTrYF6MZJ6tkm2mbEzgG3lIu7C4pyCbBvD550x7 vLMzMfzCbWamDvxhS4c47DXk3+Eb7vJnLBe2kxtJ+eFBU97P9oY7prJEKM34+uLkhsdC guJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=Q0Iw1ZA3glUSrCjqo0XgoMrR9akniIS9Yku901iiv9o=; fh=rykBm40vIAIdNhQJvsJWPplyHs8mgvVAo6IcsiF6xMw=; b=XQymOiO3uuyf6J6igS/yrw6CfVsUceAasU+XsyYCVItVe+SSSsX2T8ej0UV73w5d9k mXm3oO9WJoD+XM4daIoPlJq3Gcvv0TIue3WbX8mgqhPONuE0tzLtXPuRZ+rajjq0vV/P FI0Q/rs3wQxMLfO3nQL8LNzXUpJ3/6aU1eSzpZ6mNyf/ekQ25mGLF1qftbpj8VxkkdVU fouXs34KiUPXeXdWVduqwdnO60HI6vu2t+3XX8USV+rLl1BdCujWGA/kSCef2gE8Pv15 oXM44D8Q6LR4iPz68OwgPNWL9UQsblBP4CHzIttL7OPmegJFzM0GgxBgMl46Y+STjlEX CW6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131938-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131938-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q4-20020a056214018400b0068fc588ca99si16651119qvr.476.2024.04.04.11.09.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 11:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131938-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131938-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131938-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 463C21C28C76 for ; Thu, 4 Apr 2024 18:08:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55A25130A79; Thu, 4 Apr 2024 18:08:45 +0000 (UTC) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5097412FF71; Thu, 4 Apr 2024 18:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712254124; cv=none; b=NODe+CjvRK+Ozjbj08F4BflB+8DONn7tF0OoB9kYQAT8o51hh/dFoMiXbX6GA6z2Asb0gBru5rUMm6InViD7kgcv1Kwn4N8jkb4EnOaKzPGBjKiLoO196v2aSSZdndPGTUJGkheYwjun5pbSFfr5qUHm1uV0SPYF5Kv2cIA6L/c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712254124; c=relaxed/simple; bh=0DbusI7GY03Wj0tGOtwXkpAVva/Wgxk1NxWdN40xn+4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=lIqGutPbNbrRHVIqm8jLoBuJfOTZcONcsvc1ClT4A3nOcwnaB+op80EJMDNJgOs4SoOHq1qt1b0AGHYhPCWBR7hmpCReBxIzrwYrZm32zLZIKuUA631vqV5LVn9tLIER3kfSlox+4yX5Xl0OfzioUsxtu/XNBoSdFLw3N3QU7DI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5f034b4dcecso955368a12.1; Thu, 04 Apr 2024 11:08:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712254122; x=1712858922; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q0Iw1ZA3glUSrCjqo0XgoMrR9akniIS9Yku901iiv9o=; b=ulMHaorPtVCabsUrESsseKQfmWnMvlVkxcFB37bT5VEtcpDETjkyVbagX7IwpiZFyC NRzafD/yCi1DJ7+H9eSMlX0U19F1HjfZus5ajA9YnnLywxhG/wVEI/qEDJ4JpegMirS7 V5cW0TXxlDXM8cL+un6mtUZp9n/b2m+jpjISEz/GIZ5Y08EDj85qdZ5w9AbmWxepjj74 YgXMiYjfXMDvyHbZP8u49AegoaW6ANYpYdY9ksRHJzVuJRO0LSR7z76+CbzCOrHmP21Y 9YDRh0mxJH6vDzCQ/pGrzDXJGjeu6ropFVGMJym5t76+eITpavL4VpZpuaV2BlA2C8Tm i1Ug== X-Forwarded-Encrypted: i=1; AJvYcCXm1rYO+no7od/chJB6iXHCSv0SPxTklj3ow+lFRO6yJoGIgXxFw/DDC78pSpN5+V3XA3geDoattItSsji+fV3oiDPXATltYg9L7S5u4iNI1DGi0XiUFNxxvTD442dSdbXuqdn14EnBLd9CGnTyeg== X-Gm-Message-State: AOJu0YwMIJMsygu7934SaCsi552+paQt+3DvVXe9+hunHTx69Gk9iFfh VMCLNGGGJLJeJ/NQfgmmi9y1GDy9QYBX3eJzVHHuZjWmB3OU7WNpM7r3srfUmpAIx8h3LRP+Ffj IEgMIN+PcmgzDnoF8X0JUOOKvjWg= X-Received: by 2002:a17:90a:2f05:b0:2a2:6244:32b5 with SMTP id s5-20020a17090a2f0500b002a2624432b5mr374623pjd.11.1712254122425; Thu, 04 Apr 2024 11:08:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240403164818.3431325-1-irogers@google.com> In-Reply-To: <20240403164818.3431325-1-irogers@google.com> From: Namhyung Kim Date: Thu, 4 Apr 2024 11:08:31 -0700 Message-ID: Subject: Re: [PATCH v1] perf test: Be more tolerant of metricgroup failures To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Athira Rajeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ian, On Wed, Apr 3, 2024 at 9:48=E2=80=AFAM Ian Rogers wrot= e: > > Previously "set -e" meant any non-zero exit code from perf stat would > cause a test failure. As a non-zero exit happens when there aren't > sufficient permissions, check for this case and make the exit code > 2/skip for it. > > Signed-off-by: Ian Rogers Acked-by: Namhyung Kim Thanks, Namhyung > --- > .../perf/tests/shell/stat_all_metricgroups.sh | 28 +++++++++++++++---- > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf= /tests/shell/stat_all_metricgroups.sh > index 55ef9c9ded2d..d6db192b9f18 100755 > --- a/tools/perf/tests/shell/stat_all_metricgroups.sh > +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh > @@ -1,9 +1,7 @@ > -#!/bin/sh > +#!/bin/bash > # perf all metricgroups test > # SPDX-License-Identifier: GPL-2.0 > > -set -e > - > ParanoidAndNotRoot() > { > [ "$(id -u)" !=3D 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid= )" -gt $1 ] > @@ -14,11 +12,29 @@ if ParanoidAndNotRoot 0 > then > system_wide_flag=3D"" > fi > - > +err=3D0 > for m in $(perf list --raw-dump metricgroups) > do > echo "Testing $m" > - perf stat -M "$m" $system_wide_flag sleep 0.01 > + result=3D$(perf stat -M "$m" $system_wide_flag sleep 0.01 2>&1) > + result_err=3D$? > + if [[ $result_err -gt 0 ]] > + then > + if [[ "$result" =3D~ \ > + "Access to performance monitoring and observability operations= is limited" ]] > + then > + echo "Permission failure" > + echo $result > + if [[ $err -eq 0 ]] > + then > + err=3D2 # Skip > + fi > + else > + echo "Metric group $m failed" > + echo $result > + err=3D1 # Fail > + fi > + fi > done > > -exit 0 > +exit $err > -- > 2.44.0.478.gd926399ef9-goog >