diff mbox series

[v2,25/32] selftests/ftrace: Add function filter on module testcase

Message ID 153443765894.23257.13622063956539869338.stgit@devbox (mailing list archive)
State Superseded
Headers show
Series selftests/ftrace: Improve ftracetest with coverage check | expand

Commit Message

Masami Hiramatsu (Google) Aug. 16, 2018, 4:40 p.m. UTC
Add a testcase for function filter on module.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 .../ftrace/test.d/ftrace/func_mod_trace.tc         |   24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc

Comments

Steven Rostedt Aug. 24, 2018, 11:25 p.m. UTC | #1
On Fri, 17 Aug 2018 01:40:59 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Add a testcase for function filter on module.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  .../ftrace/test.d/ftrace/func_mod_trace.tc         |   24 ++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
> new file mode 100644
> index 000000000000..359380c3834f
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: ftrace - function trace on module
> +
> +[ ! -f set_ftrace_filter ] && exit_unsupported
> +
> +: "mod: allows to filter a non exist function"
> +echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
> +grep -q "non_exist_func" set_ftrace_filter
> +
> +: "mod: on exist module"
> +echo '*:mod:trace_printk' > set_ftrace_filter
> +if ! modprobe trace-printk.ko ; then

Need to remove the '.ko'

-- Steve

> +  echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
> +m"
> +  exit_unresolved;
> +fi
> +
> +: "Wildcard should be resolved after loading module"
> +grep -q "trace_printk_irq_work" set_ftrace_filter
> +
> +: "After removing the filter becomes empty"
> +rmmod trace_printk
> +test `cat set_ftrace_filter | wc -l` -eq 0
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
new file mode 100644
index 000000000000..359380c3834f
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
@@ -0,0 +1,24 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: ftrace - function trace on module
+
+[ ! -f set_ftrace_filter ] && exit_unsupported
+
+: "mod: allows to filter a non exist function"
+echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
+grep -q "non_exist_func" set_ftrace_filter
+
+: "mod: on exist module"
+echo '*:mod:trace_printk' > set_ftrace_filter
+if ! modprobe trace-printk.ko ; then
+  echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
+m"
+  exit_unresolved;
+fi
+
+: "Wildcard should be resolved after loading module"
+grep -q "trace_printk_irq_work" set_ftrace_filter
+
+: "After removing the filter becomes empty"
+rmmod trace_printk
+test `cat set_ftrace_filter | wc -l` -eq 0