Files
linux/tools/perf/tests/shell/evlist.sh
Thomas Richter 008603bda1 perf test: Fix test perf evlist for z/VM s390x
Perf test case 'perf evlist tests' fails on z/VM machines on s390.

The failure is causes by event cycles. This event is not available
on virtualized machines like z/VM on s390.

Change to software event cpu-clock to fix this.

    Output before:
      # ./perf test 78
      79: perf evlist tests              : FAILED!
      #

    Output after:
      # ./perf test 78
      79: perf evlist tests              : Ok
      #

Fixes: b04d2b9199 ("perf test: Fix test case perf evlist tests for s390x")
Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Tested-by: Jan Polensky <japo@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-01-26 18:21:20 -03:00

81 lines
1.5 KiB
Bash
Executable File

#!/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 cpu-clock -o "${perfdata}" true 2> /dev/null
then
echo "Simple evlist [Failed record]"
err=1
return
fi
if ! perf evlist -i "${perfdata}" | grep -q "cpu-clock"
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 "{cpu-clock,task-clock}" -o "${perfdata}" \
-- perf test -w noploop 2> /dev/null
then
echo "Group evlist [Skipped event group recording failed]"
return
fi
if ! perf evlist -i "${perfdata}" -g | grep -q "{.*cpu-clock.*,.*task-clock.*}"
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