linux-stable/tools/testing/selftests/bpf/test_ftrace.sh
Ross Zwisler ab4c15feb2 selftests/bpf: use canonical ftrace path
The canonical location for the tracefs filesystem is at
/sys/kernel/tracing.

But, from Documentation/trace/ftrace.rst:

  Before 4.1, all ftrace tracing control files were within the debugfs
  file system, which is typically located at /sys/kernel/debug/tracing.
  For backward compatibility, when mounting the debugfs file system,
  the tracefs file system will be automatically mounted at:

  /sys/kernel/debug/tracing

Many tests in the bpf selftest code still refer to this older debugfs
path, so let's update them to avoid confusion.

Signed-off-by: Ross Zwisler <zwisler@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20230313205628.1058720-3-zwisler@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-03-13 21:51:30 -07:00

44 lines
786 B
Bash
Executable file

#!/bin/bash
if [[ -e /sys/kernel/tracing/trace ]]; then
TR=/sys/kernel/tracing/
else
TR=/sys/kernel/debug/tracing/
fi
clear_trace() { # reset trace output
echo > $TR/trace
}
disable_tracing() { # stop trace recording
echo 0 > $TR/tracing_on
}
enable_tracing() { # start trace recording
echo 1 > $TR/tracing_on
}
reset_tracer() { # reset the current tracer
echo nop > $TR/current_tracer
}
disable_tracing
clear_trace
echo "" > $TR/set_ftrace_filter
echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace
echo "bpf_prog_test*" > $TR/set_graph_function
echo "" > $TR/set_graph_notrace
echo function_graph > $TR/current_tracer
enable_tracing
./test_progs -t fentry
./test_progs -t fexit
disable_tracing
clear_trace
reset_tracer
exit 0