From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Jann Horn <jannh@google.com>,
Colin Ian King <colin.i.king@gmail.com>,
Casey Chen <cachen@purestorage.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Chaitanya S Prakash <chaitanyas.prakash@arm.com>,
James Clark <james.clark@linaro.org>,
Ze Gao <zegao2021@gmail.com>,
Yang Jihong <yangjihong1@huawei.com>,
Yunseong Kim <yskelg@gmail.com>,
Weilin Wang <weilin.wang@intel.com>,
Dominique Martinet <asmadeus@codewreck.org>,
Anne Macedo <retpolanne@posteo.net>,
Sun Haiyong <sunhaiyong@loongson.cn>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 06/13] perf test: Expand pipe/inject test
Date: Fri, 16 Aug 2024 23:44:35 -0700 [thread overview]
Message-ID: <20240817064442.2152089-7-irogers@google.com> (raw)
In-Reply-To: <20240817064442.2152089-1-irogers@google.com>
Test recording of call-graphs and injecting --build-all. Add/expand
trap handler.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/pipe_test.sh | 101 ++++++++++++++++++++++------
1 file changed, 79 insertions(+), 22 deletions(-)
diff --git a/tools/perf/tests/shell/pipe_test.sh b/tools/perf/tests/shell/pipe_test.sh
index a78d35d2cff0..ad10012fdc29 100755
--- a/tools/perf/tests/shell/pipe_test.sh
+++ b/tools/perf/tests/shell/pipe_test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# perf pipe recording and injection test
# SPDX-License-Identifier: GPL-2.0
@@ -12,30 +12,87 @@ skip_test_missing_symbol ${sym}
data=$(mktemp /tmp/perf.data.XXXXXX)
prog="perf test -w noploop"
-task="perf"
+err=0
-if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep ${task}; then
- echo "cannot find the test file in the perf report"
- exit 1
-fi
+set -e
-if ! perf record -e task-clock:u -o - ${prog} | perf inject -b | perf report -i - | grep ${sym}; then
- echo "cannot find noploop function in pipe #1"
- exit 1
-fi
+cleanup() {
+ rm -rf "${data}"
+ rm -rf "${data}".old
-perf record -e task-clock:u -o - ${prog} | perf inject -b -o ${data}
-if ! perf report -i ${data} | grep ${sym}; then
- echo "cannot find noploop function in pipe #2"
- exit 1
-fi
+ trap - EXIT TERM INT
+}
-perf record -e task-clock:u -o ${data} ${prog}
-if ! perf inject -b -i ${data} | perf report -i - | grep ${sym}; then
- echo "cannot find noploop function in pipe #3"
- exit 1
-fi
+trap_cleanup() {
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+test_record_report() {
+ echo
+ echo "Record+report pipe test"
+
+ task="perf"
+ if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
+ then
+ echo "Record+report pipe test [Failed - cannot find the test file in the perf report #1]"
+ err=1
+ return
+ fi
+
+ if ! perf record -g -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
+ then
+ echo "Record+report pipe test [Failed - cannot find the test file in the perf report #2]"
+ err=1
+ return
+ fi
+
+ echo "Record+report pipe test [Success]"
+}
+
+test_inject_bids() {
+ inject_opt=$1
+
+ echo
+ echo "Inject ${inject_opt} build-ids test"
+
+ if ! perf record -e task-clock:u -o - ${prog} | perf inject ${inject_opt}| perf report -i - | grep -q ${sym}
+ then
+ echo "Inject build-ids test [Failed - cannot find noploop function in pipe #1]"
+ err=1
+ return
+ fi
+
+ if ! perf record -g -e task-clock:u -o - ${prog} | perf inject ${inject_opt} | perf report -i - | grep -q ${sym}
+ then
+ echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #2]"
+ err=1
+ return
+ fi
+
+ perf record -e task-clock:u -o - ${prog} | perf inject ${inject_opt} -o ${data}
+ if ! perf report -i ${data} | grep -q ${sym}; then
+ echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #3]"
+ err=1
+ return
+ fi
+
+ perf record -e task-clock:u -o ${data} ${prog}
+ if ! perf inject ${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
+ echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #4]"
+ err=1
+ return
+ fi
+
+ echo "Inject ${inject_opt} build-ids test [Success]"
+}
+
+test_record_report
+test_inject_bids -b
+test_inject_bids --buildid-all
+
+cleanup
+exit $err
-rm -f ${data} ${data}.old
-exit 0
--
2.46.0.184.g6999bdac58-goog
next prev parent reply other threads:[~2024-08-17 6:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-17 6:44 [PATCH v1 00/13] perf inject improvements Ian Rogers
2024-08-17 6:44 ` [PATCH v1 01/13] perf synthetic-events: Avoid unnecessary memset Ian Rogers
2024-08-17 6:44 ` [PATCH v1 02/13] perf map: API clean up Ian Rogers
2024-08-17 6:44 ` [PATCH v1 03/13] perf jit: Constify filename argument Ian Rogers
2024-08-17 6:44 ` [PATCH v1 04/13] perf dso: Constify dso_id Ian Rogers
2024-08-17 6:44 ` [PATCH v1 05/13] perf evsel: Constify evsel__id_hdr_size argument Ian Rogers
2024-08-17 6:44 ` Ian Rogers [this message]
2024-08-17 6:44 ` [PATCH v1 07/13] perf inject: Combine build_ids and build_id_all into enum Ian Rogers
2024-08-17 6:44 ` [PATCH v1 08/13] perf inject: Combine different mmap and mmap2 functions Ian Rogers
2024-08-17 6:44 ` [PATCH v1 09/13] perf inject: Combine mmap and mmap2 handling Ian Rogers
2024-08-17 6:44 ` [PATCH v1 10/13] perf inject: Fix build ID injection Ian Rogers
2024-08-19 18:01 ` Arnaldo Carvalho de Melo
2024-08-19 19:54 ` Ian Rogers
2024-08-28 15:15 ` Ian Rogers
2024-09-02 18:26 ` Namhyung Kim
2024-09-03 18:34 ` Arnaldo Carvalho de Melo
2024-08-17 6:44 ` [PATCH v1 11/13] perf inject: Add new mmap2-buildid-all option Ian Rogers
2024-08-17 6:44 ` [PATCH v1 12/13] perf inject: Lazy build-id mmap2 event insertion Ian Rogers
2024-08-17 6:44 ` [PATCH v1 13/13] perf callchain: Allow symbols to be optional when resolving a callchain Ian Rogers
2024-09-02 18:27 ` [PATCH v1 00/13] perf inject improvements Namhyung Kim
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=20240817064442.2152089-7-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnd@arndb.de \
--cc=asmadeus@codewreck.org \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=cachen@purestorage.com \
--cc=chaitanyas.prakash@arm.com \
--cc=colin.i.king@gmail.com \
--cc=james.clark@linaro.org \
--cc=jannh@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=retpolanne@posteo.net \
--cc=sunhaiyong@loongson.cn \
--cc=weilin.wang@intel.com \
--cc=yangjihong1@huawei.com \
--cc=yskelg@gmail.com \
--cc=zegao2021@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