From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754404AbdDRRAa (ORCPT ); Tue, 18 Apr 2017 13:00:30 -0400 Received: from mail.kernel.org ([198.145.29.136]:48136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbdDRRA2 (ORCPT ); Tue, 18 Apr 2017 13:00:28 -0400 Message-Id: <20170418170024.592580355@goodmis.org> User-Agent: quilt/0.63-1 Date: Tue, 18 Apr 2017 12:58:46 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Ingo Molnar , Andrew Morton , Namhyung Kim , Masami Hiramatsu , Shuah Khan Subject: [PATCH 2/2] selftests: ftrace: Add check for function-fork before running pid filter test References: <20170418165844.984233935@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=0002-selftests-ftrace-Add-check-for-function-fork-before-.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Steven Rostedt (VMware)" 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 Cc: Shuah Khan Signed-off-by: Steven Rostedt (VMware) --- .../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