Files
cubelinux-kernel/tools/perf/tests/shell/evlist.sh
T
Greg Kroah-Hartman 598cf27219 Linux 6.19.3
Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
Tested-by: Peter Schneider <pschneider1968@googlemail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Brett A C Sheffield <bacs@librecast.net>
Tested-by: Mark Brown <broonie@kernel.org>
Tested-by: Luna Jernberg <droidbittin@gmail.com>
Tested-by: Ronald Warsow <rwarsow@gmx.de>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-02-19 16:33:27 +01:00

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