From: Michael Ellerman Date: Mon, 30 Mar 2015 05:21:40 +0000 (+1100) Subject: ftracetest: Cope properly with stack tracer not being enabled X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a05ffdce7155769ea5ac3409e1490fb9116dbaed;p=linux-beck.git ftracetest: Cope properly with stack tracer not being enabled If the stack tracer (CONFIG_STACK_TRACER) is disabled, the fgraph-filter-stack test blows chunks: [8] ftrace - function graph filters with stack tracer [FAIL] + reset_tracer + echo nop ./ftracetest: 19: /home/michael/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc: cannot create /proc/sys/kernel/stack_tracer_enabled: Directory nonexistent Fix it by checking if the proc file exists before echoing to it. With the patch applied it fails correctly with: [8] ftrace - function graph filters with stack tracer [UNSUPPORTED] Signed-off-by: Michael Ellerman Acked-by: Steven Rostedt Signed-off-by: Shuah Khan --- diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc index c15e018e0220..3b1cf20cf6d8 100644 --- a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc @@ -16,7 +16,9 @@ fi do_reset() { reset_tracer - echo 0 > /proc/sys/kernel/stack_tracer_enabled + if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then + echo 0 > /proc/sys/kernel/stack_tracer_enabled + fi enable_tracing clear_trace echo > set_ftrace_filter