File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
tools/testing/selftests/ftrace/test.d/ftrace Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # SPDX-License-Identifier: GPL-2.0
3
+ # description: ftrace - function graph print function return value
4
+ # requires: options/funcgraph-retval options/funcgraph-retval-hex function_graph:tracer
5
+
6
+ # Make sure that funcgraph-retval works
7
+
8
+ fail () { # msg
9
+ echo $1
10
+ exit_fail
11
+ }
12
+
13
+ disable_tracing
14
+ clear_trace
15
+
16
+ # get self PID, can not use $$, because it is PPID
17
+ read PID _ < /proc/self/stat
18
+
19
+ [ -f set_ftrace_filter ] && echo proc_reg_write > set_ftrace_filter
20
+ [ -f set_ftrace_pid ] && echo ${PID} > set_ftrace_pid
21
+ echo function_graph > current_tracer
22
+ echo 1 > options/funcgraph-retval
23
+
24
+ set +e
25
+ enable_tracing
26
+ echo > /proc/interrupts
27
+ disable_tracing
28
+ set -e
29
+
30
+ : " Test printing the error code in signed decimal format"
31
+ echo 0 > options/funcgraph-retval-hex
32
+ count=` cat trace | grep ' proc_reg_write' | grep ' = -5' | wc -l`
33
+ if [ $count -eq 0 ]; then
34
+ fail " Return value can not be printed in signed decimal format"
35
+ fi
36
+
37
+ : " Test printing the error code in hexadecimal format"
38
+ echo 1 > options/funcgraph-retval-hex
39
+ count=` cat trace | grep ' proc_reg_write' | grep ' fffffffb' | wc -l`
40
+ if [ $count -eq 0 ]; then
41
+ fail " Return value can not be printed in hexadecimal format"
42
+ fi
43
+
44
+ exit 0
You can’t perform that action at this time.
0 commit comments