lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251122081929.7588-17-irogers@google.com>
Date: Sat, 22 Nov 2025 00:19:28 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	James Clark <james.clark@...aro.org>, Collin Funk <collin.funk1@...il.com>, 
	Dmitry Vyukov <dvyukov@...gle.com>, Andi Kleen <ak@...ux.intel.com>, 
	Thomas Falcon <thomas.falcon@...el.com>, Leo Yan <leo.yan@....com>, 
	Yicong Yang <yangyicong@...ilicon.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Stephen Brennan <stephen.s.brennan@...cle.com>, 
	Haibo Xu <haibo1.xu@...el.com>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org
Subject: [PATCH v1 16/17] perf tests evlist: Add basic evlist test

Add test that evlist reports expected events from perf record.

Signed-off-by: Ian Rogers <irogers@...gle.com>
---
 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/evlist.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=0
+perfdata=$(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=1
+		return
+	fi
+	if ! perf evlist -i "${perfdata}" | grep -q "cycles"
+	then
+		echo "Simple evlist [Failed to list event]"
+		err=1
+		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.*,.*instructions.*}"
+	then
+		echo "Group evlist [Failed to list event group]"
+		err=1
+		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=1
+		return
+	fi
+
+	if ! perf evlist -i "${perfdata}" -v | grep -q "config:"
+	then
+		echo "Event configuration evlist [Failed to list verbose info]"
+		err=1
+		return
+	fi
+	echo "Event configuration evlist test [Success]"
+}
+
+test_evlist_simple
+test_evlist_group
+test_evlist_verbose
+
+cleanup
+exit $err
-- 
2.52.0.rc2.455.g230fcf2819-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ