aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2016-11-16 03:14:36 -0500
committerSteven Rostedt <rostedt@goodmis.org>2016-11-22 15:54:39 -0500
commit60c1afbf10528f646a6fcae1a2c404d216e594d5 (patch)
tree8e50196926d28456373fc3ca6f187061bfa33cc2 /tools
parent62197529000aa56d8a1ca397becd58a430cb7409 (diff)
selftests: ftrace: Add a testcase for function filter glob match
Add function filter glob matching test case. This checks whether the kernel supports glob matching (front match, end match, middle match, side match, character class and '?'). Here is the test result. ----- ./ftracetest test.d/ftrace/func-filter-glob.tc === Ftrace unit tests === [1] ftrace - function glob filters [PASS] # of passed: 1 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0 ----- Link: http://lkml.kernel.org/r/147928407589.22982.16364174511117104303.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc49
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
new file mode 100644
index 000000000000..9dcd0ca1f49c
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
@@ -0,0 +1,49 @@
1#!/bin/sh
2# description: ftrace - function glob filters
3
4# Make sure that function glob matching filter works.
5
6if ! grep -q function available_tracers; then
7 echo "no function tracer configured"
8 exit_unsupported
9fi
10
11disable_tracing
12clear_trace
13
14# filter by ?, schedule is always good
15if ! echo "sch?dule" > set_ftrace_filter; then
16 # test for powerpc 64
17 if ! echo ".sch?dule" > set_ftrace_filter; then
18 fail "can not enable schedule filter"
19 fi
20 cat set_ftrace_filter | grep '^.schedule$'
21else
22 cat set_ftrace_filter | grep '^schedule$'
23fi
24
25ftrace_filter_check() { # glob grep
26 echo "$1" > set_ftrace_filter
27 cut -f1 -d" " set_ftrace_filter > $TMPDIR/actual
28 cut -f1 -d" " available_filter_functions | grep "$2" > $TMPDIR/expected
29 DIFF=`diff $TMPDIR/actual $TMPDIR/expected`
30 test -z "$DIFF"
31}
32
33# filter by *, front match
34ftrace_filter_check '*schedule' '^.*schedule$'
35
36# filter by *, middle match
37ftrace_filter_check '*schedule*' '^.*schedule.*$'
38
39# filter by *, end match
40ftrace_filter_check 'schedule*' '^schedule.*$'
41
42# filter by *, both side match
43ftrace_filter_check 'sch*ule' '^sch.*ule$'
44
45# filter by char class.
46ftrace_filter_check '[Ss]y[Ss]_*' '^[Ss]y[Ss]_.*$'
47
48echo > set_ftrace_filter
49enable_tracing