xref: /linux/tools/testing/selftests/bpf/test_ftrace.sh (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1#!/bin/bash
2
3TR=/sys/kernel/debug/tracing/
4clear_trace() { # reset trace output
5    echo > $TR/trace
6}
7
8disable_tracing() { # stop trace recording
9    echo 0 > $TR/tracing_on
10}
11
12enable_tracing() { # start trace recording
13    echo 1 > $TR/tracing_on
14}
15
16reset_tracer() { # reset the current tracer
17    echo nop > $TR/current_tracer
18}
19
20disable_tracing
21clear_trace
22
23echo "" > $TR/set_ftrace_filter
24echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace
25
26echo "bpf_prog_test*" > $TR/set_graph_function
27echo "" > $TR/set_graph_notrace
28
29echo function_graph > $TR/current_tracer
30
31enable_tracing
32./test_progs -t fentry
33./test_progs -t fexit
34disable_tracing
35clear_trace
36
37reset_tracer
38
39exit 0
40