diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-02-06 17:28:36 -0500 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-02-08 10:31:50 -0500 |
commit | 878cb3fb06c67e8f1a452346e0bc6bb85f29b0a0 (patch) | |
tree | 54b5a4346e706d7f87f37b9ac7bed4ee63637bbd /tools/testing | |
parent | 97fe22adf33f06519bfdf7dad33bcd562e366c8f (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.tc | 37 |
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" |
129 | fi | 129 | fi |
130 | 130 | ||
131 | test_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 | ||
138 | cat available_filter_functions | cut -d' ' -f1 | grep 'lock' | sort -u > $TMPDIR/expected | ||
139 | echo '*lock*:traceoff' > set_ftrace_filter | ||
140 | test_actual | ||
141 | |||
142 | # now remove all with 'try' in it, and end with lock | ||
143 | grep -v 'try.*lock$' $TMPDIR/expected > $TMPDIR/expected2 | ||
144 | mv $TMPDIR/expected2 $TMPDIR/expected | ||
145 | echo '!*try*lock:traceoff' >> set_ftrace_filter | ||
146 | test_actual | ||
147 | |||
148 | # remove all that start with "m" and end with "lock" | ||
149 | grep -v '^m.*lock$' $TMPDIR/expected > $TMPDIR/expected2 | ||
150 | mv $TMPDIR/expected2 $TMPDIR/expected | ||
151 | echo '!m*lock:traceoff' >> set_ftrace_filter | ||
152 | test_actual | ||
153 | |||
154 | # remove all that start with "c" and have "unlock" | ||
155 | grep -v '^c.*unlock' $TMPDIR/expected > $TMPDIR/expected2 | ||
156 | mv $TMPDIR/expected2 $TMPDIR/expected | ||
157 | echo '!c*unlock*:traceoff' >> set_ftrace_filter | ||
158 | test_actual | ||
159 | |||
160 | # clear all the rest | ||
161 | > $TMPDIR/expected | ||
162 | echo '!*:traceoff' >> set_ftrace_filter | ||
163 | test_actual | ||
164 | |||
165 | rm $TMPDIR/expected | ||
166 | rm $TMPDIR/actual | ||
167 | |||
131 | do_reset | 168 | do_reset |
132 | 169 | ||
133 | exit 0 | 170 | exit 0 |