ftracetest: Add functions file that holds helper functions
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Mon, 3 Nov 2014 20:36:35 +0000 (15:36 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 6 Nov 2014 13:30:02 +0000 (08:30 -0500)
Created the file tools/testing/ftrace/test.d/functions that will
hold helper functions.

Current helper functions include:

 Add clear_trace() helper to reset the trace file

   Used as a descriptive name to show that "echo > trace" is clearing
   the trace file.

 Add disable/enable_tracing() helper calls

   Add calls that disable and enable tracing respectively by echoing
   0 or 1 into tracing_on.

 Add helper reset_tracer() function

    Add a helper function reset_tracer() that will clear the current_tracer
    (echo nop > current_tracer).

Link: http://lkml.kernel.org/r/20141103212737.696365174@goodmis.org
Link: http://lkml.kernel.org/r/20141104153028.465517119@goodmis.org
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/selftests/ftrace/ftracetest
tools/testing/selftests/ftrace/test.d/functions [new file with mode: 0644]

index f15c0da07aca0a5818eaad98503bc5a7c6181ffa..c6381a9faf83ce40d7696cc4465ebe966e59eda1 100755 (executable)
@@ -235,6 +235,9 @@ run_test() { # testfile
   fi
 }
 
+# load in the helper functions
+. $TEST_DIR/functions
+
 # Main loop
 for t in $TEST_CASES; do
   run_test $t
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
new file mode 100644 (file)
index 0000000..5d8cd06
--- /dev/null
@@ -0,0 +1,16 @@
+
+clear_trace() { # reset trace output
+    echo > trace
+}
+
+disable_tracing() { # stop trace recording
+    echo 0 > tracing_on
+}
+
+enable_tracing() { # start trace recording
+    echo 1 > tracing_on
+}
+
+reset_tracer() { # reset the current tracer
+    echo nop > current_tracer
+}