[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cb47d0312b935c6bf6d6a917237698efca0960f3.1680176068.git.pengdonglin@sangfor.com.cn>
Date: Thu, 30 Mar 2023 04:39:15 -0700
From: Donglin Peng <pengdonglin@...gfor.com.cn>
To: mhiramat@...nel.org, rostedt@...dmis.org, linux@...linux.org.uk,
mark.rutland@....com, will@...nel.org, catalin.marinas@....com,
rmk+kernel@...linux.org.uk, palmer@...belt.com,
paul.walmsley@...ive.com, aou@...s.berkeley.edu,
tglx@...utronix.de, dave.hansen@...ux.intel.com, x86@...nel.org,
bp@...en8.de, hpa@...or.com, chenhuacai@...nel.org,
zhangqing@...ngson.cn, kernel@...0n.name, mingo@...hat.com,
peterz@...radead.org, xiehuan09@...il.com, dinghui@...gfor.com.cn,
huangcun@...gfor.com.cn, dolinux.peng@...il.com
Cc: linux-trace-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
linux-riscv@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Donglin Peng <pengdonglin@...gfor.com.cn>
Subject: [PATCH v9 8/8] selftests/ftrace: Add funcgraph-retval test case
Add a test case for the funcgraph-retval and funcgraph-retval-hex
trace options.
Signed-off-by: Donglin Peng <pengdonglin@...gfor.com.cn>
---
v8:
- Fix issues in selftest
---
.../ftrace/test.d/ftrace/fgraph-retval.tc | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc
new file mode 100644
index 000000000000..ac6d0183e4d9
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc
@@ -0,0 +1,39 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: ftrace - function graph print function return value
+# requires: set_graph_function options/funcgraph-retval options/funcgraph-retval-hex function_graph:tracer
+
+# Make sure that funcgraph-retval works
+
+fail() { # msg
+ echo $1
+ exit_fail
+}
+
+echo proc_reg_write > set_graph_function
+echo function_graph > current_tracer
+echo funcgraph-retval > trace_options
+
+enable_tracing
+
+set +e
+echo > /proc/interrupts
+set -e
+
+disable_tracing
+
+: "Test printing the error code in signed decimal format"
+echo nofuncgraph-retval-hex > trace_options
+count=`cat trace | grep 'proc_reg_write' | grep '= -5' | wc -l`
+if [ $count -eq 0 ]; then
+ fail "Return value can not be printed in signed decimal format"
+fi
+
+: "Test printing the error code in hexadecimal format"
+echo funcgraph-retval-hex > trace_options
+count=`cat trace | grep 'proc_reg_write' | grep 'fffffffb' | wc -l`
+if [ $count -eq 0 ]; then
+ fail "Return value can not be printed in hexadecimal format"
+fi
+
+exit 0
--
2.25.1
Powered by blists - more mailing lists