From: Ian Rogers <irogers@google.com>
To: Alexey Bayduraev <alexey.bayduraev@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Riccardo Mancini <rickyman7@gmail.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
Subject: [PATCH v2 3/3] perf test: Add basic perf record tests
Date: Wed, 13 Apr 2022 18:46:42 -0700 [thread overview]
Message-ID: <20220414014642.3308206-3-irogers@google.com> (raw)
In-Reply-To: <20220414014642.3308206-1-irogers@google.com>
Test the --per-thread flag.
Test Intel machine state capturing.
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/record.sh | 42 ++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100755 tools/perf/tests/shell/record.sh
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
new file mode 100755
index 000000000000..cd1cf14259b8
--- /dev/null
+++ b/tools/perf/tests/shell/record.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# perf record tests
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+err=0
+test_per_thread() {
+ echo "Basic --per-thread mode test"
+ perf record -e instructions:u --per-thread -o- true 2> /dev/null \
+ | perf report -i- -q \
+ | egrep -q true
+ echo "Basic --per-thread mode test [Success]"
+}
+
+test_register_capture() {
+ echo "Register capture test"
+ if ! perf list | egrep -q 'br_inst_retired.near_call'
+ then
+ echo "Register capture test [Skipped missing instruction]"
+ return
+ fi
+ if ! perf record --intr-regs=\? 2>&1 | egrep -q 'available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15'
+ then
+ echo "Register capture test [Skipped missing registers]"
+ return
+ fi
+ if ! perf record -o - --intr-regs=di,r8,dx,cx -e cpu/br_inst_retired.near_call/p \
+ -c 1000 --per-thread true 2> /dev/null \
+ | perf script -F ip,sym,iregs -i - 2> /dev/null \
+ | egrep -q "DI:"
+ then
+ echo "Register capture test [Failed missing output]"
+ err=1
+ return
+ fi
+ echo "Register capture test [Success]"
+}
+
+test_per_thread
+test_register_capture
+exit $err
--
2.36.0.rc0.470.gd361397f0d-goog
next prev parent reply other threads:[~2022-04-14 1:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 1:46 [PATCH v2 1/3] perf record: Fix per-thread option Ian Rogers
2022-04-14 1:46 ` [PATCH v2 2/3] perf cpumap: Switch to using perf_cpu_map API Ian Rogers
2022-04-14 12:09 ` Arnaldo Carvalho de Melo
2022-04-14 1:46 ` Ian Rogers [this message]
2022-04-14 12:10 ` [PATCH v2 3/3] perf test: Add basic perf record tests Arnaldo Carvalho de Melo
2022-04-14 12:09 ` [PATCH v2 1/3] perf record: Fix per-thread option Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220414014642.3308206-3-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexey.bayduraev@gmail.com \
--cc=alexey.v.bayduraev@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rickyman7@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).