From nobody Tue Dec 2 01:36:23 2025 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 C10642FB966 for ; Sat, 22 Nov 2025 08:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763799608; cv=none; b=u5OPvXzqIgQN/vuWtEi2DqsNDDK8aXiqXTmSWFcPtLfAb5g/KY8q4DJTq5Pvfc7+WUXXAHyEAheouJVP0Fj1a0LRpIBwBRioPz/QKo9907olteClsMxyfYOrRO7k6yNZd3wdEWLFm/BAIHCuC5ci/D/t280iy4563RoPejrw5sY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763799608; c=relaxed/simple; bh=cVbo9KyKjAiks4mZRtglLay3uOkQ31MIH0rTAfdDkxU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=eqfHTelSXhZKSl5c6Rx5V+g0Jqc849EDI32XsEuaWnkC97hYrmAlwIUbrdsd5/lEcO6sumg46IszdWdpocHu/H76sRE+1x6XWjNvAWxprgY6kYrRybnRhOzxU8M/Lp0IoA5a36/gY7Vvb4ZuIY31FiwGwPefEx1Qv5N5Q4Sy2bc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nDcwQ7K1; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nDcwQ7K1" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-b55735710f0so4089373a12.2 for ; Sat, 22 Nov 2025 00:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763799606; x=1764404406; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=c5vcUZ36q7LIP5k988zWeeeMo0DAr72XmNMPXeiuOFk=; b=nDcwQ7K1EjzwrCoIPsER93yq7sG+vw8gu6NqIJmcseRTYyV/PGpapZG0uG0xOD6ZwW jlmt76Ic6y0lUeXmT8NYIf8TPXs6n2SB9MvOOR8FZ4/Yw09FhKRankk5ZwHONWjAq6Uo u6EhR4vDDrEjMIiwzeqK+BZnjyjw3QNwSH+U9Futm517ZAR3hskvc7sjq/iqA8dUHa0Q tsjupbjHv9R1AWUI71FS4B5tX7bhL/a9hJVWNNJ/BPs4GxZzI0WfHvKwPlNkaBL5i9Ru T2tHHoGjt6bH7NAcMeRYv+k2Ml1JYV4fT1Xc3dMF5hA5+/2hMELtFXOTExh2r6AZ2nVp nlgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763799606; x=1764404406; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c5vcUZ36q7LIP5k988zWeeeMo0DAr72XmNMPXeiuOFk=; b=ZeUJhV55jrZ5f+B5xZuMZj8o98RxFPyvdTPmGj7uObGqxL4VcY2iB8DyZB+/ZXGGPW gIGM8v+9/uHpW5jVlc9dRvJOgSzYjHv0xEW0PjCm7aBVEc2jK9WXfaDdYCIyTISn1loI mzw3GXGg7ru0kA/cn6kapdcg43qDUo3htFcBuWa1Dkmf1z8oML0vgrMqSSNiPqIZPydW IgyAZT67K7/RC6O6EKA8ajfo8xR4/tG1pSF6fnuEOsujoOUtkfRHtty+euEnNNMICtdG z16LB/bsksn22hI+pOA2nCmrC2c8uHmoQfuinwNz9iiiJ/TrUUElsPHJvIYUzNQWZ0V8 Gn5g== X-Forwarded-Encrypted: i=1; AJvYcCUnFTVn8q8V3NNu5dD7ThtfIbT00qtf7Kh3sPJ+Z76ofeqqVSFb2TTBBtP2JxJIuIZWU+YifKHnOxox9uY=@vger.kernel.org X-Gm-Message-State: AOJu0YyShVdYxdiV+mj8+nBkzaOnBbWpGsjmLeYai5TXibHGU922/WcN QUXkE2hSaZ9gGqO6odU8qgUwfGEMCAqWCzMP0MvHR2fdV1YVoxu1LfdSl6d4mYFi+Smoty/VFRT 2i8yqzIwhuQ== X-Google-Smtp-Source: AGHT+IHp2n+PMLI6OfHsMt+oT7Bf6B1GSkHq8pvIHAETmUrFKTEcUmTA0f7lg7TVaCVrRV2nsTnRe5nKpQtt X-Received: from dlbdd12.prod.google.com ([2002:a05:7022:a8c:b0:119:49ca:6b9c]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:388e:b0:11b:9386:8267 with SMTP id a92af1059eb24-11c9d86fc93mr2488596c88.44.1763799605924; Sat, 22 Nov 2025 00:20:05 -0800 (PST) Date: Sat, 22 Nov 2025 00:19:28 -0800 In-Reply-To: <20251122081929.7588-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251122081929.7588-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <20251122081929.7588-17-irogers@google.com> Subject: [PATCH v1 16/17] perf tests evlist: Add basic evlist test From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Collin Funk , Dmitry Vyukov , Andi Kleen , Thomas Falcon , Leo Yan , Yicong Yang , Greg Kroah-Hartman , "Masami Hiramatsu (Google)" , Stephen Brennan , Haibo Xu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add test that evlist reports expected events from perf record. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/evlist.sh | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 tools/perf/tests/shell/evlist.sh diff --git a/tools/perf/tests/shell/evlist.sh b/tools/perf/tests/shell/evli= st.sh new file mode 100755 index 000000000000..140f099e75c1 --- /dev/null +++ b/tools/perf/tests/shell/evlist.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# perf evlist tests +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=3D0 +perfdata=3D$(mktemp /tmp/__perf_test.perf.data.XXXXX) + +cleanup() { + rm -f "${perfdata}" + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +test_evlist_simple() { + echo "Simple evlist test" + if ! perf record -e cycles -o "${perfdata}" true 2> /dev/null + then + echo "Simple evlist [Failed record]" + err=3D1 + return + fi + if ! perf evlist -i "${perfdata}" | grep -q "cycles" + then + echo "Simple evlist [Failed to list event]" + err=3D1 + return + fi + echo "Simple evlist test [Success]" +} + +test_evlist_group() { + echo "Group evlist test" + if ! perf record -e "{cycles,instructions}" -o "${perfdata}" true 2> /dev= /null + then + echo "Group evlist [Skipped event group recording failed]" + return + fi + + if ! perf evlist -i "${perfdata}" -g | grep -q "{.*cycles.*,.*instruction= s.*}" + then + echo "Group evlist [Failed to list event group]" + err=3D1 + return + fi + echo "Group evlist test [Success]" +} + +test_evlist_verbose() { + echo "Event configuration evlist test" + if ! perf record -e cycles -o "${perfdata}" true 2> /dev/null + then + echo "Event configuration evlist [Failed record]" + err=3D1 + return + fi + + if ! perf evlist -i "${perfdata}" -v | grep -q "config:" + then + echo "Event configuration evlist [Failed to list verbose info]" + err=3D1 + return + fi + echo "Event configuration evlist test [Success]" +} + +test_evlist_simple +test_evlist_group +test_evlist_verbose + +cleanup +exit $err --=20 2.52.0.rc2.455.g230fcf2819-goog