Commit 280c36d2 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf test: Add skip to --per-thread test

As reported in:
https://lore.kernel.org/linux-perf-users/20220428122821.3652015-1-tmricht@linux.ibm.com/
the 'instructions:u' event may not be supported. Add a skip using 'perf
record'.

Switch some code away from pipe to make the failures clearer.
Reported-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Tested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20220505182505.3313191-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 33cd6928
...@@ -5,11 +5,43 @@ ...@@ -5,11 +5,43 @@
set -e set -e
err=0 err=0
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
cleanup() {
rm -f ${perfdata}
rm -f ${perfdata}.old
trap - exit term int
}
trap_cleanup() {
cleanup
exit 1
}
trap trap_cleanup exit term int
test_per_thread() { test_per_thread() {
echo "Basic --per-thread mode test" echo "Basic --per-thread mode test"
perf record -e instructions:u --per-thread -o- true 2> /dev/null \ if ! perf record -e instructions:u -o ${perfdata} --quiet true 2> /dev/null
| perf report -i- -q \ then
| egrep -q true echo "Per-thread record [Skipped instructions:u not supported]"
if [ $err -ne 1 ]
then
err=2
fi
return
fi
if ! perf record -e instructions:u --per-thread -o ${perfdata} true 2> /dev/null
then
echo "Per-thread record of instructions:u [Failed]"
err=1
return
fi
if ! perf report -i ${perfdata} -q | egrep -q true
then
echo "Per-thread record [Failed missing output]"
err=1
return
fi
echo "Basic --per-thread mode test [Success]" echo "Basic --per-thread mode test [Success]"
} }
...@@ -18,6 +50,10 @@ test_register_capture() { ...@@ -18,6 +50,10 @@ test_register_capture() {
if ! perf list | egrep -q 'br_inst_retired.near_call' if ! perf list | egrep -q 'br_inst_retired.near_call'
then then
echo "Register capture test [Skipped missing instruction]" echo "Register capture test [Skipped missing instruction]"
if [ $err -ne 1 ]
then
err=2
fi
return return
fi 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' 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'
...@@ -37,8 +73,8 @@ test_register_capture() { ...@@ -37,8 +73,8 @@ test_register_capture() {
echo "Register capture test [Success]" echo "Register capture test [Success]"
} }
# Test for platform support and return TEST_SKIP
[ $(uname -m) = s390x ] && exit 2
test_per_thread test_per_thread
test_register_capture test_register_capture
cleanup
exit $err exit $err
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment