perf testsuite: Add test for kprobe handling

Test perf interface to kprobes: listing, adding and removing probes. It
is run as a part of perftool-testsuite_probe test case.

Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Cc: kjain@linux.ibm.com
Cc: atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240215110231.15385-7-mpetlan@redhat.com
This commit is contained in:
Veronika Molnarova
2024-02-15 12:02:30 +01:00
committed by Namhyung Kim
parent 61d348f1e9
commit e7d759f31c
2 changed files with 326 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# SPDX-License-Identifier: GPL-2.0
#
# settings.sh of perf_probe test
# Author: Michael Petlan <mpetlan@redhat.com>
# Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
#
export TEST_NAME="perf_probe"
export MY_ARCH=`arch`
if [ -n "$PERFSUITE_RUN_DIR" ]; then
# when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there
# --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs
# dirs will be used for that
export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR`
export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME"
export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples"
test -d "$MAKE_TARGET_DIR" || mkdir -p "$MAKE_TARGET_DIR"
export LOGS_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME/logs"
test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR"
else
# when $PERFSUITE_RUN_DIR is not set, logs will be placed here
export CURRENT_TEST_DIR="."
export LOGS_DIR="."
fi
check_kprobes_available()
{
test -e /sys/kernel/debug/tracing/kprobe_events
}
check_uprobes_available()
{
test -e /sys/kernel/debug/tracing/uprobe_events
}
clear_all_probes()
{
echo 0 > /sys/kernel/debug/tracing/events/enable
check_kprobes_available && echo > /sys/kernel/debug/tracing/kprobe_events
check_uprobes_available && echo > /sys/kernel/debug/tracing/uprobe_events
}
check_sdt_support()
{
$CMD_PERF list sdt | grep sdt > /dev/null 2> /dev/null
}