ftracetest: Cope properly with stack tracer not being enabled
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 30 Mar 2015 05:21:40 +0000 (16:21 +1100)
committerShuah Khan <shuahkh@osg.samsung.com>
Tue, 31 Mar 2015 16:15:36 +0000 (10:15 -0600)
commita05ffdce7155769ea5ac3409e1490fb9116dbaed
tree01e6359c13e5dcd626b0117d11ab0a150c7274c7
parent0b63accf87225b5eb7e52814c374cf02d733d4bb
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 <mpe@ellerman.id.au>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc