summaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-02-06 17:28:36 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-02-08 10:31:50 -0500
commit878cb3fb06c67e8f1a452346e0bc6bb85f29b0a0 (patch)
tree54b5a4346e706d7f87f37b9ac7bed4ee63637bbd /tools/testing
parent97fe22adf33f06519bfdf7dad33bcd562e366c8f (diff)
selftests/ftrace: Add more tests for removing of function probes
Al Viro discovered a bug in the removing of function probes where if it had a '*' at the beginning, it would fail to find any matches. That is, because it reset the glob search string to the the initial string with a "MATCH_END" type, instead of skipping the wildcard "*" it included it, where it would not match any functions because "*" was being treated as a normal character and not a wildcard one. Link: http://lkml.kernel.org/r/20180127031706.GE13338@ZenIV.linux.org.uk Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
index 0f3f92622e33..68e7a48f5828 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
@@ -128,6 +128,43 @@ if check_set_ftrace_filter "$FUNC1" "$FUNC2" ; then
128 fail "Expected $FUNC1 and $FUNC2" 128 fail "Expected $FUNC1 and $FUNC2"
129fi 129fi
130 130
131test_actual() { # Compares $TMPDIR/expected with set_ftrace_filter
132 cat set_ftrace_filter | grep -v '#' | cut -d' ' -f1 | cut -d':' -f1 | sort -u > $TMPDIR/actual
133 DIFF=`diff $TMPDIR/actual $TMPDIR/expected`
134 test -z "$DIFF"
135}
136
137# Set traceoff trigger for all fuctions with "lock" in their name
138cat available_filter_functions | cut -d' ' -f1 | grep 'lock' | sort -u > $TMPDIR/expected
139echo '*lock*:traceoff' > set_ftrace_filter
140test_actual
141
142# now remove all with 'try' in it, and end with lock
143grep -v 'try.*lock$' $TMPDIR/expected > $TMPDIR/expected2
144mv $TMPDIR/expected2 $TMPDIR/expected
145echo '!*try*lock:traceoff' >> set_ftrace_filter
146test_actual
147
148# remove all that start with "m" and end with "lock"
149grep -v '^m.*lock$' $TMPDIR/expected > $TMPDIR/expected2
150mv $TMPDIR/expected2 $TMPDIR/expected
151echo '!m*lock:traceoff' >> set_ftrace_filter
152test_actual
153
154# remove all that start with "c" and have "unlock"
155grep -v '^c.*unlock' $TMPDIR/expected > $TMPDIR/expected2
156mv $TMPDIR/expected2 $TMPDIR/expected
157echo '!c*unlock*:traceoff' >> set_ftrace_filter
158test_actual
159
160# clear all the rest
161> $TMPDIR/expected
162echo '!*:traceoff' >> set_ftrace_filter
163test_actual
164
165rm $TMPDIR/expected
166rm $TMPDIR/actual
167
131do_reset 168do_reset
132 169
133exit 0 170exit 0