Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1503561
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4/5] selftests: ftrace: Add a testcase for function filter glob match |
| Date | 2016-10-19 07:00 +0200 |
| Message-ID | <stR8R-4sP-7@gated-at.bofh.it> (permalink) |
| References | <stR8R-4sP-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
-----
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
.../ftrace/test.d/ftrace/func-filter-glob.tc | 49 ++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
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 0000000..9dcd0ca
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
@@ -0,0 +1,49 @@
+#!/bin/sh
+# description: ftrace - function glob filters
+
+# Make sure that function glob matching filter works.
+
+if ! grep -q function available_tracers; then
+ echo "no function tracer configured"
+ exit_unsupported
+fi
+
+disable_tracing
+clear_trace
+
+# filter by ?, schedule is always good
+if ! echo "sch?dule" > set_ftrace_filter; then
+ # test for powerpc 64
+ if ! echo ".sch?dule" > set_ftrace_filter; then
+ fail "can not enable schedule filter"
+ fi
+ cat set_ftrace_filter | grep '^.schedule$'
+else
+ cat set_ftrace_filter | grep '^schedule$'
+fi
+
+ftrace_filter_check() { # glob grep
+ echo "$1" > set_ftrace_filter
+ cut -f1 -d" " set_ftrace_filter > $TMPDIR/actual
+ cut -f1 -d" " available_filter_functions | grep "$2" > $TMPDIR/expected
+ DIFF=`diff $TMPDIR/actual $TMPDIR/expected`
+ test -z "$DIFF"
+}
+
+# filter by *, front match
+ftrace_filter_check '*schedule' '^.*schedule$'
+
+# filter by *, middle match
+ftrace_filter_check '*schedule*' '^.*schedule.*$'
+
+# filter by *, end match
+ftrace_filter_check 'schedule*' '^schedule.*$'
+
+# filter by *, both side match
+ftrace_filter_check 'sch*ule' '^sch.*ule$'
+
+# filter by char class.
+ftrace_filter_check '[Ss]y[Ss]_*' '^[Ss]y[Ss]_.*$'
+
+echo > set_ftrace_filter
+enable_tracing
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] ftrace: selftests: Add full glob matching and update ftracetest Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-19 07:00 +0200
[PATCH 4/5] selftests: ftrace: Add a testcase for function filter glob match Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-19 07:00 +0200
[PATCH 1/5] ftrace: Support full glob matching Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-19 07:00 +0200
Re: [PATCH 1/5] ftrace: Support full glob matching Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 16:40 +0200
Re: [PATCH 1/5] ftrace: Support full glob matching Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-20 04:10 +0200
Re: [PATCH 1/5] ftrace: Support full glob matching Steven Rostedt <rostedt@goodmis.org> - 2016-10-20 15:50 +0200
Re: [PATCH 1/5] ftrace: Support full glob matching Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-21 18:50 +0200
[PATCH 5/5] selftests: ftrace: Add a testcase for types of kprobe event Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-19 07:00 +0200
csiph-web