]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
selftests: ftrace: Add check for function-fork before running pid filter test
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 18 Apr 2017 16:32:21 +0000 (12:32 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 18 Apr 2017 16:46:11 +0000 (12:46 -0400)
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>
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc

index cd552f44c3b453f15e8d3e1f200aa91a24f50243..bab5ff7c607edbbe12fa7680626e6e260e0bb4e8 100644 (file)
@@ -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