From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Namhyung Kim <namhyung@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Shuah Khan <shuahkh@osg.samsung.com>
Subject: [PATCH 2/2] selftests: ftrace: Add check for function-fork before running pid filter test
Date: Tue, 18 Apr 2017 12:58:46 -0400 [thread overview]
Message-ID: <20170418170024.592580355@goodmis.org> (raw)
In-Reply-To: <20170418165844.984233935@goodmis.org>
[-- Attachment #1: 0002-selftests-ftrace-Add-check-for-function-fork-before-.patch --]
[-- Type: text/plain, Size: 2303 bytes --]
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Have the func-filter-pid test check for the function-fork option before
testing it. It can still test the pid filtering, but will stop before
testing the function-fork option for children inheriting the pids.
This allows the test to be added before the function-fork feature, but after
a bug fix that triggers one of the bugs the test can cause.
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
.../ftrace/test.d/ftrace/func-filter-pid.tc | 27 ++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
index cd552f44c3b4..bab5ff7c607e 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
@@ -19,10 +19,19 @@ if [ ! -f set_ftrace_filter ]; then
exit_unsupported
fi
+do_function_fork=1
+
+if [ ! -f options/function-fork ]; then
+ do_function_fork=0
+ echo "no option for function-fork found. Option will not be tested."
+fi
+
read PID _ < /proc/self/stat
-# default value of function-fork option
-orig_value=`grep function-fork trace_options`
+if [ $do_function_fork -eq 1 ]; then
+ # default value of function-fork option
+ orig_value=`grep function-fork trace_options`
+fi
do_reset() {
reset_tracer
@@ -31,6 +40,10 @@ do_reset() {
echo > set_ftrace_filter
echo > set_ftrace_pid
+ if [ $do_function_fork -eq 0 ]; then
+ return
+ fi
+
echo $orig_value > trace_options
}
@@ -53,8 +66,10 @@ do_test() {
echo $PID > set_ftrace_pid
echo function > current_tracer
- # don't allow children to be traced
- echo nofunction-fork > trace_options
+ if [ $do_function_fork -eq 1 ]; then
+ # don't allow children to be traced
+ echo nofunction-fork > trace_options
+ fi
enable_tracing
yield
@@ -70,6 +85,10 @@ do_test() {
disable_tracing
clear_trace
+ if [ $do_function_fork -eq 0 ]; then
+ return
+ fi
+
# allow children to be traced
echo function-fork > trace_options
--
2.10.2
prev parent reply other threads:[~2017-04-18 17:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 16:58 [PATCH 0/2] [GIT PULL] tracing: Add test that tests the last fix Steven Rostedt
2017-04-18 16:58 ` [PATCH 1/2] selftests: ftrace: Add a testcase for function PID filter Steven Rostedt
2017-04-18 16:58 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170418170024.592580355@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=shuahkh@osg.samsung.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome