From: Namhyung Kim <namhyung@kernel.org>
To: Howard Chu <howardchu95@gmail.com>
Cc: acme@kernel.org, mingo@redhat.com, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
peterz@infradead.org, kan.liang@linux.intel.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/5] perf test trace: Remove set -e for BTF general tests
Date: Sun, 18 May 2025 10:38:55 -0700 [thread overview]
Message-ID: <aCobLyqonDU4qnzv@google.com> (raw)
In-Reply-To: <20250517163230.1237469-5-howardchu95@gmail.com>
On Sat, May 17, 2025 at 09:32:29AM -0700, Howard Chu wrote:
> Remove set -e and print error messages in BTF general tests.
>
> Before:
> $ sudo /tmp/perf test btf -vv
> 108: perf trace BTF general tests:
> 108: perf trace BTF general tests : Running
> --- start ---
> test child forked, pid 889299
> Checking if vmlinux BTF exists
> Testing perf trace's string augmentation
> String augmentation test failed
> ---- end(-1) ----
> 108: perf trace BTF general tests : FAILED!
>
> After:
> $ sudo /tmp/perf test btf -vv
> 108: perf trace BTF general tests:
> 108: perf trace BTF general tests : Running
> --- start ---
> test child forked, pid 886551
> Checking if vmlinux BTF exists
> Testing perf trace's string augmentation
> String augmentation test failed, output:
> :886566/886566 renameat2(CWD, "/tmp/file1_RcMa", CWD, "/tmp/file2_RcMa", NOREPLACE) = 0---- end(-1) ----
> 108: perf trace BTF general tests : FAILED!
>
> Signed-off-by: Howard Chu <howardchu95@gmail.com>
> ---
> tools/perf/tests/shell/trace_btf_general.sh | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/tests/shell/trace_btf_general.sh b/tools/perf/tests/shell/trace_btf_general.sh
> index a25d8744695e..e78e653fc8f1 100755
> --- a/tools/perf/tests/shell/trace_btf_general.sh
> +++ b/tools/perf/tests/shell/trace_btf_general.sh
> @@ -3,7 +3,6 @@
> # SPDX-License-Identifier: GPL-2.0
>
> err=0
> -set -e
>
> # shellcheck source=lib/probe.sh
> . "$(dirname $0)"/lib/probe.sh
> @@ -28,10 +27,10 @@ check_vmlinux() {
>
> trace_test_string() {
> echo "Testing perf trace's string augmentation"
> - if ! perf trace -e renameat* --max-events=1 -- mv ${file1} ${file2} 2>&1 | \
> - grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1}\", .*, \"${file2}\", .*\) += +[0-9]+$"
> + output="$(perf trace -e renameat* --max-events=1 -- mv ${file1} ${file2} 2>&1)"
> + if ! echo "$output" | grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1}\", .*, \"${file2}\", .*\) += +[0-9]+$"
> then
> - echo "String augmentation test failed"
> + printf "String augmentation test failed, output:\n$output"
Looks like you need "\n" after the output as well.
> err=1
> fi
> }
> @@ -39,20 +38,20 @@ trace_test_string() {
> trace_test_buffer() {
> echo "Testing perf trace's buffer augmentation"
> # echo will insert a newline (\10) at the end of the buffer
> - if ! perf trace -e write --max-events=1 -- echo "${buffer}" 2>&1 | \
> - grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.*, [0-9]+\) += +[0-9]+$"
> + output="$(perf trace -e write --max-events=1 -- echo "${buffer}" 2>&1)"
> + if ! echo "$output" | grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.*, [0-9]+\) += +[0-9]+$"
> then
> - echo "Buffer augmentation test failed"
> + printf "Buffer augmentation test failed, output:\n$output"
Ditto. And probably for the previous patch too.
> err=1
> fi
> }
>
> trace_test_struct_btf() {
> echo "Testing perf trace's struct augmentation"
> - if ! perf trace -e clock_nanosleep --force-btf --max-events=1 -- sleep 1 2>&1 | \
> - grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \{1,\}, 0x[0-9a-f]+\) += +[0-9]+$"
> + output="$(perf trace -e clock_nanosleep --force-btf --max-events=1 -- sleep 1 2>&1)"
> + if ! echo "$output" | grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \{1,\}, 0x[0-9a-f]+\) += +[0-9]+$"
> then
> - echo "BTF struct augmentation test failed"
> + printf "BTF struct augmentation test failed, output:\n$output"
And here as well.
Thanks,
Namhyung
> err=1
> fi
> }
> --
> 2.45.2
>
next prev parent reply other threads:[~2025-05-18 17:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-17 16:32 [PATCH v1 0/5] perf test trace: Reduce test failures and make error messages verbose Howard Chu
2025-05-17 16:32 ` [PATCH v1 1/5] perf test trace: Use shell's -f flag to check if vmlinux exists Howard Chu
2025-05-17 16:32 ` [PATCH v1 2/5] perf test trace: Remove set -e and print trace test's error messages Howard Chu
2025-05-18 17:36 ` Namhyung Kim
2025-05-18 18:14 ` Howard Chu
2025-05-17 16:32 ` [PATCH v1 3/5] perf test trace: Stop tracing hrtimer_init event in trace enum test Howard Chu
2025-05-17 16:32 ` [PATCH v1 4/5] perf test trace: Remove set -e for BTF general tests Howard Chu
2025-05-18 17:38 ` Namhyung Kim [this message]
2025-05-18 18:18 ` Howard Chu
2025-05-17 16:32 ` [PATCH v1 5/5] perf test trace BTF: Use --sort-events in " Howard Chu
2025-05-18 17:51 ` Namhyung Kim
2025-05-18 18:11 ` Howard Chu
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=aCobLyqonDU4qnzv@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=howardchu95@gmail.com \
--cc=irogers@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=mingo@redhat.com \
--cc=peterz@infradead.org \
/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).